Skip to content

Commit

Permalink
Added traffic layer option to google map element
Browse files Browse the repository at this point in the history
  • Loading branch information
cheesegrits committed Oct 10, 2015
1 parent 61c6383 commit a17bdfe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions plugins/fabrik_element/googlemap/forms/fields.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,17 @@
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field name="fb_gm_trafficlayer"
type="radio"
default="0"
class="btn-group"
description="PLG_ELEMENT_GOOGLE_MAP_TRAFFIC_LAYER_DESC"
label="PLG_ELEMENT_GOOGLE_MAP_TRAFFIC_LAYER_LABEL">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>


<field name="fb_gm_overviewcontrol"
type="radio"
Expand Down
7 changes: 7 additions & 0 deletions plugins/fabrik_element/googlemap/googlemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var FbGoogleMap = new Class({
'reverse_geocode': false,
'use_radius': false,
'geocode_on_load': false,
'traffic': true,
'styles': []
},

Expand Down Expand Up @@ -187,6 +188,12 @@ var FbGoogleMap = new Class({
};
this.map = new google.maps.Map(document.id(this.element).getElement('.map'), mapOpts);
this.map.setOptions({'styles': this.options.styles});

if (this.options.traffic) {
var trafficLayer = new google.maps.TrafficLayer();
trafficLayer.setMap(this.map);
}

var point = new google.maps.LatLng(this.options.lat, this.options.lon);
var opts = {
map: this.map,
Expand Down
1 change: 1 addition & 0 deletions plugins/fabrik_element/googlemap/googlemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ public function elementJavascript($repeatCounter)
$opts->scalecontrol = (bool) $params->get('fb_gm_scalecontrol');
$opts->maptypecontrol = (bool) $params->get('fb_gm_maptypecontrol');
$opts->overviewcontrol = (bool) $params->get('fb_gm_overviewcontrol');
$opts->traffic = (bool) $params->get('fb_gm_trafficlayer', '0');
$opts->drag = (bool) $formModel->isEditable();
$opts->staticmap = $this->_useStaticMap() ? true : false;
$opts->maptype = $params->get('fb_gm_maptype');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ PLG_ELEMENT_GOOGLE_MAP_STYLE_LABEL="Style"
PLG_ELEMENT_GOOGLE_MAP_STYLE_STYLER_KEY_LABEL="Key"
PLG_ELEMENT_GOOGLE_MAP_STYLE_STYLER_VALUE_LABEL="Value"
PLG_ELEMENT_GOOGLE_MAP_TERRAIN="Terrain"
PLG_ELEMENT_GOOGLE_MAP_TRAFFIC_LAYER_LABEL="Traffic Layer"
PLG_ELEMENT_GOOGLE_MAP_TRAFFIC_LAYER_DESC="Show the traffic layer"
PLG_ELEMENT_GOOGLE_MAP_TYPE_LABEL="Map type"
PLG_ELEMENT_GOOGLE_MAP_TYPE_DESC="The type of Google Map to be displayed e.g. Normal, Satelite etc."
PLG_ELEMENT_GOOGLE_MAP_TYPE_CONTROL_DESC="buttons that let the user toggle between map types (such as Map and Satellite)"
Expand Down

0 comments on commit a17bdfe

Please sign in to comment.