public function afficheCarteRecherche($params = array()) { $html = ""; $s = new objetSession(); $a = new archiAdresse(); $okCoord = false; if (isset($params['centrerSurVilleGeneral']) && $params['centrerSurVilleGeneral'] == true && $s->isInSession('archiIdVilleGeneral') && $s->getFromSession('archiIdVilleGeneral') != '') { // on recupere les coordonnées geogrphiques de la ville $reqCoordVille = "SELECT longitude,latitude FROM ville WHERE idVille = '" . $s->getFromSession('archiIdVilleGeneral') . "'"; $resCoordVille = $this->connexionBdd->requete($reqCoordVille); if (mysql_num_rows($resCoordVille) > 0) { $fetchCoordVille = mysql_fetch_assoc($resCoordVille); if ($fetchCoordVille['longitude'] != '' && $fetchCoordVille['latitude'] != '') { $villeLongitude = $fetchCoordVille['longitude']; $villeLatitude = $fetchCoordVille['latitude']; $okCoord = true; } } } if (!$okCoord) { $villeLongitude = "7.7400"; // strasbourg $villeLatitude = "48.585000"; } // recherche des villes $arrayRetourIdVilles = $this->getIdVillesNotEmpty(); $arrayCoords = array(); foreach ($arrayRetourIdVilles['coordonneesParIdVille'] as $idVille => $value) { if ($value['longitude'] != '' && $value['latitude'] != '') { $arrayNomVille = $a->getInfosVille($idVille, array("fieldList" => 'v.nom as nomVille')); $nomVille = $arrayNomVille['nomVille']; $arrayCoords[] = array('libelle' => 'NomVille', 'longitude' => $value['longitude'], 'latitude' => $value['latitude'], 'jsCodeOnClickMarker' => "location.href='" . html_entity_decode($this->creerUrl('', 'listByVille', array('recherche_ville' => $idVille))) . "';"); } } $zoom = 15; if ($s->isInSession('archiIdVilleGeneral') && $s->getFromSession('archiIdVilleGeneral') == '1' || !$s->isInSession('archiIdVilleGeneral')) { // pour strasbourg on met un zoom un peu plus eloigné $zoom = 13; } elseif (isset($params['zoom'])) { $zoom = $params['zoom']; } // si le zoom est assez proche , on affiche les points des adresses autour du centre courant de la carte /*if($zoom>13) { $arrayGoogleMapCoord = $a->getArrayGoogleMapConfigCoordonneesFromCenter(array('longitude'=>$villeLongitude,'latitude'=>$villeLatitude,'rayon'=>500,'urlIcon'=>$this->urlImages."pointGM.png","dimIconX"=>'9',"dimIconY"=>'9')); $listeCoords = $arrayGoogleMapCoord['arrayConfigCoordonnees']; $arrayCoords = array_merge($arrayCoords,$listeCoords); } */ $gm = new googleMap(array('googleMapKey' => $this->googleMapKey, 'zoom' => $zoom, 'height' => 500, 'width' => 700, 'centerLong' => $villeLongitude, 'centerLat' => $villeLatitude)); $this->addToJsHeader($gm->getJsFunctions()); //$html.="<h2>Cliquez sur un point de la carte pour afficher la liste des immeubles a proximité.</h2>"; $html .= "<h2>Recherche par carte</h2>"; $html .= $gm->getMap(array('listeCoordonnees' => $arrayCoords, "urlImageIcon" => $this->getUrlImage(null, "maison2.png"), "pathImageIcon" => $this->getCheminPhysique() . "images/maison2.png")); // load // affichage de la legende sous la carte $t = new tableau(); $html .= "<h3>Légende : </h3>"; $t->addValue("<img src='" . $this->urlImages . "maison2.png' border=0>", "align=center"); $t->addValue("Cliquez sur la maison bleue pour accéder à l'accueil de la ville."); $t->addValue("<img src='" . $this->urlImages . "legendeCarteGM.jpg' border=0>", "align=center"); $t->addValue("Cliquez sur la rue qui vous intéresse pour voir les bâtiments qui bordent la zone."); $html .= $t->createHtmlTableFromArray(2); // evenement quand on clique sur la carte ( mais pas sur une maison $html .= $gm->setOnClickEvent(array('jsCode' => "location.href='?archiAffichage=recherche&submit=Rechercher&longitude='+point.lng()+'&latitude='+point.lat();")); /*if($zoom>13) { $html.="<script >"; $html.="GEvent.addListener( map, 'dragend', function(){appelAjaxReturnJs('".$this->creerUrl('','majGoogleMapNewCenter',array('noRefresh'=>0,'noHTMLHeaderFooter'=>1,'noHeaderNoFooter'=>1,'latitudeHome'=>$villeLatitude,'longitudeHome'=>$villeLongitude))."&longitudeCenter='+map.getCenter().lng()+'&latitudeCenter='+map.getCenter().lat()+'&rayon=800','divListeAdressesAjax')} );"; $html.="</script>"; $html.="<div id='divListeAdressesAjax' style='background-color:lime;'></div>"; } */ return $html; }