1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
function fc_MapMod_initialize_<?php echo $module->id;?>()
{
// Define your locations: HTML content for the info window, latitude, longitude
var locations = [ <?php echo implode(",", $tMapTips); ?> ];
var map = new google.maps.Map(document.getElementById('fc_module_map_<?php echo $module->id;?>'), {
maxZoom: [<?php echo $maxzoommarker; ?>],
center: new google.maps.LatLng(-37.92, 151.25),
mapTypeId: google.maps.MapTypeId.<?php echo $maptype;?>,
mapTypeControl: false,
streetViewControl: false,
panControl: false,
styles:[<?php echo $mapstyle; ?>],
zoomControlOptions: {
position: google.maps.ControlPosition.LEFT_BOTTOM
}
});
var infowindow = new google.maps.InfoWindow({
maxWidth: 160
});
var markers = new Array();
var customMarkerIcons = [];
var iconCounter = 0;
customMarkerIcons[0] = {
url: <?php echo $markerdisplay ?: 'null'; ?>
// Instead of guessing image placement we will leave this to defaults
//,scaledSize: <?php echo $scaledSize; ?>
//,origin: new google.maps.Point(0, 0)
//,anchor: new google.maps.Point(11, 40)
}
// Add the markers and infowindows to the map
for (var i = 0; i < locations.length; i++)
{
var marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
<?php echo ($params->get('animationmarker', 1) ? ',animation: google.maps.Animation.DROP' : '')."\n"; ?>
<?php echo ($markerdisplay ? ',icon: customMarkerIcons[iconCounter]' : '')."\n"; ?>
});
markers.push(marker);
// We only have a limited number of possible icon colors, so rewind icon index when icons finish
iconCounter = iconCounter >= customMarkerIcons.length ? 0 : iconCounter + 1;
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
google.maps.event.addDomListener(window, "resize", function() {
var center = map.getCenter();
google.maps.event.trigger(map, "resize");
map.setCenter(center);
});
}
<?php if ($clustermode)
{
echo "
var mcOptions = {
zoomOnClick: true,
gridSize:$gridsize,
maxZoom:$maxzoom,
styles: [{
url: '$imgcluster_url',
width: $imgcluster_w,
height: $imgcluster_h
}]
};
var marker = new MarkerClusterer(map, markers, mcOptions);
";
}
?>
fc_MapMod_autoCenter_<?php echo $module->id;?>(map, markers);
}
// Initialize the Map
fc_MapMod_initialize_<?php echo $module->id;?>();
</script> |
Partager