38 lines
1.4 KiB
PHTML
Raw Normal View History

<div id="carte" style="width:500px;height:500px"></div>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
2011-09-13 07:03:11 +00:00
$(document).ready(function(){
var myOptions = {
zoom: 16,
center: new google.maps.LatLng(<?=$this->marqueurs[0][0]?>,
<?=$this->marqueurs[0][1]?>),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('carte'), myOptions);
2011-09-13 07:03:11 +00:00
<?php for ($i = 0; $i < count($this->marqueurs); ++$i) { ?>
var marker = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(<?=$this->marqueurs[$i][0]?>,
<?=$this->marqueurs[$i][1]?>),
2011-09-13 07:03:11 +00:00
title: "<?=$this->marqueurs[$i][4]?>",
icon: "<?=$this->marqueurs[$i][5]?>"
});
google.maps.event.addListener(marker, 'click', function() {
var infowindow = new google.maps.InfoWindow({
content: "<?=$this->marqueurs[$i][3]?>"
});
var pos = new google.maps.Marker({
position: new google.maps.LatLng(<?=$this->marqueurs[$i][0]?>,
<?=$this->marqueurs[$i][1]?>)
});
infowindow.open(map, pos);
});
<?php } ?>
<?php if (count($this->marqueurs) > 1) { ?>
2011-09-13 07:03:11 +00:00
map.fitBounds(new google.maps.LatLngBounds(
new google.maps.LatLng(<?=$this->min_x?>, <?=$this->min_y?>),
new google.maps.LatLng(<?=$this->max_x?>, <?=$this->max_y?>)));
<?php } ?>
2011-09-13 07:03:11 +00:00
});
</script>