first commit
This commit is contained in:
32
application/libraries/MY_Gmap_Marker.php
Normal file
32
application/libraries/MY_Gmap_Marker.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
|
||||
class Gmap_Marker extends Gmap_Marker_Core
|
||||
{
|
||||
public function render($tabs = 0, $show = false)
|
||||
{
|
||||
// Create the tabs
|
||||
$tabs = empty($tabs) ? '' : str_repeat("\t", $tabs);
|
||||
|
||||
// Marker ID
|
||||
$marker = 'm'.++self::$id;
|
||||
|
||||
$output[] = 'var '.$marker.' = new google.maps.Marker(new google.maps.LatLng('.$this->latitude.', '.$this->longitude.'), {'.implode(",", $this->options).'});';
|
||||
if ($html = $this->html)
|
||||
{
|
||||
$output[] = 'google.maps.Event.addListener('.$marker.', "click", function()';
|
||||
$output[] = '{';
|
||||
$output[] = "\t".$marker.'.openInfoWindowHtml(';
|
||||
$output[] = "\t\t'".implode("'+\n\t\t$tabs'", explode("\n", $html))."'";
|
||||
$output[] = "\t);";
|
||||
$output[] = '});';
|
||||
|
||||
if($show)
|
||||
{
|
||||
$output[] = "map.openInfoWindowHtml(new google.maps.LatLng($this->latitude, $this->longitude), '$html');";
|
||||
}
|
||||
}
|
||||
$output[] = 'map.addOverlay('.$marker.');';
|
||||
|
||||
return implode("\n".$tabs, $output);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user