@@ -78,38 +78,38 @@ |
||
| 78 | 78 | |
| 79 | 79 | Requirements::javascript(MAPPABLE_MODULE_PATH.'/javascript/mapField.js'); |
| 80 | 80 | $attributes = array( |
| 81 | - 'class' => 'editableMap', |
|
| 82 | - 'id' => 'GoogleMap', |
|
| 83 | - 'data-LatFieldName' => $this->latField, |
|
| 81 | + 'class' => 'editableMap', |
|
| 82 | + 'id' => 'GoogleMap', |
|
| 83 | + 'data-LatFieldName' => $this->latField, |
|
| 84 | 84 | 'data-LonFieldName' => $this->longField, |
| 85 | 85 | 'data-ZoomFieldName' => $this->zoomField, |
| 86 | 86 | 'data-UseMapBounds' => false |
| 87 | - ); |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - Requirements::css('mappable/css/mapField.css'); |
|
| 90 | - $guidePointsJSON = ''; |
|
| 91 | - if (isset($this->guidePoints)) { |
|
| 92 | - $latlongps = array(); |
|
| 89 | + Requirements::css('mappable/css/mapField.css'); |
|
| 90 | + $guidePointsJSON = ''; |
|
| 91 | + if (isset($this->guidePoints)) { |
|
| 92 | + $latlongps = array(); |
|
| 93 | 93 | |
| 94 | 94 | foreach ($this->guidePoints as $guidepoint) { |
| 95 | 95 | array_push($latlongps, $guidepoint); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - $guidePointsJSON = json_encode($latlongps); |
|
| 99 | - // convert the mappable guidepoints to lat lon |
|
| 98 | + $guidePointsJSON = json_encode($latlongps); |
|
| 99 | + // convert the mappable guidepoints to lat lon |
|
| 100 | 100 | |
| 101 | - $attributes['data-GuidePoints'] = $guidePointsJSON; |
|
| 101 | + $attributes['data-GuidePoints'] = $guidePointsJSON; |
|
| 102 | 102 | |
| 103 | - // we only wish to change the bounds to those of all the points iff |
|
| 104 | - // the item currently has no location |
|
| 105 | - $attributes['data-useMapBounds'] = true; |
|
| 106 | - } |
|
| 107 | - $content = '<div class="editableMapWrapper">' . $this->createTag( |
|
| 108 | - "div", |
|
| 109 | - $attributes |
|
| 110 | - ) . '</div>'; |
|
| 103 | + // we only wish to change the bounds to those of all the points iff |
|
| 104 | + // the item currently has no location |
|
| 105 | + $attributes['data-useMapBounds'] = true; |
|
| 106 | + } |
|
| 107 | + $content = '<div class="editableMapWrapper">' . $this->createTag( |
|
| 108 | + "div", |
|
| 109 | + $attributes |
|
| 110 | + ) . '</div>'; |
|
| 111 | 111 | |
| 112 | - $this->FieldList()->push(new LiteralField('locationEditor', $content)); |
|
| 112 | + $this->FieldList()->push(new LiteralField('locationEditor', $content)); |
|
| 113 | 113 | |
| 114 | 114 | $content2 = '<div id="mapSearch"> |
| 115 | 115 | <input name="location_search" id="location_search" size=80/> |
@@ -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; |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public static $map_height = '400px'; |
| 25 | 25 | |
| 26 | - /** @var int Icon width of the gmarker **/ |
|
| 27 | - public static $iconWidth = 24; |
|
| 26 | + /** @var int Icon width of the gmarker **/ |
|
| 27 | + public static $iconWidth = 24; |
|
| 28 | 28 | |
| 29 | - /** @var int Icon height of the gmarker **/ |
|
| 30 | - public static $iconHeight = 24; |
|
| 29 | + /** @var int Icon height of the gmarker **/ |
|
| 30 | + public static $iconHeight = 24; |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * @var int Prefix for the div ID of the map |
@@ -99,57 +99,57 @@ discard block |
||
| 99 | 99 | self::$map_height = $height; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Set the type of the gmap |
|
| 104 | - * |
|
| 105 | - * @param string $mapType (can be 'google.maps.MapTypeId.ROADMAP', 'G_SATELLITE_MAP', |
|
| 106 | - * 'G_HYBRID_MAP', 'G_PHYSICAL_MAP') |
|
| 107 | - * |
|
| 108 | - * @return void |
|
| 109 | - */ |
|
| 110 | - public function set_map_type($mapType) |
|
| 111 | - { |
|
| 112 | - self::$map_type = $mapType; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * Set the with of the gmap infowindow (on marker clik) |
|
| 117 | - * |
|
| 118 | - * @param int $info_window_width GoogleMap info window width |
|
| 119 | - * |
|
| 120 | - * @return void |
|
| 121 | - */ |
|
| 122 | - public function set_info_window_width($info_window_width) |
|
| 123 | - { |
|
| 124 | - self::$info_window_width = $info_window_width; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * Set the center of the gmap (an address) |
|
| 129 | - * |
|
| 130 | - * @param string $center GoogleMap center (an address) |
|
| 131 | - * |
|
| 132 | - * @return void |
|
| 133 | - */ |
|
| 134 | - public function set_center($center) |
|
| 135 | - { |
|
| 136 | - self::$center = $center; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Set the size of the icon markers |
|
| 141 | - * |
|
| 142 | - * @param int $iconWidth GoogleMap marker icon width |
|
| 143 | - * @param int $iconHeight GoogleMap marker icon height |
|
| 144 | - * |
|
| 145 | - * @return void |
|
| 146 | - */ |
|
| 147 | - |
|
| 148 | - public function set_icon_size($iconWidth,$iconHeight) |
|
| 149 | - { |
|
| 150 | - self::$iconWidth = $iconWidth; |
|
| 151 | - self::$iconHeight = $iconHeight; |
|
| 152 | - } |
|
| 102 | + /** |
|
| 103 | + * Set the type of the gmap |
|
| 104 | + * |
|
| 105 | + * @param string $mapType (can be 'google.maps.MapTypeId.ROADMAP', 'G_SATELLITE_MAP', |
|
| 106 | + * 'G_HYBRID_MAP', 'G_PHYSICAL_MAP') |
|
| 107 | + * |
|
| 108 | + * @return void |
|
| 109 | + */ |
|
| 110 | + public function set_map_type($mapType) |
|
| 111 | + { |
|
| 112 | + self::$map_type = $mapType; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * Set the with of the gmap infowindow (on marker clik) |
|
| 117 | + * |
|
| 118 | + * @param int $info_window_width GoogleMap info window width |
|
| 119 | + * |
|
| 120 | + * @return void |
|
| 121 | + */ |
|
| 122 | + public function set_info_window_width($info_window_width) |
|
| 123 | + { |
|
| 124 | + self::$info_window_width = $info_window_width; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * Set the center of the gmap (an address) |
|
| 129 | + * |
|
| 130 | + * @param string $center GoogleMap center (an address) |
|
| 131 | + * |
|
| 132 | + * @return void |
|
| 133 | + */ |
|
| 134 | + public function set_center($center) |
|
| 135 | + { |
|
| 136 | + self::$center = $center; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Set the size of the icon markers |
|
| 141 | + * |
|
| 142 | + * @param int $iconWidth GoogleMap marker icon width |
|
| 143 | + * @param int $iconHeight GoogleMap marker icon height |
|
| 144 | + * |
|
| 145 | + * @return void |
|
| 146 | + */ |
|
| 147 | + |
|
| 148 | + public function set_icon_size($iconWidth,$iconHeight) |
|
| 149 | + { |
|
| 150 | + self::$iconWidth = $iconWidth; |
|
| 151 | + self::$iconHeight = $iconHeight; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Get a new GoogleMapAPI object and load it with the default settings |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | $gmap->setDisplayDirectionFields(self::$direction_fields); |
| 192 | 192 | $gmap->setSize(self::$map_width, self::$map_height); |
| 193 | 193 | $gmap->setDefaultHideMarker(self::$hide_marker); |
| 194 | - $gmap->setMapType(self::$map_type); |
|
| 195 | - $gmap->setCenter(self::$center); |
|
| 196 | - $gmap->setIconSize(self::$iconWidth, self::$iconHeight); |
|
| 197 | - $gmap->setIncludeDownloadJavascript(self::$map_already_rendered); |
|
| 198 | - $gmap->setAllowFullScreen(self::$allow_full_screen); |
|
| 194 | + $gmap->setMapType(self::$map_type); |
|
| 195 | + $gmap->setCenter(self::$center); |
|
| 196 | + $gmap->setIconSize(self::$iconWidth, self::$iconHeight); |
|
| 197 | + $gmap->setIncludeDownloadJavascript(self::$map_already_rendered); |
|
| 198 | + $gmap->setAllowFullScreen(self::$allow_full_screen); |
|
| 199 | 199 | return $gmap; |
| 200 | 200 | } |
| 201 | 201 | |