* @category General * @package ArchiWiki * @author Pierre Rudloff <*****@*****.**> * @license GNU GPL v3 https://www.gnu.org/licenses/gpl.html * @link http://archi-wiki.org/ * * */ $t = new Template('modules/header/templates/'); $t->set_filenames(array('header' => 'header.tpl')); $authentification = new archiAuthentification(); $recherche = new archiRecherche(); $config = new ArchiConfig(); $adresse = new archiAdresse(); $evenement = new archiEvenement(); $image = new archiImage(); $ajax = new ajaxObject(); $calque = new calqueObject(); $string = new stringObject(); $utilisateur = new archiUtilisateur(); $session = new objetSession(); $i = new imageObject(); if (!isset($jsHeader)) { // variables récupérée de chaque fonction des classes du site permettant de mettre du javascript recupéré , dans le header , plutot qu'en plein milieu de la page ou dans le bas de page s'il faut qu'il soit executé a la fin $jsHeader = ""; } if (!isset($jsFooter)) { $jsFooter = ""; } $titreSite = $config->titreSite; $titre = _("Archi-Wiki. Tous architectes ! Partageons la ville, ses bâtiments, ses lieux."); $description = $config->descSite;
public function getGoogleMapIframe($params = array()) { $html = '<link href="css/default.css" rel="stylesheet" type="text/css" /> '; if (isset($this->variablesGet['longitude']) && $this->variablesGet['longitude'] != '' && isset($this->variablesGet['latitude']) && $this->variablesGet['latitude'] != '') { $ajax = new ajaxObject(); $html .= $ajax->getAjaxFunctions(); $longitude = $this->variablesGet['longitude']; $latitude = $this->variablesGet['latitude']; $listeCoords = array(); // si archiIdAdresse est précisé , on remplace les coordonnées par celle de l'adresse ( car celle envoyée sont celle de la premiere du groupe d'adresse) $isCoordonneesAdresseCouranteValide = true; $isCoordonneesGroupeAdresseOK = false; if (isset($this->variablesGet['archiIdAdresse']) && $this->variablesGet['archiIdAdresse'] != '' && isset($this->variablesGet['archiIdEvenementGroupeAdresse']) && $this->variablesGet['archiIdEvenementGroupeAdresse'] != '') { // s'il existe des coordonnées pour le groupe d'adresse dans la table _adresseEvenement, on prend celles ci $reqCoordonneesGroupeAdresse = "SELECT longitudeGroupeAdresse,latitudeGroupeAdresse FROM _adresseEvenement WHERE idAdresse='" . $this->variablesGet['archiIdAdresse'] . "' AND idEvenement='" . $this->variablesGet['archiIdEvenementGroupeAdresse'] . "' AND longitudeGroupeAdresse<>'0' AND latitudeGroupeAdresse<>'0'"; $resCoordonneesGroupeAdresse = $this->connexionBdd->requete($reqCoordonneesGroupeAdresse); if (mysql_num_rows($resCoordonneesGroupeAdresse) > 0) { $fetchCoordonneesGroupeAdresse = mysql_fetch_assoc($resCoordonneesGroupeAdresse); $longitude = $fetchCoordonneesGroupeAdresse['longitudeGroupeAdresse']; $latitude = $fetchCoordonneesGroupeAdresse['latitudeGroupeAdresse']; $isCoordonneesGroupeAdresseOK = true; } } if (isset($this->variablesGet['archiIdAdresse']) && $this->variablesGet['archiIdAdresse'] != '' && $this->variablesGet['archiIdAdresse'] != '0' && !$isCoordonneesGroupeAdresseOK) { $reqCoordonnees = "\n SELECT ha1.longitude as longitude, ha1.latitude as latitude\n FROM historiqueAdresse ha2, historiqueAdresse ha1\n WHERE ha2.idAdresse = ha1.idAdresse\n AND ha1.idAdresse = '" . $this->variablesGet['archiIdAdresse'] . "'\n GROUP BY ha1.idAdresse, ha1.idHistoriqueAdresse\n HAVING ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)\n "; $resCoordonnees = $this->connexionBdd->requete($reqCoordonnees); if (mysql_num_rows($resCoordonnees) == 1) { $fetchCoordonnees = mysql_fetch_assoc($resCoordonnees); if ($fetchCoordonnees['longitude'] != '' && $fetchCoordonnees['latitude'] != '' && $fetchCoordonnees['longitude'] != '0' && $fetchCoordonnees['latitude'] != '0') { $longitude = $fetchCoordonnees['longitude']; $latitude = $fetchCoordonnees['latitude']; } else { $isCoordonneesAdresseCouranteValide = false; } } } $affichageCoordonneesVille = false; if ($longitude < 0 || $latitude < 0 || $longitude == 0 || $latitude == 0 || !$isCoordonneesAdresseCouranteValide) { // on detection une longitude ou latitude negative : il doit y avoir eu une erreur de detection des parametres // on va centrer la carte sur la ville if (isset($this->variablesGet['archiIdAdresse']) && $this->variablesGet['archiIdAdresse'] != '' && $this->variablesGet['archiIdAdresse'] != '0') { // recuperation de l'idville de l'adresse courante $idVille = $this->getIdVilleFrom($this->variablesGet['archiIdAdresse'], 'idAdresse'); // coordonnees de la ville $reqCoordonneesVille = "SELECT longitude,latitude,nom FROM ville WHERE idVille = '" . $idVille . "'"; $resCoordonneesVille = $this->connexionBdd->requete($reqCoordonneesVille); $fetchCoordonneesVille = mysql_fetch_assoc($resCoordonneesVille); $longitude = $fetchCoordonneesVille['longitude']; $latitude = $fetchCoordonneesVille['latitude']; $affichageCoordonneesVille = true; } } // rayon en metres if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage'] == 'popupDetailAdresse') { // dans le cas de l'affichage de la popup sur le detail de l'adresse on prend un rayon plus grand, donc plus d'adresses affichées $rayon = 200; } else { $rayon = 200; } $arrayGoogleMapCoord = $this->getArrayGoogleMapConfigCoordonneesFromCenter(array('longitude' => $longitude, 'latitude' => $latitude, 'rayon' => $rayon)); $listeCoords = $arrayGoogleMapCoord['arrayConfigCoordonnees']; // verification des droits $isAuthorizedToDrag = false; $widthGoogleMapModePopup = 650; if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage'] == 'popupDetailAdresse') { if (isset($this->variablesGet['archiIdAdresse']) && $this->variablesGet['archiIdAdresse'] != '' && isset($this->variablesGet['archiIdEvenementGroupeAdresse']) && $this->variablesGet['archiIdEvenementGroupeAdresse'] != '') { $idAdresseCentree = $this->variablesGet['archiIdAdresse']; $idEvenementGroupeAdresseCentre = $this->variablesGet['archiIdEvenementGroupeAdresse']; $utilisateur = new archiUtilisateur(); $authentification = new archiAuthentification(); // verification des droits if ($utilisateur->isAuthorized('googlemap_change_coordonnees', $authentification->getIdUtilisateur())) { if ($utilisateur->getIdProfil($authentification->getIdUtilisateur()) == 4 || $utilisateur->getIdProfil($authentification->getIdUtilisateur()) == 3 && $utilisateur->isModerateurFromVille($authentification->getIdUtilisateur(), $idAdresseCentree, 'idAdresse')) { $isAuthorizedToDrag = true; $widthGoogleMapModePopup = 650; } } } } if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage'] == 'popupDetailAdresse') { // affichage pour la popup sur le detail d'une adresse if ($affichageCoordonneesVille) { $gm = new googleMap(array('googleMapKey' => $this->googleMapKey, 'width' => $widthGoogleMapModePopup, 'height' => 500, 'zoom' => 11, 'noDisplayZoomSelectionSquare' => true, 'noDisplayZoomSlider' => false, 'zoomType' => 'mini', 'noDisplayEchelle' => true, 'noDisplayMapTypeButtons' => false, 'centerLong' => $longitude, 'centerLat' => $latitude, 'mapType' => 'G_SATELLITE_MAP')); } else { $gm = new googleMap(array('googleMapKey' => $this->googleMapKey, 'width' => $widthGoogleMapModePopup, 'height' => 500, 'zoom' => 17, 'noDisplayZoomSelectionSquare' => true, 'noDisplayZoomSlider' => false, 'zoomType' => 'mini', 'noDisplayEchelle' => true, 'noDisplayMapTypeButtons' => false, 'centerLong' => $longitude, 'centerLat' => $latitude, 'mapType' => 'G_SATELLITE_MAP')); } } else { if ($affichageCoordonneesVille) { $gm = new googleMap(array('googleMapKey' => $this->googleMapKey, 'width' => 275, 'height' => 275, 'zoom' => 10, 'noDisplayZoomSelectionSquare' => true, 'noDisplayZoomSlider' => false, 'zoomType' => 'mini', 'noDisplayEchelle' => true, 'noDisplayMapTypeButtons' => true, 'centerLong' => $longitude, 'centerLat' => $latitude, 'mapType' => 'G_SATELLITE_MAP')); } else { // affichage par defaut , s'affichage en haut de la page detail d'une adresse , a gauche de l'encars $gm = new googleMap(array('googleMapKey' => $this->googleMapKey, 'width' => 275, 'height' => 275, 'zoom' => 16, 'noDisplayZoomSelectionSquare' => true, 'noDisplayZoomSlider' => false, 'zoomType' => 'mini', 'noDisplayEchelle' => true, 'noDisplayMapTypeButtons' => true, 'centerLong' => $longitude, 'centerLat' => $latitude, 'mapType' => 'G_SATELLITE_MAP')); //,'divStyle'=>'margin-top:-17px;' } } $html .= $gm->getJsFunctions(); //$html.="<script >".$gm->setFunctionAddPointsCallableFromChild()."</script>"; $html .= $gm->getMap(array('listeCoordonnees' => $listeCoords, 'urlImageIcon' => $this->getUrlImage() . "pointGM.png", 'pathImageIcon' => $this->getCheminPhysique() . "images/pointGM.png")); // on ajoute le markeur central a la main $html .= "<script >\n var iconHome = new GIcon();\n iconHome.image = \"" . $this->getUrlImage() . "placeMarker.png\";\n //iconHome.shadow = \"https://labs.google.com/ridefinder/images/mm_20_shadow.png\";\n iconHome.iconSize = new GSize(19, 32);\n iconHome.shadowSize = new GSize(22, 20);\n iconHome.iconAnchor = new GPoint(5, 26);\n iconHome.infoWindowAnchor = new GPoint(5, 1);\n\n //var iconMarkerHome = new GIcon(iconHome);\n "; if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage'] == 'popupDetailAdresse' && $isAuthorizedToDrag) { $html .= "markerHome = new GMarker(new GLatLng(" . $latitude . "," . $longitude . "),{icon:iconHome, draggable: true});"; } else { $html .= "markerHome = new GMarker(new GLatLng(" . $latitude . "," . $longitude . "),{icon:iconHome});"; } $html .= "map.addOverlay(markerHome);"; if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage'] == 'popupDetailAdresse' && $isAuthorizedToDrag) { $html .= "markerHome.enableDragging();"; } if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage'] == 'popupDetailAdresse' && $isAuthorizedToDrag) { $html .= "GEvent.addListener(markerHome,'drag',function(){parent.window.document.getElementById('latitudeUser').value=markerHome.getPoint().lat();parent.window.document.getElementById('longitudeUser').value=markerHome.getPoint().lng();parent.window.document.getElementById('validationCoordonnees').style.display='';});\n "; $html .= "GEvent.addListener(\n map,\n 'dragend',\n function(){appelAjaxReturnJs('" . html_entity_decode($this->creerUrl('', 'majGoogleMapNewCenter', array('noRefresh' => 1, 'noHTMLHeaderFooter' => 1, 'noHeaderNoFooter' => 1, 'latitudeHome' => $latitude, 'longitudeHome' => $longitude))) . "&longitudeCenter='+map.getCenter().lng()+'&latitudeCenter='+map.getCenter().lat(),'divListeAdressesAjax')}\n );"; } else { $html .= "GEvent.addListener(\n map,\n 'dragend',\n function(){appelAjaxReturnJs('" . html_entity_decode($this->creerUrl('', 'majGoogleMapNewCenter', array('noHTMLHeaderFooter' => 1, 'noHeaderNoFooter' => 1, 'latitudeHome' => $latitude, 'longitudeHome' => $longitude))) . "&longitudeCenter='+map.getCenter().lng()+'&latitudeCenter='+map.getCenter().lat(),'divListeAdressesAjax')}\n );"; //$html.="GEvent.addListener(map,'dragend',function(){document.getElementById('iFrameMajCenter').src='".$this->creerUrl('','majGoogleMapNewCenter',array('noHeaderNoFooter'=>1,'latitudeHome'=>$latitude,'longitudeHome'=>$longitude))."&longitudeCenter='+map.getCenter().lng()+'&latitudeCenter='+map.getCenter().lat();});"; } //$html.=$gm->setFunctionAddPointsCallableFromChild(array()); $html .= "</script>"; //$html.="<div id='jsMiseAJourCenter' ><iframe id='iFrameMajCenter' src=''></iframe></div>";//style='position:absolute;left:0px;top:0px;' } return $html; }
/** * Displaying user interests * * @return string */ public function displayMyInterest() { $auth = new archiAuthentification(); if ($auth->estConnecte()) { $html = ""; $formulaire = new formGenerator(); $utils = new archiUtils(); $ajax = new ajaxObject(); $html .= $ajax->getAjaxFunctions(); $t = new Template($this->getCheminPhysique() . $this->cheminTemplates . "interest/"); $t->set_filenames(array('myinterests' => 'myinterests.tpl')); $a = new archiAdresse(); //Generate address form $formParam = array('afficheNombreResultat' => 1, 'modeAffichage_rue' => 1, 'modeAffichage_sousQuartier' => 1, 'modeAffichage_quartier' => 1, 'modeAffichage_ville' => 1, 'modeAffichage_pays=' > 1); $formAddressAddInterest = $a->afficheChoixAdresse(array('afficheNombreResultat' => 1, 'affichageInteret' => 1)); $paramsFields = array(); $paramsFields[] = array('table' => 'pays', 'value' => 'idPays', 'title' => 'nom'); $paramsFields[] = array('table' => 'ville', 'value' => 'idVille', 'title' => 'nom'); $paramsFields[] = array('table' => 'quartier', 'value' => 'idQuartier', 'title' => 'nom'); $paramsFields[] = array('table' => 'sousQuartier', 'value' => 'idSousQuartier', 'title' => 'nom'); $paramsFields[] = array('table' => 'rue', 'value' => 'idRue', 'title' => 'nom'); $formActionUrl = $this->creerUrl('', 'saveInterest', array()); foreach ($paramsFields as $params) { $options[] = $this->getAllField($params); } $paramsRequest[] = array('table' => '_interetRue', 'field' => 'idRue', 'associateTable' => 'rue'); $paramsRequest[] = array('table' => '_interetSousQuartier', 'field' => 'idSousQuartier', 'associateTable' => 'sousQuartier'); $paramsRequest[] = array('table' => '_interetQuartier', 'field' => 'idQuartier', 'associateTable' => 'quartier'); $paramsRequest[] = array('table' => '_interetVille', 'field' => 'idVille', 'associateTable' => 'ville'); $paramsRequest[] = array('table' => '_interetPays', 'field' => 'idPays', 'associateTable' => 'pays'); $userInterest = $this->getAllInterest($paramsRequest); /* * Array of EVERY interest by categories : street country address etc.. */ foreach ($userInterest as $interestByCat) { if (!isset($interestByCat[0]['vide'])) { $t->assign_block_vars('interestList', array('title' => 'Liste des ' . $interestByCat[0]['titre'] . ' dans les centres d\'intérêt', 'CSSclass' => 'interestList')); /* * Interest of each category */ foreach ($interestByCat as $interest) { /* * Process fields for delete link */ $table = $interest['table']; $fieldId = $interest['field']; $userId = $interest['idUtilisateur']; $interestId = $interest[$fieldId]; $paramsDelete = array($table, $fieldId, $userId, $interestId); $deleteUrl = $this->creerUrl('', 'deleteInterest', array('params' => $paramsDelete)); switch ($interest['associateTable']) { case 'personne': $t->assign_block_vars('interestList.interests', array('name' => $interest['nom'] . " " . $interest['prenom'], 'deleteUrl' => $deleteUrl)); break; default: $t->assign_block_vars('interestList.interests', array('name' => $interest['nom'], 'deleteUrl' => $deleteUrl)); } } } else { $t->assign_block_vars('interestList', array('vide' => 'Aucun résultat', 'title' => 'Liste des ' . $interestByCat[0]['titre'] . ' dans les centres d\'intérêt', 'CSSclass' => 'interestList')); } } $t->assign_vars(array('formAddInterest' => $formAddressAddInterest, 'formActionUrl' => $formActionUrl, 'nameForm' => 'saveInterest')); ob_start(); $t->pparse('myinterests'); $html .= ob_get_contents(); ob_end_clean(); return $html; } else { $this->messages->addError("Veuillez vous connecter pour personnaliser votre flux"); $this->messages->display(); $auth = new ArchiAuthentification(); return $auth->afficheFormulaireAuthentification(); } }
} $htmlHeader = ob_get_contents(); ob_end_clean(); if (!isset($_GET['noHTMLHeaderFooter'])) { if (!isset($_GET["noHeaderNoFooter"]) && !isset($_POST["noHeaderNoFooter"])) { if (ArchiConfig::getJsFooter() != '') { $footerJS = ArchiConfig::getJsFooter(); } include 'modules/footer/index.php'; $footerAndHeader['footer'] = $footer; } else { $footerJS = ""; if (ArchiConfig::getJsFooter() != '') { $footerJS = ArchiConfig::getJsFooter(); } if (!isset($config->isSiteLocal) || $config->isSiteLocal == false) { $analyticsJSvar = "<script type='text/javascript' src='js/analytics.js'></script>"; } $footerAndHeader['footer'] = "</body>\n </html>"; } } $t = new Template('modules/archi/templates/general/'); $t->set_filenames(array('template' => 'template.tpl')); $ajaxObj = new ajaxObject(); $t->assign_vars(array('ajaxFunctions' => $ajaxObj->getAjaxFunctions(), 'headerJS' => $headerJS, 'analyticsJS' => $analyticsJSvar, 'htmlHeader' => $htmlHeader, 'htmlModule' => $htmlModule, 'content' => '')); $t->assign_vars($footerAndHeader); ob_start(); $t->pparse('template'); $page = ob_get_contents(); ob_end_clean(); echo $page;
// HEADER // ob_start(); if (!isset($_GET['noHTMLHeaderFooter'])) { if (!isset($_GET["noHeaderNoFooter"]) && !isset($_POST["noHeaderNoFooter"])) { $headerJS = ""; if (ArchiConfig::getJsHeader() != '') { $headerJS = ArchiConfig::getJsHeader(); } include 'modules/header/index.php'; } else { $headerJS = ""; if (ArchiConfig::getJsHeader() != '') { $headerJS = ArchiConfig::getJsHeader(); } $ajaxObj = new ajaxObject(); ?> <html> <head> <link href="css/default.css" rel="stylesheet" type="text/css" /> <script type='text/javascript' src='includes/datePicker.js'></script> <script type='text/javascript' src='includes/bbcode.js'></script> <?php echo $ajaxObj->getAjaxFunctions(); ?> <script type='text/javascript' src='includes/common.js'></script> <?php echo $headerJS; ?> </head> <body><?php