@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * |
213 | 213 | * @param string $googleMapKey the googleMapKey |
214 | 214 | * |
215 | - * @return void |
|
215 | + * @return MapAPI |
|
216 | 216 | */ |
217 | 217 | |
218 | 218 | public function setKey($googleMapKey) { |
@@ -220,6 +220,9 @@ discard block |
||
220 | 220 | return $this; |
221 | 221 | } |
222 | 222 | |
223 | + /** |
|
224 | + * @param boolean $inclusion |
|
225 | + */ |
|
223 | 226 | public function setIncludeDownloadJavascript($inclusion) { |
224 | 227 | self::$include_download_javascript = $inclusion; |
225 | 228 | return $this; |
@@ -253,13 +256,9 @@ discard block |
||
253 | 256 | * Set the useClusterer parameter (optimization to display a lot of marker) |
254 | 257 | * |
255 | 258 | * @param boolean $useClusterer use cluster or not |
256 | - * @param string $clusterIcon the cluster icon |
|
257 | - * @param int $maxVisibleMarkers max visible markers |
|
258 | 259 | * @param int $gridSize grid size |
259 | - * @param int $minMarkersPerClusterer minMarkersPerClusterer |
|
260 | - * @param int $maxLinesPerInfoBox maxLinesPerInfoBox |
|
261 | 260 | * |
262 | - * @return void |
|
261 | + * @return MapAPI |
|
263 | 262 | */ |
264 | 263 | |
265 | 264 | public function setClusterer($useClusterer, $gridSize=50, $maxZoom=17, |
@@ -276,7 +275,7 @@ discard block |
||
276 | 275 | * |
277 | 276 | * @param string $googleMapId the google div ID |
278 | 277 | * |
279 | - * @return void |
|
278 | + * @return MapAPI |
|
280 | 279 | */ |
281 | 280 | |
282 | 281 | public function setDivId($googleMapId) { |
@@ -289,7 +288,7 @@ discard block |
||
289 | 288 | * |
290 | 289 | * @param string $googleMapDirectionId GoogleMap Direction ID for the HTML DIV |
291 | 290 | * |
292 | - * @return void |
|
291 | + * @return MapAPI |
|
293 | 292 | */ |
294 | 293 | |
295 | 294 | public function setDirectionDivId($googleMapDirectionId) { |
@@ -304,7 +303,7 @@ discard block |
||
304 | 303 | * @param int $width GoogleMap width |
305 | 304 | * @param int $height GoogleMap height |
306 | 305 | * |
307 | - * @return void |
|
306 | + * @return MapAPI |
|
308 | 307 | */ |
309 | 308 | |
310 | 309 | public function setSize($width, $height) { |
@@ -320,7 +319,7 @@ discard block |
||
320 | 319 | * @param int $iconWidth GoogleMap marker icon width |
321 | 320 | * @param int $iconHeight GoogleMap marker icon height |
322 | 321 | * |
323 | - * @return void |
|
322 | + * @return MapAPI |
|
324 | 323 | */ |
325 | 324 | |
326 | 325 | public function setIconSize($iconWidth, $iconHeight) { |
@@ -334,7 +333,7 @@ discard block |
||
334 | 333 | * |
335 | 334 | * @param string $lang GoogleMap lang : fr,en,.. |
336 | 335 | * |
337 | - * @return void |
|
336 | + * @return MapAPI |
|
338 | 337 | */ |
339 | 338 | |
340 | 339 | public function setLang($lang) { |
@@ -347,7 +346,7 @@ discard block |
||
347 | 346 | * |
348 | 347 | * @param int $zoom GoogleMap zoom. |
349 | 348 | * |
350 | - * @return void |
|
349 | + * @return MapAPI |
|
351 | 350 | */ |
352 | 351 | |
353 | 352 | public function setZoom($zoom) { |
@@ -358,9 +357,8 @@ discard block |
||
358 | 357 | /** |
359 | 358 | * Set the zoom of the infowindow |
360 | 359 | * |
361 | - * @param int $zoom GoogleMap zoom. |
|
362 | 360 | * |
363 | - * @return void |
|
361 | + * @return MapAPI |
|
364 | 362 | */ |
365 | 363 | |
366 | 364 | public function setInfoWindowZoom($infoWindowZoom) { |
@@ -371,9 +369,8 @@ discard block |
||
371 | 369 | /** |
372 | 370 | * Enable the zoom on the marker when you click on it |
373 | 371 | * |
374 | - * @param int $zoom GoogleMap zoom. |
|
375 | 372 | * |
376 | - * @return void |
|
373 | + * @return MapAPI |
|
377 | 374 | */ |
378 | 375 | |
379 | 376 | public function setEnableWindowZoom($enableWindowZoom) { |
@@ -384,9 +381,9 @@ discard block |
||
384 | 381 | /** |
385 | 382 | * Enable theautomatic center/zoom at the gmap load |
386 | 383 | * |
387 | - * @param int $zoom GoogleMap zoom. |
|
388 | 384 | * |
389 | - * @return void |
|
385 | + * @param boolean $enableAutomaticCenterZoom |
|
386 | + * @return MapAPI |
|
390 | 387 | */ |
391 | 388 | |
392 | 389 | public function setEnableAutomaticCenterZoom($enableAutomaticCenterZoom) { |
@@ -399,7 +396,7 @@ discard block |
||
399 | 396 | * |
400 | 397 | * @param string $center GoogleMap center (an address) |
401 | 398 | * |
402 | - * @return void |
|
399 | + * @return MapAPI |
|
403 | 400 | */ |
404 | 401 | |
405 | 402 | public function setCenter($center) { |
@@ -412,7 +409,7 @@ discard block |
||
412 | 409 | * |
413 | 410 | * @param string $mapType Can be one of road,satellite,hybrid or terrain. Defaults to road |
414 | 411 | * |
415 | - * @return void |
|
412 | + * @return MapAPI |
|
416 | 413 | */ |
417 | 414 | |
418 | 415 | public function setMapType($mapType) { |
@@ -458,7 +455,7 @@ discard block |
||
458 | 455 | * |
459 | 456 | * @param boolean $displayDirectionFields display directions or not in the info window |
460 | 457 | * |
461 | - * @return void |
|
458 | + * @return MapAPI |
|
462 | 459 | */ |
463 | 460 | |
464 | 461 | public function setDisplayDirectionFields($displayDirectionFields) { |
@@ -471,7 +468,7 @@ discard block |
||
471 | 468 | * |
472 | 469 | * @param boolean $defaultHideMarker hide all the markers on the map by default |
473 | 470 | * |
474 | - * @return void |
|
471 | + * @return MapAPI |
|
475 | 472 | */ |
476 | 473 | |
477 | 474 | public function setDefaultHideMarker($defaultHideMarker) { |
@@ -555,7 +552,7 @@ discard block |
||
555 | 552 | * @param string $category marker category |
556 | 553 | * @param string $icon an icon url |
557 | 554 | * |
558 | - * @return void |
|
555 | + * @return MapAPI |
|
559 | 556 | */ |
560 | 557 | |
561 | 558 | public function addMarkerByCoords($lat, $lng, $html='', $category='', $icon='') { |
@@ -579,7 +576,7 @@ discard block |
||
579 | 576 | * @param string $category marker category |
580 | 577 | * @param string $icon an icon url |
581 | 578 | * |
582 | - * @return void |
|
579 | + * @return MapAPI |
|
583 | 580 | */ |
584 | 581 | |
585 | 582 | public function addMarkerByAddress($address, $content='', $category='', $icon='') { |
@@ -599,7 +596,7 @@ discard block |
||
599 | 596 | * @param string $category marker category |
600 | 597 | * @param string $icon an icon url |
601 | 598 | * |
602 | - * @return void |
|
599 | + * @return MapAPI |
|
603 | 600 | */ |
604 | 601 | |
605 | 602 | public function addArrayMarkerByCoords($coordtab, $category='', $icon='') { |
@@ -681,7 +678,7 @@ discard block |
||
681 | 678 | * @param string $category marker category |
682 | 679 | * @param string $icon an icon url |
683 | 680 | * |
684 | - * @return void |
|
681 | + * @return MapAPI |
|
685 | 682 | */ |
686 | 683 | |
687 | 684 | public function addArrayMarkerByAddress($coordtab, $category='', $icon='') { |
@@ -710,7 +707,7 @@ discard block |
||
710 | 707 | * |
711 | 708 | * @param string $url url of the kml file compatible with gmap and gearth |
712 | 709 | * |
713 | - * @return void |
|
710 | + * @return MapAPI |
|
714 | 711 | */ |
715 | 712 | |
716 | 713 | public function addKML($url) { |
@@ -870,6 +867,10 @@ discard block |
||
870 | 867 | return $result; |
871 | 868 | } |
872 | 869 | |
870 | + /** |
|
871 | + * @param string $templateName |
|
872 | + * @param ArrayData $templateVariables |
|
873 | + */ |
|
873 | 874 | function processTemplateHTML($templateName, $templateVariables = null ) { |
874 | 875 | if (!$templateVariables) { |
875 | 876 | $templateVariables = new ArrayList(); |
@@ -446,8 +446,8 @@ |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
449 | - * Set the center of the gmap |
|
450 | - **/ |
|
449 | + * Set the center of the gmap |
|
450 | + **/ |
|
451 | 451 | public function setLatLongCenter($center) { |
452 | 452 | $this->latLongCenter = $center; |
453 | 453 | return $this; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return void |
204 | 204 | */ |
205 | 205 | |
206 | - public function __construct($googleMapKey='') { |
|
206 | + public function __construct($googleMapKey = '') { |
|
207 | 207 | $this->googleMapKey = $googleMapKey; |
208 | 208 | } |
209 | 209 | |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | * @return void |
263 | 263 | */ |
264 | 264 | |
265 | - public function setClusterer($useClusterer, $gridSize=50, $maxZoom=17, |
|
266 | - $clustererLibraryPath='/mappable/javascript/google/markerclusterer.js') { |
|
265 | + public function setClusterer($useClusterer, $gridSize = 50, $maxZoom = 17, |
|
266 | + $clustererLibraryPath = '/mappable/javascript/google/markerclusterer.js') { |
|
267 | 267 | $this->useClusterer = $useClusterer; |
268 | 268 | $this->gridSize = $gridSize; |
269 | 269 | $this->maxZoom = $maxZoom; |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | * @return void |
559 | 559 | */ |
560 | 560 | |
561 | - public function addMarkerByCoords($lat, $lng, $html='', $category='', $icon='') { |
|
561 | + public function addMarkerByCoords($lat, $lng, $html = '', $category = '', $icon = '') { |
|
562 | 562 | $m = array( |
563 | 563 | 'latitude' => $lat, |
564 | 564 | 'longitude' => $lng, |
@@ -582,9 +582,9 @@ discard block |
||
582 | 582 | * @return void |
583 | 583 | */ |
584 | 584 | |
585 | - public function addMarkerByAddress($address, $content='', $category='', $icon='') { |
|
585 | + public function addMarkerByAddress($address, $content = '', $category = '', $icon = '') { |
|
586 | 586 | $point = $this->geocoding($address); |
587 | - if ($point!==null) { |
|
587 | + if ($point !== null) { |
|
588 | 588 | $this->addMarkerByCoords($point[2], $point[3], $content, $category, $icon); |
589 | 589 | } else { |
590 | 590 | // throw new Exception('Adress not found : '.$address); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | * @return void |
603 | 603 | */ |
604 | 604 | |
605 | - public function addArrayMarkerByCoords($coordtab, $category='', $icon='') { |
|
605 | + public function addArrayMarkerByCoords($coordtab, $category = '', $icon = '') { |
|
606 | 606 | foreach ($coordtab as $coord) { |
607 | 607 | $this->addMarkerByCoords($coord[0], $coord[1], $coord[2], $category, $icon); |
608 | 608 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | * @return void |
685 | 685 | */ |
686 | 686 | |
687 | - public function addArrayMarkerByAddress($coordtab, $category='', $icon='') { |
|
687 | + public function addArrayMarkerByAddress($coordtab, $category = '', $icon = '') { |
|
688 | 688 | foreach ($coordtab as $coord) { |
689 | 689 | $this->addMarkerByAddress($coord[0], $coord[1], $category, $icon); |
690 | 690 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | * @return void |
702 | 702 | */ |
703 | 703 | |
704 | - public function addDirection($from, $to, $idpanel='') { |
|
704 | + public function addDirection($from, $to, $idpanel = '') { |
|
705 | 705 | $this->contentMarker .= 'addDirection("'.$from.'","'.$to.'","'.$idpanel.'");'; |
706 | 706 | } |
707 | 707 | |
@@ -765,9 +765,9 @@ discard block |
||
765 | 765 | $linesJson = stripslashes($this->jsonRemoveUnicodeSequences($this->lines)); |
766 | 766 | $kmlJson = stripslashes($this->jsonRemoveUnicodeSequences($this->kmlFiles)); |
767 | 767 | } else { |
768 | - $jsonMarkers = stripslashes(json_encode($this->markers,JSON_UNESCAPED_UNICODE)); |
|
769 | - $linesJson = stripslashes(json_encode($this->lines,JSON_UNESCAPED_UNICODE)); |
|
770 | - $kmlJson = stripslashes(json_encode($this->kmlFiles,JSON_UNESCAPED_UNICODE)); |
|
768 | + $jsonMarkers = stripslashes(json_encode($this->markers, JSON_UNESCAPED_UNICODE)); |
|
769 | + $linesJson = stripslashes(json_encode($this->lines, JSON_UNESCAPED_UNICODE)); |
|
770 | + $kmlJson = stripslashes(json_encode($this->kmlFiles, JSON_UNESCAPED_UNICODE)); |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | $this->latLongCenter : $this->geocoding($this->center); |
778 | 778 | |
779 | 779 | // coordinates for centre depending on which method used |
780 | - if ($geocodeCentre[0]=="200") { // success |
|
781 | - $latlngCentre = array('lat'=>$geocodeCentre[2],'lng' => $geocodeCentre[3]); |
|
780 | + if ($geocodeCentre[0] == "200") { // success |
|
781 | + $latlngCentre = array('lat'=>$geocodeCentre[2], 'lng' => $geocodeCentre[3]); |
|
782 | 782 | } else { // Paris |
783 | 783 | $latlngCentre = array('lat'=>48.8792, 'lng' => 2.34778); |
784 | 784 | } |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | return $result; |
871 | 871 | } |
872 | 872 | |
873 | - function processTemplateHTML($templateName, $templateVariables = null ) { |
|
873 | + function processTemplateHTML($templateName, $templateVariables = null) { |
|
874 | 874 | if (!$templateVariables) { |
875 | 875 | $templateVariables = new ArrayList(); |
876 | 876 | } |
@@ -184,7 +184,7 @@ |
||
184 | 184 | |
185 | 185 | /** |
186 | 186 | * Access the map editing field for the purpose of adding guide points |
187 | - * @return [LatLongField] instance of location editing field |
|
187 | + * @return FormField instance of location editing field |
|
188 | 188 | */ |
189 | 189 | public function getMapField() { |
190 | 190 | if (!isset($this->mapField)) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | 'MapPinIcon' => 'Image' |
19 | 19 | ); |
20 | 20 | |
21 | - static $defaults = array ( |
|
21 | + static $defaults = array( |
|
22 | 22 | 'Lat' =>0, |
23 | 23 | 'Lon' => 0, |
24 | 24 | 'Zoom' => 4, |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | // add any KML map layers |
147 | 147 | if (Object::has_extension($this->owner->ClassName, 'MapLayerExtension')) { |
148 | - foreach($this->owner->MapLayers() as $layer) { |
|
148 | + foreach ($this->owner->MapLayers() as $layer) { |
|
149 | 149 | $map->addKML($layer->KmlFile()->getAbsoluteURL()); |
150 | 150 | // we have a layer, so turn on autozoom |
151 | 151 | $autozoom = true; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | // add points of interest taking into account the default icon of the layer as an override |
157 | 157 | if (Object::has_extension($this->owner->ClassName, 'PointsOfInterestLayerExtension')) { |
158 | - foreach($this->owner->PointsOfInterestLayers() as $layer) { |
|
158 | + foreach ($this->owner->PointsOfInterestLayers() as $layer) { |
|
159 | 159 | $layericon = $layer->DefaultIcon(); |
160 | 160 | if ($layericon->ID === 0) { |
161 | 161 | $layericon = null; |
@@ -8,15 +8,15 @@ |
||
8 | 8 | |
9 | 9 | public static function parse_googlestreetview($arguments, $caption = null, $parser = null) { |
10 | 10 | // each of latitude, longitude and heading are required at a bare minimum |
11 | - if(!isset($arguments['latitude'])){ |
|
11 | + if (!isset($arguments['latitude'])) { |
|
12 | 12 | return ''; |
13 | 13 | } |
14 | 14 | |
15 | - if(!isset($arguments['longitude'])){ |
|
15 | + if (!isset($arguments['longitude'])) { |
|
16 | 16 | return ''; |
17 | 17 | } |
18 | 18 | |
19 | - if(!isset($arguments['heading'])){ |
|
19 | + if (!isset($arguments['heading'])) { |
|
20 | 20 | return ''; |
21 | 21 | } |
22 | 22 |
@@ -7,11 +7,11 @@ |
||
7 | 7 | |
8 | 8 | public static function parse_googlemap($arguments, $caption = null, $parser = null) { |
9 | 9 | // each of latitude and longitude are required at a bare minimum |
10 | - if(!isset($arguments['latitude'])){ |
|
10 | + if (!isset($arguments['latitude'])) { |
|
11 | 11 | return ''; |
12 | 12 | } |
13 | 13 | |
14 | - if(!isset($arguments['longitude'])){ |
|
14 | + if (!isset($arguments['longitude'])) { |
|
15 | 15 | return ''; |
16 | 16 | } |
17 | 17 |
@@ -27,7 +27,7 @@ |
||
27 | 27 | $gmap = MapUtil::get_map($this->owner, $this->MarkerTemplateValues); |
28 | 28 | $w = $width ? $width : MapUtil::$map_width; |
29 | 29 | $h = $height ? $height : MapUtil::$map_height; |
30 | - $gmap->setSize($w,$h); |
|
30 | + $gmap->setSize($w, $h); |
|
31 | 31 | return $gmap; |
32 | 32 | } |
33 | 33 |
@@ -15,19 +15,19 @@ discard block |
||
15 | 15 | // legacy handling for old parameters: $title, $heading, ... |
16 | 16 | // instead of new handling: $name, $title, $heading, ... |
17 | 17 | $args = func_get_args(); |
18 | - if(!isset($args[1]) || is_numeric($args[1])) { |
|
18 | + if (!isset($args[1]) || is_numeric($args[1])) { |
|
19 | 19 | $title = (isset($args[0])) ? $args[0] : null; |
20 | 20 | // Use "HeaderField(title)" as the default field name for a HeaderField; |
21 | 21 | // if it's just set to title then we risk causing accidental duplicate-field creation. |
22 | 22 | |
23 | 23 | // this means i18nized fields won't be easily accessible through fieldByName() |
24 | - $name = 'MapField' . $title; |
|
24 | + $name = 'MapField'.$title; |
|
25 | 25 | $headingLevel = (isset($args[1])) ? $args[1] : null; |
26 | 26 | $allowHTML = (isset($args[2])) ? $args[2] : null; |
27 | 27 | $form = (isset($args[3])) ? $args[3] : null; |
28 | 28 | } |
29 | 29 | |
30 | - if($headingLevel) $this->headingLevel = $headingLevel; |
|
30 | + if ($headingLevel) $this->headingLevel = $headingLevel; |
|
31 | 31 | $this->allowHTML = $allowHTML; |
32 | 32 | parent::__construct($name, $title, null, $allowHTML, $form); |
33 | 33 | } |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | Requirements::css('mappable/css/mapField.css'); |
54 | 54 | |
55 | - return '<div class="editableMap">' . $this->createTag( |
|
55 | + return '<div class="editableMap">'.$this->createTag( |
|
56 | 56 | "div", |
57 | 57 | $attributes |
58 | - ) . '</div>'; |
|
58 | + ).'</div>'; |
|
59 | 59 | } |
60 | 60 | } |
@@ -27,7 +27,9 @@ |
||
27 | 27 | $form = (isset($args[3])) ? $args[3] : null; |
28 | 28 | } |
29 | 29 | |
30 | - if($headingLevel) $this->headingLevel = $headingLevel; |
|
30 | + if($headingLevel) { |
|
31 | + $this->headingLevel = $headingLevel; |
|
32 | + } |
|
31 | 33 | $this->allowHTML = $allowHTML; |
32 | 34 | parent::__construct($name, $title, null, $allowHTML, $form); |
33 | 35 | } |
@@ -10,6 +10,10 @@ |
||
10 | 10 | protected $headingLevel = 2; |
11 | 11 | private $divId; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $name |
|
15 | + * @param string $title |
|
16 | + */ |
|
13 | 17 | function __construct($name, $title = null, $headingLevel = 2, $allowHTML = false, $form = null) { |
14 | 18 | $this->divId = $name; |
15 | 19 | // legacy handling for old parameters: $title, $heading, ... |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $gmap = MapUtil::get_map(new ArrayList(array($this->owner)), $this->MarkerTemplateValues); |
41 | 41 | $w = $width ? $width : MapUtil::$map_width; |
42 | 42 | $h = $height ? $height : MapUtil::$map_height; |
43 | - $gmap->setSize($w,$h); |
|
43 | + $gmap->setSize($w, $h); |
|
44 | 44 | $gmap->setZoom($zoom); |
45 | 45 | $gmap->setEnableAutomaticCenterZoom(false); |
46 | 46 | if ($this->owner->MapPinEdited) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $urlparts['markers'] = "icon:$pin|$lat,$lng"; |
90 | 90 | } |
91 | 91 | |
92 | - $src = htmlentities($apiurl . '?' . http_build_query($urlparts)); |
|
92 | + $src = htmlentities($apiurl.'?'.http_build_query($urlparts)); |
|
93 | 93 | return '<img src="'.$src.'" width="'.$w.'" height="'.$h.'" alt="'.$this->owner->Title.'" />'; |
94 | 94 | } |
95 | 95 |
@@ -19,6 +19,9 @@ |
||
19 | 19 | |
20 | 20 | private static $ctr = 0; |
21 | 21 | |
22 | + /** |
|
23 | + * @param string[] $buttonText |
|
24 | + */ |
|
22 | 25 | public function __construct($children = array(), $buttonText = null) { |
23 | 26 | self::$ctr++; |
24 | 27 |
@@ -59,38 +59,38 @@ |
||
59 | 59 | Requirements::javascript(MAPPABLE_MODULE_PATH.'/javascript/mapField.js'); |
60 | 60 | |
61 | 61 | $attributes = array( |
62 | - 'class' => 'editableMap', |
|
63 | - 'id' => 'GoogleMap', |
|
64 | - 'data-LatFieldName' => $this->latField, |
|
62 | + 'class' => 'editableMap', |
|
63 | + 'id' => 'GoogleMap', |
|
64 | + 'data-LatFieldName' => $this->latField, |
|
65 | 65 | 'data-LonFieldName' => $this->longField, |
66 | 66 | 'data-ZoomFieldName' => $this->zoomField, |
67 | 67 | 'data-UseMapBounds' => false |
68 | - ); |
|
68 | + ); |
|
69 | 69 | |
70 | - Requirements::css('mappable/css/mapField.css'); |
|
71 | - $guidePointsJSON = ''; |
|
72 | - if (!empty($this->guidePoints)) { |
|
73 | - $latlongps = array(); |
|
70 | + Requirements::css('mappable/css/mapField.css'); |
|
71 | + $guidePointsJSON = ''; |
|
72 | + if (!empty($this->guidePoints)) { |
|
73 | + $latlongps = array(); |
|
74 | 74 | |
75 | 75 | foreach ($this->guidePoints as $guidepoint) { |
76 | 76 | array_push($latlongps, $guidepoint); |
77 | 77 | } |
78 | 78 | |
79 | - $guidePointsJSON = json_encode($latlongps); |
|
80 | - // convert the mappable guidepoints to lat lon |
|
79 | + $guidePointsJSON = json_encode($latlongps); |
|
80 | + // convert the mappable guidepoints to lat lon |
|
81 | 81 | |
82 | - $attributes['data-GuidePoints'] = $guidePointsJSON; |
|
82 | + $attributes['data-GuidePoints'] = $guidePointsJSON; |
|
83 | 83 | |
84 | - // we only wish to change the bounds to those of all the points iff |
|
85 | - // the item currently has no location |
|
86 | - $attributes['data-useMapBounds'] = true; |
|
87 | - } |
|
88 | - $content = '<div class="editableMapWrapper">' . $this->createTag( |
|
89 | - "div", |
|
90 | - $attributes |
|
91 | - ) . '</div>'; |
|
84 | + // we only wish to change the bounds to those of all the points iff |
|
85 | + // the item currently has no location |
|
86 | + $attributes['data-useMapBounds'] = true; |
|
87 | + } |
|
88 | + $content = '<div class="editableMapWrapper">' . $this->createTag( |
|
89 | + "div", |
|
90 | + $attributes |
|
91 | + ) . '</div>'; |
|
92 | 92 | |
93 | - $this->FieldList()->push(new LiteralField('locationEditor', $content)); |
|
93 | + $this->FieldList()->push(new LiteralField('locationEditor', $content)); |
|
94 | 94 | |
95 | 95 | $content2 = <<<HTML |
96 | 96 | <div id="mapSearch"> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | class LatLongField extends FieldGroup { |
4 | 4 | |
5 | - private static $allowed_actions = array ( |
|
5 | + private static $allowed_actions = array( |
|
6 | 6 | 'geocode' |
7 | 7 | ); |
8 | 8 | |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | // the item currently has no location |
86 | 86 | $attributes['data-useMapBounds'] = true; |
87 | 87 | } |
88 | - $content = '<div class="editableMapWrapper">' . $this->createTag( |
|
88 | + $content = '<div class="editableMapWrapper">'.$this->createTag( |
|
89 | 89 | "div", |
90 | 90 | $attributes |
91 | - ) . '</div>'; |
|
91 | + ).'</div>'; |
|
92 | 92 | |
93 | 93 | $this->FieldList()->push(new LiteralField('locationEditor', $content)); |
94 | 94 |
@@ -79,6 +79,9 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | |
82 | + /** |
|
83 | + * @param boolean $new_map_already_rendered |
|
84 | + */ |
|
82 | 85 | public static function set_map_already_rendered($new_map_already_rendered) { |
83 | 86 | self::$map_already_rendered = $new_map_already_rendered; |
84 | 87 | } |
@@ -155,7 +158,7 @@ discard block |
||
155 | 158 | /** |
156 | 159 | * Get a new GoogleMapAPI object and load it with the default settings |
157 | 160 | * |
158 | - * @return GoogleMapAPI |
|
161 | + * @return MapAPI |
|
159 | 162 | */ |
160 | 163 | public static function instance() |
161 | 164 | { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | |
149 | - public function set_icon_size($iconWidth,$iconHeight) |
|
149 | + public function set_icon_size($iconWidth, $iconHeight) |
|
150 | 150 | { |
151 | 151 | self::$iconWidth = $iconWidth; |
152 | 152 | self::$iconHeight = $iconHeight; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * @return string |
209 | 209 | */ |
210 | 210 | public static function sanitize($content) { |
211 | - return addslashes(str_replace(array("\n","\r", "\t"), '' ,$content)); |
|
211 | + return addslashes(str_replace(array("\n", "\r", "\t"), '', $content)); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public static function get_map(SS_List $list, $infowindowtemplateparams) { |
225 | 225 | $gmap = self::instance(); |
226 | - if($list) { |
|
226 | + if ($list) { |
|
227 | 227 | foreach ($list as $mappable) { |
228 | 228 | if (self::ChooseToAddDataobject($mappable)) { |
229 | 229 | $gmap->addMarkerAsObject($mappable, $infowindowtemplateparams); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | private static function ChooseToAddDataobject(DataObject $do) { |
245 | 245 | $isMappable = $do->is_a('Mappable'); |
246 | 246 | |
247 | - foreach($do->getExtensionInstances() as $extension) { |
|
247 | + foreach ($do->getExtensionInstances() as $extension) { |
|
248 | 248 | $isMappable = $isMappable || $extension instanceof Mappable; |
249 | 249 | } |
250 | 250 | |
@@ -252,6 +252,6 @@ discard block |
||
252 | 252 | ? $do->MapPinEdited |
253 | 253 | : true; |
254 | 254 | |
255 | - return $isMappable && $filterMapPinEdited ; |
|
255 | + return $isMappable && $filterMapPinEdited; |
|
256 | 256 | } |
257 | 257 | } |