| 1 | <?php defined('SYSPATH') or die('No direct script access.'); |
|---|
| 2 | |
|---|
| 3 | class Gmap_Marker extends Gmap_Marker_Core { |
|---|
| 4 | |
|---|
| 5 | public function render($tabs = 0) |
|---|
| 6 | { |
|---|
| 7 | |
|---|
| 8 | $tabs = empty($tabs) ? '' : str_repeat("\t", $tabs); |
|---|
| 9 | |
|---|
| 10 | $output = array(); |
|---|
| 11 | $var = 'm'.mt_rand(); |
|---|
| 12 | $output[] = 'var '.$var.' = new GMarker(new GLatLng('.$this->latitude.', '.$this->longitude.'));'; |
|---|
| 13 | if ($html = $this->html) |
|---|
| 14 | { |
|---|
| 15 | $output[] = 'GEvent.addListener('.$var.', "click", function()'; |
|---|
| 16 | $output[] = '{'; |
|---|
| 17 | $output[] = "\t".$var.'.openInfoWindowHtml('; |
|---|
| 18 | $output[] = "\t\t'".implode("'+\n\t\t$tabs'", explode("\n", $html))."'"; |
|---|
| 19 | $output[] = "\t);"; |
|---|
| 20 | $output[] = '});'; |
|---|
| 21 | } |
|---|
| 22 | $output[] = 'map.addOverlay('.$var.');'; |
|---|
| 23 | |
|---|
| 24 | return implode("\n".$tabs, $output); |
|---|
| 25 | } |
|---|
| 26 | |
|---|
| 27 | } |
|---|