-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8f3d5b2
commit 74262df
Showing
3 changed files
with
63 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
<!-- indexer::stop --> | ||
<div id="map-canvas-<?= $this->id ?>" style="height:<?= $this->mapHeight['value'] ?><?= $this->mapHeight['unit'] ?>" | ||
class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif ?>> | ||
</div> | ||
<script> | ||
var anystores = { | ||
"module": <?php echo $this->id ?>, | ||
"token": "<?php echo $this->anystores_token ?>" | ||
}; | ||
if (document.readyState === 'loading') { | ||
document.addEventListener('DOMContentLoaded', () => loadMap(<?= $this->id ?>, '<?= $this->anystores_token ?>')); | ||
} else { | ||
loadMap(<?= $this->id ?>, '<?= $this->anystores_token ?>'); | ||
} | ||
</script> | ||
<section id="map-canvas" style="height:<?= $this->mapHeight['value'] ?><?= $this->mapHeight['unit'] ?>" class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif ?>></section> | ||
<!-- indexer::continue --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,62 @@ | ||
<section id="map-canvas-<?= $this->id ?>" | ||
style="height:<?php echo $this->mapHeight['value']; ?><?php echo $this->mapHeight['unit']; ?>" | ||
class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif ?>></section> | ||
<script> | ||
function initialize() | ||
{ | ||
var map = new google.maps.Map(document.getElementById('map-canvas'), { | ||
zoom: <?= $this->anystores_zoom ?>, | ||
center: new google.maps.LatLng(<?= $this->anystores_latitude ?>, <?= $this->anystores_longitude ?>), | ||
streetViewControl: <?= $this->anystores_streetview ? 'true' : 'false' ?>, | ||
mapTypeId: "<?= $this->anystores_maptype ?>" | ||
}); | ||
|
||
var stores = <?= $this->stores ?>; | ||
|
||
var markers = []; | ||
|
||
for (var i = 0; i < stores.length; i++) | ||
{ | ||
var store = stores[i]; | ||
|
||
var marker = new google.maps.Marker({ | ||
position: new google.maps.LatLng(store.latitude, store.longitude), | ||
title: store.name | ||
function initialize_map(id) { | ||
var map = new google.maps.Map(document.getElementById('map-canvas-' + id), { | ||
zoom: <?= $this->anystores_zoom ?>, | ||
center: new google.maps.LatLng(<?= $this->anystores_latitude ?>, <?= $this->anystores_longitude ?>), | ||
streetViewControl: <?= $this->anystores_streetview ? 'true' : 'false' ?>, | ||
mapTypeId: "<?= $this->anystores_maptype ?>" | ||
}); | ||
|
||
if ( store.marker ) | ||
{ | ||
marker.setIcon(store.marker); | ||
} | ||
|
||
var infowindow = new google.maps.InfoWindow(); | ||
var stores = <?= $this->stores ?>; | ||
|
||
google.maps.event.addListener(marker, 'click', (function(marker, i) { | ||
var markers = []; | ||
|
||
var html = "<b><a href=\"" + store.href + "\">" + store.name + "</a></b><br>"; | ||
for (var i = 0; i < stores.length; i++) { | ||
var store = stores[i]; | ||
|
||
(store.street !="") ? html += store.street + "<br>" : ""; | ||
(store.city !="") ? html += store.postal + " " + store.city + "<br>" : ""; | ||
(store.phone !="") ? html += store.phone + "<br>" : ""; | ||
(store.url !="") ? html += "<a href=\"" + store.url + "\">" + store.url + "</a><br>" : ""; | ||
(store.email !="") ? html += "<a href=\"mailto:" + store.email + "\">" + store.email + "</a><br>" : ""; | ||
(store.href !="") ? html += "<br><a href=\"" + store.href + "\">Mehr Informationen</a>" : ""; | ||
var marker = new google.maps.Marker({ | ||
position: new google.maps.LatLng(store.latitude, store.longitude), | ||
title: store.name | ||
}); | ||
|
||
return function() { | ||
infowindow.setContent(html); | ||
infowindow.open(map, marker); | ||
if (store.marker) { | ||
marker.setIcon(store.marker); | ||
} | ||
|
||
})(marker, i)); | ||
var infowindow = new google.maps.InfoWindow(); | ||
|
||
markers.push(marker); | ||
} | ||
google.maps.event.addListener(marker, 'click', (function (marker, i) { | ||
|
||
var html = "<b><a href=\"" + store.href + "\">" + store.name + "</a></b><br>"; | ||
|
||
(store.street != "") ? html += store.street + "<br>" : ""; | ||
(store.city != "") ? html += store.postal + " " + store.city + "<br>" : ""; | ||
(store.phone != "") ? html += store.phone + "<br>" : ""; | ||
(store.url != "") ? html += "<a href=\"" + store.url + "\">" + store.url + "</a><br>" : ""; | ||
(store.email != "") ? html += "<a href=\"mailto:" + store.email + "\">" + store.email + "</a><br>" : ""; | ||
(store.href != "") ? html += "<br><a href=\"" + store.href + "\">Mehr Informationen</a>" : ""; | ||
|
||
return function () { | ||
infowindow.setContent(html); | ||
infowindow.open(map, marker); | ||
} | ||
|
||
var markerCluster = new MarkerClusterer(map, markers, { | ||
imagePath: 'system/modules/anyStores/assets/js/markerclusterer/images/m' | ||
}); | ||
} | ||
})(marker, i)); | ||
|
||
google.maps.event.addDomListener(window, 'load', initialize); | ||
markers.push(marker); | ||
} | ||
|
||
var markerCluster = new MarkerClusterer(map, markers, { | ||
imagePath: 'system/modules/anyStores/assets/js/markerclusterer/images/m' | ||
}); | ||
} | ||
|
||
if (document.readyState === 'loading') { | ||
document.addEventListener('DOMContentLoaded', () => initialize_map(<?= $this->id ?>)); | ||
} else { | ||
initialize_map(<?= $this->id ?>); | ||
} | ||
</script> | ||
<section id="map-canvas" style="height:<?php echo $this->mapHeight['value']; ?><?php echo $this->mapHeight['unit']; ?>" class="<?= $this->class ?> block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif ?>></section> |