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
| <script type="text/javascript">
function initialize() {
var center = new google.maps.LatLng(9.4419, 9.1419);
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 2,
center: center,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var markers = [];
// create the infowindow out of the for boucle
var infoWindow = new google.maps.InfoWindow;
<? for ($j=0; $j<count($resultArrayAd); $j++) { ?>
var i=<?=$j++?>;
var latLng = new google.maps.LatLng(parseFloat(<?=$resultArrayAd[$j]['Lat']?>),parseFloat(<?=$resultArrayAd[$j]['Lng']?>));
<?
$userList2 = new user_account($resultArrayAd[$j]["user_id"]);
$user_avatar2=$userList2->get_avatar();
$path2 =enleveaccents($user_avatar2->get_document_filename());
$user_nick=enleveaccents($resultArrayAd[$j]["user_name"]);
$user_id=$resultArrayAd[$j]['user_id'];
$usr_details = new user_details($user_id);
if (strlen($path2) > 0) {
$path_img= "/images/thumb_".$path2;
} else {
$path_img = "/img/avatar_profilo.jpg";
}
?>
var html = '<table><tr><td width="250">'+
'<a href="/user/<?=$user_id?>/<?=$user_nick?>.html" target="_top">'+
'<img align=left width=80 height=65 border=0 src="<?=$path_img?>" hspace=4 vspace=2>'+
'<font size=1 face=verdana><b><?=$user_nick?></b></font></a><br/>'+
'<span style="color:#555555;font-size:12px;line-hieght:13px;">'+
'<b>Indirizzo:</b> <?=enleveaccents($usr_details->user_address);?><br/>' +
'<b>Tel:</b> <?=enleveaccents($usr_details->user_phone);?><br/>'+
'</span>'+
'<div class="clearBoth"></div></td></tr></table>'+
'<div class="clearBoth"></div>';
var marker = new google.maps.Marker({
position: latLng,
map: map,
icon:"<?=$resultArrayAd[$j]['user_icon']?>",
title:"<?=$user_nick?>",
});
// call to the function....
bindInfoWindow(marker, map, infoWindow, html);
markers.push(marker);
<? } ?>
// create a function bindInfoWindow
function bindInfoWindow(marker, map, infoWindow, html) {
google.maps.event.addListener(marker, 'click', function() {
infoWindow.setContent(html);
infoWindow.open(map, marker);
});
}
var markerCluster = new MarkerClusterer(map, markers);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script> |
Partager