@@ -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; |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Map field to point for pois langitude and longitude positioning |
|
4 | - */ |
|
3 | + * Map field to point for pois langitude and longitude positioning |
|
4 | + */ |
|
5 | 5 | class MapField extends DatalessField { |
6 | 6 | |
7 | 7 | /** |
@@ -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,59 +99,59 @@ discard block |
||
99 | 99 | self::$map_height = $height; |
100 | 100 | } |
101 | 101 | |
102 | - /** |
|
103 | - * FIXME - NOT USED? |
|
104 | - * Set the type of the gmap |
|
105 | - * |
|
106 | - * @param string $mapType (can be 'google.maps.MapTypeId.ROADMAP', 'G_SATELLITE_MAP', |
|
107 | - * 'G_HYBRID_MAP', 'G_PHYSICAL_MAP') |
|
108 | - * |
|
109 | - * @return void |
|
110 | - */ |
|
111 | - public static function set_map_type($mapType) { |
|
112 | - self::$map_type = $mapType; |
|
113 | - } |
|
114 | - |
|
115 | - /** |
|
116 | - * FIXME - NOT USED? |
|
117 | - * Set the with of the gmap infowindow (on marker clik) |
|
118 | - * |
|
119 | - * @param int $info_window_width GoogleMap info window width |
|
120 | - * |
|
121 | - * @return void |
|
122 | - */ |
|
123 | - public static function set_info_window_width($info_window_width) |
|
124 | - { |
|
125 | - self::$info_window_width = $info_window_width; |
|
126 | - } |
|
127 | - |
|
128 | - /** |
|
129 | - * FIXME - NOT USED? |
|
130 | - * Set the center of the gmap (an address) |
|
131 | - * |
|
132 | - * @param string $center GoogleMap center (an address) |
|
133 | - * |
|
134 | - * @return void |
|
135 | - */ |
|
136 | - public static function set_center($center) |
|
137 | - { |
|
138 | - self::$center = $center; |
|
139 | - } |
|
140 | - |
|
141 | - /** |
|
142 | - * Set the size of the icon markers |
|
143 | - * |
|
144 | - * @param int $iconWidth GoogleMap marker icon width |
|
145 | - * @param int $iconHeight GoogleMap marker icon height |
|
146 | - * |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - |
|
150 | - public function set_icon_size($iconWidth,$iconHeight) |
|
151 | - { |
|
152 | - self::$iconWidth = $iconWidth; |
|
153 | - self::$iconHeight = $iconHeight; |
|
154 | - } |
|
102 | + /** |
|
103 | + * FIXME - NOT USED? |
|
104 | + * Set the type of the gmap |
|
105 | + * |
|
106 | + * @param string $mapType (can be 'google.maps.MapTypeId.ROADMAP', 'G_SATELLITE_MAP', |
|
107 | + * 'G_HYBRID_MAP', 'G_PHYSICAL_MAP') |
|
108 | + * |
|
109 | + * @return void |
|
110 | + */ |
|
111 | + public static function set_map_type($mapType) { |
|
112 | + self::$map_type = $mapType; |
|
113 | + } |
|
114 | + |
|
115 | + /** |
|
116 | + * FIXME - NOT USED? |
|
117 | + * Set the with of the gmap infowindow (on marker clik) |
|
118 | + * |
|
119 | + * @param int $info_window_width GoogleMap info window width |
|
120 | + * |
|
121 | + * @return void |
|
122 | + */ |
|
123 | + public static function set_info_window_width($info_window_width) |
|
124 | + { |
|
125 | + self::$info_window_width = $info_window_width; |
|
126 | + } |
|
127 | + |
|
128 | + /** |
|
129 | + * FIXME - NOT USED? |
|
130 | + * Set the center of the gmap (an address) |
|
131 | + * |
|
132 | + * @param string $center GoogleMap center (an address) |
|
133 | + * |
|
134 | + * @return void |
|
135 | + */ |
|
136 | + public static function set_center($center) |
|
137 | + { |
|
138 | + self::$center = $center; |
|
139 | + } |
|
140 | + |
|
141 | + /** |
|
142 | + * Set the size of the icon markers |
|
143 | + * |
|
144 | + * @param int $iconWidth GoogleMap marker icon width |
|
145 | + * @param int $iconHeight GoogleMap marker icon height |
|
146 | + * |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + |
|
150 | + public function set_icon_size($iconWidth,$iconHeight) |
|
151 | + { |
|
152 | + self::$iconWidth = $iconWidth; |
|
153 | + self::$iconHeight = $iconHeight; |
|
154 | + } |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Get a new GoogleMapAPI object and load it with the default settings |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | $gmap->setDisplayDirectionFields(self::$direction_fields); |
194 | 194 | $gmap->setSize(self::$map_width, self::$map_height); |
195 | 195 | $gmap->setDefaultHideMarker(self::$hide_marker); |
196 | - $gmap->setMapType(self::$map_type); |
|
197 | - $gmap->setCenter(self::$center); |
|
198 | - $gmap->setIconSize(self::$iconWidth, self::$iconHeight); |
|
199 | - $gmap->setIncludeDownloadJavascript(self::$map_already_rendered); |
|
200 | - $gmap->setAllowFullScreen(self::$allow_full_screen); |
|
196 | + $gmap->setMapType(self::$map_type); |
|
197 | + $gmap->setCenter(self::$center); |
|
198 | + $gmap->setIconSize(self::$iconWidth, self::$iconHeight); |
|
199 | + $gmap->setIncludeDownloadJavascript(self::$map_already_rendered); |
|
200 | + $gmap->setAllowFullScreen(self::$allow_full_screen); |
|
201 | 201 | return $gmap; |
202 | 202 | } |
203 | 203 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public function test_set_map_size() { |
27 | - MapUtil::set_map_size('890px','24em'); |
|
27 | + MapUtil::set_map_size('890px','24em'); |
|
28 | 28 | $html = $this->htmlForMap(); |
29 | 29 | $this->assertContains(' style="width:890px; height: 24em;"', $html); |
30 | 30 | } |
@@ -79,25 +79,25 @@ discard block |
||
79 | 79 | |
80 | 80 | // These appear to test code that's not used |
81 | 81 | public function test_set_center() { |
82 | - MapUtil::set_center('Bangkok, Thailand'); |
|
82 | + MapUtil::set_center('Bangkok, Thailand'); |
|
83 | 83 | $html = $this->htmlForMap(); |
84 | 84 | echo $html; |
85 | 85 | $this->fail('No evidence of map type changing'); |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - public function test_set_map_type() { |
|
89 | - MapUtil::set_map_type('google.maps.MapTypeId.G_PHYSICAL_MAP'); |
|
88 | + public function test_set_map_type() { |
|
89 | + MapUtil::set_map_type('google.maps.MapTypeId.G_PHYSICAL_MAP'); |
|
90 | 90 | $html = $this->htmlForMap(); |
91 | 91 | echo $html; |
92 | 92 | $this->fail('No evidence of map type changing'); |
93 | - } |
|
93 | + } |
|
94 | 94 | |
95 | - public function test_set_info_window_width() { |
|
96 | - $this->fail('No evidence of set info width being used'); |
|
97 | - } |
|
95 | + public function test_set_info_window_width() { |
|
96 | + $this->fail('No evidence of set info width being used'); |
|
97 | + } |
|
98 | 98 | |
99 | - public function test_set_icon_size() { |
|
99 | + public function test_set_icon_size() { |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | 103 | } |