public function afficheFormulaireModificationElementAdresse($parametres = array())
 {
     // verification des droits
     $a = new archiAuthentification();
     $u = new archiUtilisateur();
     $html = "";
     if ($a->estAdmin() || $u->isAuthorized('admin_rues', $a->getIdUtilisateur()) && $u->isAuthorized('admin_quartiers', $a->getIdUtilisateur()) && $u->isAuthorized('admin_sousQuartiers', $a->getIdUtilisateur())) {
         $htmlDependances = "";
         $t = new Template('modules/archi/templates/');
         $idRue = 0;
         $idQuartier = 0;
         $idSousQuartier = 0;
         $idVille = 0;
         $idPays = 0;
         switch ($parametres['tableName']) {
             case 'rue':
                 $t->set_filenames(array('modificationElementAdresse' => 'modificationElementAdresseRue.tpl'));
                 $idRue = $parametres['id'];
                 $req = "\n                            SELECT r.nom as nomRue, r.prefixe as prefixeRue,sq.idSousQuartier as idSousQuartier,\n                                    q.idQuartier as idQuartier, v.idVille as idVille, p.idPays as idPays\n                            FROM rue r\n                            LEFT JOIN sousQuartier sq ON sq.idSousQuartier = r.idSousQuartier\n                            LEFT JOIN quartier q ON q.idQuartier = sq.idQuartier\n                            LEFT JOIN ville v ON v.idVille = q.idVille\n                            LEFT JOIN pays p ON p.idPays = v.idPays\n                            WHERE idRue = '" . $idRue . "'";
                 $res = $this->connexionBdd->requete($req);
                 if (mysql_num_rows($res) == 1) {
                     $fetch = mysql_fetch_assoc($res);
                     $t->assign_vars(array('intitule' => stripslashes($fetch['nomRue']), 'complement' => stripslashes($fetch['prefixeRue']), 'sousQuartierField' => $this->afficheSelectSousQuartier(array('idQuartier' => $fetch['idQuartier'], 'idSousQuartier' => $fetch['idSousQuartier'])), 'quartierField' => $this->afficheSelectQuartier(array('idVille' => $fetch['idVille'], 'idQuartier' => $fetch['idQuartier'])), 'villeField' => $this->afficheSelectVille(array('idPays' => $fetch['idPays'], 'idVille' => $fetch['idVille'])), 'paysField' => $this->afficheSelectPays(array('idPays' => $fetch['idPays'])), 'idRue' => $idRue));
                 }
                 // ************************************************************************************************************************
                 // affichage des dependances liées a la rue:
                 // ************************************************************************************************************************
                 $htmlDependances .= "<h3>Dependances sur les adresses affichées sur le site</h3>";
                 $arrayDependances = $this->getDependancesFrom($idRue, 'idRue');
                 $lienSupprRue = "";
                 if ($arrayDependances['nbDependances'] == 0) {
                     $lienSupprRue = "<a href='" . $this->creerUrl('supprimerRueFromAdminRue', 'adminElementAdresse', array('tableName' => 'rue', 'idRueSuppr' => $idRue)) . "'>Supprimer la rue</a>";
                 }
                 $htmlDependances .= "nombre de dépendances = " . $arrayDependances['nbDependances'] . " {$lienSupprRue}<br>";
                 $tableau = new tableau();
                 $tableau->addValue("adresses", "style='font-weight:bold'");
                 $tableau->addValue("nombre d'evenements associés", "style='font-weight:bold'");
                 foreach ($arrayDependances['arrayDependances'] as $indice => $value) {
                     $lienSupprAdresse = "";
                     if ($value['nbEvenementsAssocies'] == 0) {
                         $lienSupprAdresse = "&nbsp;&nbsp;&nbsp;<a href='" . $this->creerUrl('supprimerAdresseFromAdminRue', 'adminAdresseDetail', array('tableName' => 'rue', 'idModification' => $idRue, 'idAdresseSuppr' => $value['idAdresse'])) . "'>Supprimer l'adresse</a>";
                     }
                     $tableau->addValue("<a href='" . $this->creerUrl('', 'adresseDetail', array('archiIdAdresse' => $value['idAdresse'])) . "'>" . $this->getIntituleAdresseFrom($value['idAdresse'], 'idAdresse') . "</a>");
                     $tableau->addValue($value['nbEvenementsAssocies'] . $lienSupprAdresse);
                 }
                 $htmlDependances .= $tableau->createHtmlTableFromArray(2);
                 break;
             case 'sousQuartier':
                 $t->set_filenames(array('modificationElementAdresse' => 'modificationElementAdresseSousQuartier.tpl'));
                 $idSousQuartier = $parametres['id'];
                 $req = "\n                        SELECT sq.nom as nomSousQuartier, sq.idSousQuartier as idSousQuartier,\n                                    q.idQuartier as idQuartier, v.idVille as idVille, p.idPays as idPays\n                        FROM sousQuartier sq\n                        LEFT JOIN quartier q ON q.idQuartier = sq.idQuartier\n                        LEFT JOIN ville v ON v.idVille = q.idVille\n                        LEFT JOIN pays p ON p.idPays = v.idPays\n                        WHERE sq.idSousQuartier= '" . $idSousQuartier . "'";
                 $res = $this->connexionBdd->requete($req);
                 if (mysql_num_rows($res) == 1) {
                     $fetch = mysql_fetch_assoc($res);
                     $t->assign_vars(array('intitule' => stripslashes($fetch['nomSousQuartier']), 'quartierField' => $this->afficheSelectQuartier(array('idVille' => $fetch['idVille'], 'idQuartier' => $fetch['idQuartier'], 'noSousQuartier' => true)), 'villeField' => $this->afficheSelectVille(array('idPays' => $fetch['idPays'], 'idVille' => $fetch['idVille'], 'noSousQuartier' => true)), 'paysField' => $this->afficheSelectPays(array('idPays' => $fetch['idPays'], 'noSousQuartier' => true)), 'idSousQuartier' => $idSousQuartier));
                 }
                 // ************************************************************************************************************************
                 // affichage des dependances liées au sous quartier
                 // ************************************************************************************************************************
                 $htmlDependances .= "<h3>Dependances sur les sous quartiers</h3>";
                 $arrayDependances = $this->getDependancesFrom($idSousQuartier, 'idSousQuartier');
                 $htmlDependances .= "nombre de dépendances = " . $arrayDependances['nbDependances'] . "<br>";
                 $tableauAdresses = new tableau();
                 $tableauRues = new tableau();
                 $tableauAdresses->addValue("adresses", "style='font-weight:bold'");
                 $tableauAdresses->addValue("nombre d'evenements associés", "style='font-weight:bold'");
                 $tableauRues->addValue("rues dépendantes de ce sous quartier", "style='font-weight:bold'");
                 foreach ($arrayDependances['arrayDependances'] as $indice => $value) {
                     if (isset($value['idAdresse'])) {
                         $tableauAdresses->addValue("<a href='" . $this->creerUrl('', 'adresseDetail', array('archiIdAdresse' => $value['idAdresse'])) . "'>" . $this->getIntituleAdresseFrom($value['idAdresse'], 'idAdresse') . "</a>");
                         $tableauAdresses->addValue($value['nbEvenementsAssocies']);
                     }
                     if (isset($value['idRue'])) {
                         $intituleRue = $this->getAdresseComplete($value['idRue'], 'rue', array('miseEnForme' => true));
                         $tableauRues->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'rue', 'idModification' => $value['idRue'])) . "'>" . $intituleRue . "</a>");
                     }
                 }
                 $htmlDependances .= $tableauAdresses->createHtmlTableFromArray(2);
                 $htmlDependances .= $tableauRues->createHtmlTableFromArray(1);
                 break;
             case 'quartier':
                 $t->set_filenames(array('modificationElementAdresse' => 'modificationElementAdresseQuartier.tpl'));
                 $idQuartier = $parametres['id'];
                 $req = "\n                            SELECT q.nom as nomQuartier,v.idVille as idVille, p.idPays as idPays\n                            FROM quartier q\n                            LEFT JOIN ville v ON v.idVille = q.idVille\n                            LEFT JOIN pays p ON p.idPays = v.idPays\n                            WHERE q.idQuartier = '" . $idQuartier . "'\n                    ";
                 $res = $this->connexionBdd->requete($req);
                 if (mysql_num_rows($res) == 1) {
                     $fetch = mysql_fetch_assoc($res);
                     $t->assign_vars(array('intitule' => stripslashes($fetch['nomQuartier']), 'villeField' => $this->afficheSelectVille(array('idPays' => $fetch['idPays'], 'idVille' => $fetch['idVille'], 'noSousQuartier' => true, 'noQuartier' => true)), 'paysField' => $this->afficheSelectPays(array('idPays' => $fetch['idPays'], 'noSousQuartier' => true, 'noQuartier' => true)), 'idQuartier' => $idQuartier));
                 }
                 // ************************************************************************************************************************
                 // affichage des dependances liées au  quartier
                 // ************************************************************************************************************************
                 $htmlDependances .= "<h3>Dependances sur quartiers</h3>";
                 $arrayDependances = $this->getDependancesFrom($idQuartier, 'idQuartier');
                 $htmlDependances .= "nombre de dépendances = " . $arrayDependances['nbDependances'] . "<br>";
                 $tableauAdresses = new tableau();
                 $tableauRues = new tableau();
                 $tableauSousQuartiers = new tableau();
                 $tableauAdresses->addValue("adresses", "style='font-weight:bold'");
                 $tableauAdresses->addValue("nombre d'evenements associés", "style='font-weight:bold'");
                 $tableauRues->addValue("rues dépendantes de ce quartier", "style='font-weight:bold'");
                 $tableauSousQuartiers->addValue("sous quartiers dépendants de ce quartier", "style='font-weight:bold'");
                 foreach ($arrayDependances['arrayDependances'] as $indice => $value) {
                     if (isset($value['idAdresse'])) {
                         $tableauAdresses->addValue("<a href='" . $this->creerUrl('', 'adresseDetail', array('archiIdAdresse' => $value['idAdresse'])) . "'>" . $this->getIntituleAdresseFrom($value['idAdresse'], 'idAdresse') . "</a>");
                         $tableauAdresses->addValue($value['nbEvenementsAssocies']);
                     }
                     if (isset($value['idRue'])) {
                         $intituleRue = $this->getAdresseComplete($value['idRue'], 'rue', array('miseEnForme' => true));
                         $tableauRues->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'rue', 'idModification' => $value['idRue'])) . "'>" . $intituleRue . "</a>");
                     }
                     if (isset($value['idSousQuartier'])) {
                         $intituleSousQuartier = $this->getAdresseComplete($value['idSousQuartier'], 'sousQuartier', array('miseEnForme' => true));
                         $tableauSousQuartiers->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'sousQuartier', 'idModification' => $value['idSousQuartier'])) . "'>" . $intituleSousQuartier . "</a>");
                     }
                 }
                 $htmlDependances .= $tableauAdresses->createHtmlTableFromArray(2);
                 $htmlDependances .= $tableauRues->createHtmlTableFromArray(1);
                 $htmlDependances .= $tableauSousQuartiers->createHtmlTableFromArray(1);
                 break;
             case 'ville':
                 $googleMap = new googleMap(array('googleMapKey' => $this->googleMapKey));
                 $jsGoogleMap = "";
                 $jsGoogleMap .= $googleMap->getJsFunctions();
                 $jsGoogleMap .= $googleMap->getJSInitGeoCoder();
                 $jsToExecute = "document.getElementById('formModif').action='" . $this->creerUrl('adminEnregistreModifAdresse', '', $parametres) . "';document.getElementById('formModif').submit();";
                 $arrayJsCoordonneesFromGoogleMap = $googleMap->getJSRetriveCoordonnees(array('nomChampLatitudeRetour' => 'latitude', 'nomChampLongitudeRetour' => 'longitude', 'getAdresseFromElementById' => true, 'jsAdresseValue' => "document.getElementById('intituleVille').value+' '+document.getElementById('pays').options[document.getElementById('pays').selectedIndex].innerHTML", 'jsToExecuteIfOK' => $jsToExecute, 'jsToExecuteIfNoAddressFound' => "document.getElementById('latitude').value='';document.getElementById('longitude').value='';" . $jsToExecute));
                 $jsGoogleMap .= $arrayJsCoordonneesFromGoogleMap['jsFunctionToExecute'];
                 $t->set_filenames(array('modificationElementAdresse' => 'modificationElementAdresseVille.tpl'));
                 $idVille = $parametres['id'];
                 $req = "\n                            SELECT v.nom as nomVille,v.codepostal as codePostal, p.idPays as idPays,v.longitude as longitude, v.latitude as latitude\n                            FROM ville v\n                            LEFT JOIN pays p ON p.idPays = v.idPays\n                            WHERE v.idVille = '" . $idVille . "'\n                    ";
                 $res = $this->connexionBdd->requete($req);
                 if (mysql_num_rows($res) == 1) {
                     $fetch = mysql_fetch_assoc($res);
                     $t->assign_vars(array('jsGoogleMap' => $jsGoogleMap, 'intitule' => stripslashes($fetch['nomVille']), 'codePostal' => $fetch['codePostal'], 'paysField' => $this->afficheSelectPays(array('idPays' => $fetch['idPays'], 'noSousQuartier' => true, 'noQuartier' => true, 'noVille' => true)), 'latitude' => $fetch['latitude'], 'longitude' => $fetch['longitude'], 'idVille' => $idVille));
                 }
                 // ************************************************************************************************************************
                 // affichage des dependances liées a la ville
                 // ************************************************************************************************************************
                 $htmlDependances .= "<h3>Dependances sur la ville</h3>";
                 $arrayDependances = $this->getDependancesFrom($idVille, 'idVille');
                 $htmlDependances .= "nombre de dépendances = " . $arrayDependances['nbDependances'] . "<br>";
                 $tableauAdresses = new tableau();
                 $tableauRues = new tableau();
                 $tableauSousQuartiers = new tableau();
                 $tableauQuartiers = new tableau();
                 $tableauAdresses->addValue("adresses", "style='font-weight:bold'");
                 $tableauAdresses->addValue("nombre d'evenements associés", "style='font-weight:bold'");
                 $tableauRues->addValue("rues dépendantes de cette ville", "style='font-weight:bold'");
                 $tableauSousQuartiers->addValue("sous quartiers dépendants de cette ville", "style='font-weight:bold'");
                 $tableauQuartiers->addValue("quartiers dépendants de cette ville", "style='font-weight:bold'");
                 foreach ($arrayDependances['arrayDependances'] as $indice => $value) {
                     if (isset($value['idAdresse'])) {
                         $tableauAdresses->addValue("<a href='" . $this->creerUrl('', 'adresseDetail', array('archiIdAdresse' => $value['idAdresse'])) . "'>" . $this->getIntituleAdresseFrom($value['idAdresse'], 'idAdresse') . "</a>");
                         $tableauAdresses->addValue($value['nbEvenementsAssocies']);
                     }
                     if (isset($value['idRue'])) {
                         $intituleRue = $this->getAdresseComplete($value['idRue'], 'rue', array('miseEnForme' => true));
                         $tableauRues->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'rue', 'idModification' => $value['idRue'])) . "'>" . $intituleRue . "</a>");
                     }
                     if (isset($value['idSousQuartier'])) {
                         $intituleSousQuartier = $this->getAdresseComplete($value['idSousQuartier'], 'sousQuartier', array('miseEnForme' => true));
                         $tableauSousQuartiers->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'sousQuartier', 'idModification' => $value['idSousQuartier'])) . "'>" . $intituleSousQuartier . "</a>");
                     }
                     if (isset($value['idQuartier'])) {
                         $intituleQuartier = $this->getAdresseComplete($value['idQuartier'], 'quartier', array('miseEnForme' => true));
                         $tableauQuartiers->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'quartier', 'idModification' => $value['idQuartier'])) . "'>" . $intituleQuartier . "</a>");
                     }
                 }
                 $htmlDependances .= $tableauAdresses->createHtmlTableFromArray(2);
                 $htmlDependances .= $tableauRues->createHtmlTableFromArray(1);
                 $htmlDependances .= $tableauSousQuartiers->createHtmlTableFromArray(1);
                 $htmlDependances .= $tableauQuartiers->createHtmlTableFromArray(1);
                 break;
             case 'pays':
                 $t->set_filenames(array('modificationElementAdresse' => 'modificationElementAdressePays.tpl'));
                 $idPays = $parametres['id'];
                 $req = "\n                            SELECT p.nom as nomPays\n                            FROM pays p\n                            WHERE p.idPays = '" . $idPays . "'\n                    ";
                 $res = $this->connexionBdd->requete($req);
                 if (mysql_num_rows($res) == 1) {
                     $fetch = mysql_fetch_assoc($res);
                     $t->assign_vars(array('intitule' => stripslashes($fetch['nomPays']), 'idPays' => $idPays));
                 }
                 // ************************************************************************************************************************
                 // affichage des dependances liées a la ville
                 // ************************************************************************************************************************
                 $htmlDependances .= "<h3>Dependances sur le pays</h3>";
                 $arrayDependances = $this->getDependancesFrom($idPays, 'idPays');
                 $htmlDependances .= "nombre de dépendances = " . $arrayDependances['nbDependances'] . "<br>";
                 $tableauAdresses = new tableau();
                 $tableauRues = new tableau();
                 $tableauSousQuartiers = new tableau();
                 $tableauQuartiers = new tableau();
                 $tableauVilles = new tableau();
                 $tableauAdresses->addValue("adresses", "style='font-weight:bold'");
                 $tableauAdresses->addValue("nombre d'evenements associés", "style='font-weight:bold'");
                 $tableauRues->addValue("rues dépendantes de ce pays", "style='font-weight:bold'");
                 $tableauSousQuartiers->addValue("sous quartiers dépendants de ce pays", "style='font-weight:bold'");
                 $tableauQuartiers->addValue("quartiers dépendants de ce pays", "style='font-weight:bold'");
                 $tableauVilles->addValue("villes dépendantes de ce pays", "style='font-weight:bold'");
                 foreach ($arrayDependances['arrayDependances'] as $indice => $value) {
                     if (isset($value['idAdresse'])) {
                         $tableauAdresses->addValue("<a href='" . $this->creerUrl('', 'adresseDetail', array('archiIdAdresse' => $value['idAdresse'])) . "'>" . $this->getIntituleAdresseFrom($value['idAdresse'], 'idAdresse') . "</a>");
                         $tableauAdresses->addValue($value['nbEvenementsAssocies']);
                     }
                     if (isset($value['idRue'])) {
                         $intituleRue = $this->getAdresseComplete($value['idRue'], 'rue', array('miseEnForme' => true));
                         $tableauRues->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'rue', 'idModification' => $value['idRue'])) . "'>" . $intituleRue . "</a>");
                     }
                     if (isset($value['idSousQuartier'])) {
                         $intituleSousQuartier = $this->getAdresseComplete($value['idSousQuartier'], 'sousQuartier', array('miseEnForme' => true));
                         $tableauSousQuartiers->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'sousQuartier', 'idModification' => $value['idSousQuartier'])) . "'>" . $intituleSousQuartier . "</a>");
                     }
                     if (isset($value['idQuartier'])) {
                         $intituleQuartier = $this->getAdresseComplete($value['idQuartier'], 'quartier', array('miseEnForme' => true));
                         $tableauQuartiers->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'quartier', 'idModification' => $value['idQuartier'])) . "'>" . $intituleQuartier . "</a>");
                     }
                     if (isset($value['idVille'])) {
                         $intituleVille = $this->getAdresseComplete($value['idVille'], 'ville', array('miseEnForme' => true));
                         $tableauVilles->addValue("<a href='" . $this->creerUrl('', 'adminAdresseDetail', array('tableName' => 'ville', 'idModification' => $value['idVille'])) . "'>" . $intituleVille . "</a>");
                     }
                 }
                 $htmlDependances .= $tableauAdresses->createHtmlTableFromArray(2);
                 $htmlDependances .= $tableauRues->createHtmlTableFromArray(1);
                 $htmlDependances .= $tableauSousQuartiers->createHtmlTableFromArray(1);
                 $htmlDependances .= $tableauQuartiers->createHtmlTableFromArray(1);
                 $htmlDependances .= $tableauVilles->createHtmlTableFromArray(1);
                 break;
         }
         switch ($parametres['tableName']) {
             case 'ville':
                 // on adapte le bouton modifier pour que la recherche googleMap des coordonnees se lance a la validation du formulaire
                 $typeButtonModifier = "button";
                 $onClickButtonModifier = $arrayJsCoordonneesFromGoogleMap['jsFunctionCall'];
                 break;
             default:
                 $typeButtonModifier = "submit";
                 $onClickButtonModifier = "document.getElementById('formModif').action='" . $this->creerUrl('adminEnregistreModifAdresse', '', $parametres) . "';";
                 break;
         }
         $t->assign_vars(array('typeElement' => $parametres['tableName'], 'typeButtonModifier' => $typeButtonModifier, 'onClickBoutonModifier' => $onClickButtonModifier, 'onClickBoutonRetour' => "location.href='" . $this->creerUrl('', 'adminElementAdresse', array('tableName' => $parametres['tableName'])) . "';"));
         ob_start();
         $t->pparse('modificationElementAdresse');
         $html .= ob_get_contents();
         $html .= "<br><br><h2>Dependances</h2>";
         $html .= "(concernant les adresses, deux evenements différents peuvent afficher la meme adresse , dans ce cas l'adresse est liée a deux groupes d'adresses différents.<br><br>";
         $html .= $htmlDependances;
         ob_end_clean();
         // dans le cas de la rue , on affiche un onglet pour l'historique des noms de rue
         if ($parametres['tableName'] == 'rue') {
             $d = new dateObject();
             $reqVals = "SELECT * FROM historiqueNomsRues WHERE idRue = '" . $parametres['id'] . "'";
             $resVals = $this->connexionBdd->requete($reqVals);
             $valsIdHistoriques = array();
             $valsIdRues = array();
             $valsAnnees = array();
             $valsNomsRues = array();
             $valsCommentaires = array();
             $valsPrefixes = array();
             $i = 0;
             while ($fetchVals = mysql_fetch_assoc($resVals)) {
                 $valsIdHistoriques[$i] = $fetchVals['idHistoriqueNomRue'];
                 $valsIdRues[$i] = $fetchVals['idRue'];
                 $valsAnnees[$i] = $d->toFrench($fetchVals['annee']);
                 $valsNomsRues[$i] = $fetchVals['nomRue'];
                 $valsCommentaires[$i] = $fetchVals['commentaire'];
                 $valPrefixes[$i] = $fetchVals['prefixe'];
                 $i++;
             }
             if ($i == 0) {
                 $valsIdHistoriques[$i] = '';
                 $valsIdRues[$i] = '';
                 $valsAnnees[$i] = '';
                 $valsNomsRues[$i] = '';
                 $valsCommentaires[$i] = '';
                 $valPrefixes[$i] = '';
             }
             $configForm = array("idHistoriqueNomRue" => array("type" => "hidden", "libelle" => "idHistoriqueNomRue", "defaultValues" => $valsIdHistoriques, "error" => "", "default" => ""), "annee" => array("type" => "date", "libelle" => "annee", "defaultValues" => $valsAnnees, "error" => "", "default" => ""), "prefixe" => array("type" => "text", "libelle" => "prefixe", "defaultValues" => $valPrefixes, "error" => "", "default" => ""), "nomRue" => array("type" => "text", "libelle" => "nomRue", "defaultValues" => $valsNomsRues, "error" => "", "default" => ""), "commentaire" => array("type" => "bigText", "libelle" => "commentaire", "defaultValues" => $valsCommentaires, "error" => "", "default" => ""));
             $f = new formGenerator();
             $arrayFormulaireMultiLignes = $f->getFormulaireMultiLignes(array("configForm" => $configForm, "formAction" => $this->creerUrl('enregistreHistoriqueNomsRues', 'adminAdresseDetail', array("tableName" => 'rue', "idModification" => $parametres['id']))));
             $htmlHistoriqueNomRue = $arrayFormulaireMultiLignes['html'];
             $onglets = new ongletObject();
             $onglets->init(0);
             $onglets->setStyleTable("style='margin:0px;padding:0px;'");
             $onglets->setStyleTableEtiquettes("style='margin:0px;padding:0px;'");
             $onglets->addContent("Modifier un élément de rue ", $html);
             $onglets->addContent("Historique du nom de la rue", $htmlHistoriqueNomRue);
             $html = $onglets->getHTML();
             $html .= $arrayFormulaireMultiLignes['jsAfterMultiLigneArray'];
         }
     } else {
         $erreurObj = new objetErreur();
         $erreurObj->ajouter("Vous n'avez pas les droits pour accéder à cette partie du site");
         echo $erreurObj->afficher();
     }
     return $html;
 }
Example #2
0
         /*
                             echo $personne->erreurs->afficher();
                             echo $personne->afficheFormulaireNouveauDossier(array(), "personne");
         */
     }
     break;
 case 'enregistreGroupeAdresses':
     $adresses = new archiAdresse();
     $adresses->enregistreGroupeAdresses($_GET['archiIdEvenementGroupeAdresses']);
     break;
 case 'deleteImage':
     $image = new archiImage();
     $image->deleteImage($_GET['archiIdImage'], array('retourSurGroupeAdresse' => true));
     break;
 case 'supprimerCommentaire':
     if ($authentification->estAdmin()) {
         $adresse = new archiAdresse();
         $adresse->deleteCommentaire();
     }
     break;
 case 'supprimerCommentaireEvenement':
     if ($authentification->estAdmin()) {
         $adresse = new archiEvenement();
         $adresse->deleteCommentaireEvenement();
     }
     break;
 case 'enregistrePositionsImages':
     $image = new archiImage();
     $image->enregistrePositionImages();
     break;
 case 'enregistreDroits':
 public function canCopyright($params = array())
 {
     $retour = false;
     $authentification = new archiAuthentification();
     if ($authentification->estAdmin(array('idUtilisateur' => $params['idUtilisateur'])) || $authentification->estModerateur(array('idUtilisateur' => $params['idUtilisateur']))) {
         $retour = true;
     } else {
         // cas d'un profil d'utilisateur
         $req = "SELECT canCopyright FROM utilisateur WHERE idUtilisateur = '" . $params['idUtilisateur'] . "'";
         $res = $this->connexionBdd->requete($req);
         $fetch = mysql_fetch_assoc($res);
         if ($fetch['canCopyright'] == '1') {
             $retour = true;
         }
     }
     return $retour;
 }
 public function getListCommentairesEvenements($idCommentaireAdresse = 0)
 {
     $bbCode = new bbCodeObject();
     $u = new archiUtilisateur();
     $html = "";
     $t = new Template('modules/archi/templates/');
     $t->set_filenames(array('listeCommentaires' => 'listeCommentaires.tpl'));
     $req = "SELECT c.idCommentairesEvenement as idCommentaire,c.nom as nom,c.prenom as prenom,c.email as email,DATE_FORMAT(c.date,'" . _("%d/%m/%Y à %kh%i") . "') as dateF,c.commentaire as commentaire,c.idUtilisateur as idUtilisateur\n\t\t\t\t ,date_format( c.date, '%Y%m%d%H%i%s' ) AS dateTri\n\t\t\t\tFROM commentairesEvenement c\n\t\t\t\tLEFT JOIN utilisateur u ON u.idUtilisateur = c.idUtilisateur\n\t\t\t\tWHERE c.idEvenement = '" . $idCommentaireAdresse . "'\n\t\t\t\tAND CommentaireValide=1\n\t\t\t\tORDER BY DateTri DESC\n\t\t\t\t";
     if (isset($this->variablesGet['archiIdEvenementGroupeAdresse']) && $this->variablesGet['archiIdEvenementGroupeAdresse'] != '') {
         $idEvenementGroupeAdresse = $this->variablesGet['archiIdEvenementGroupeAdresse'];
     }
     $res = $this->connexionBdd->requete($req);
     if (mysql_num_rows($res) > 0) {
         $t->assign_vars(array('tableHtmlCode' => "  ", 'titre' => _("Liste des commentaires concernant l'adresse")));
         $authentification = new archiAuthentification();
         // si l'utilisateur est administrateur, on affiche le bouton de suppression d'un commentaire
         $isAdmin = false;
         if ($authentification->estConnecte() && $authentification->estAdmin()) {
             $isAdmin = true;
         }
         while ($fetch = mysql_fetch_assoc($res)) {
             $adresseMail = "";
             $boutonSupprimer = "";
             $urlSiteWeb = "";
             $urlProfilePic = $u->getImageAvatar(array('idUtilisateur' => $fetch['idUtilisateur']));
             if ($fetch['urlSiteWeb'] != '') {
                 $urlSiteWeb = "<br><a itemprop='url' href='" . $fetch['urlSiteWeb'] . "' target='_blank'><span style='font-size:9px;color:#FFFFFF;'>" . $fetch['urlSiteWeb'] . "</span></a>";
             }
             $t->assign_block_vars('commentaires', array('htmlId' => 'commentaireEvenement' . $fetch['idCommentaire'], 'adresseMail' => $adresseMail, 'commentaire' => $bbCode->convertToDisplay(array('text' => stripslashes($fetch['commentaire']), 'type' => 'commentaire')), 'urlProfilPic' => $urlProfilePic, 'prenom' => $fetch['prenom'], 'nom' => $fetch['nom'], 'labelCommentAction' => _("a ajouté un commentaire"), 'date' => $fetch['dateF']));
             if ($isAdmin) {
                 $archiIdAdresse = '';
                 if (isset($this->variablesGet['archiIdAdresse']) && $this->variablesGet['archiIdAdresse'] != '') {
                     $archiIdAdresse = $this->variablesGet['archiIdAdresse'];
                 } else {
                     if (isset($this->variablesGet['archiIdEvenementGroupeAdresse']) && $this->variablesGet['archiIdEvenementGroupeAdresse'] != '') {
                         $idEvenementGroupeAdresse = $this->variablesGet['archiIdEvenementGroupeAdresse'];
                     } else {
                         $requeteIdEvt = "SELECT idEvenement FROM _evenementEvenement WHERE idEvenementAssocie = {$idCommentaireAdresse}";
                         $resIdEvt = $this->connexionBdd->requete($requeteIdEvt);
                         $arrayIdEvt = mysql_fetch_assoc($resIdEvt);
                         $idEvenementGroupeAdresse = $arrayIdEvt['idEvenement'];
                     }
                     $archiIdAdresse = $this->getIdAdresseFromIdEvenementGroupeAdresse($idEvenementGroupeAdresse);
                 }
                 $boutonSupprimer = "<input type='button' value='supprimer' onclick=\"location.href='" . $this->creerUrl('supprimerCommentaire', '', array('archiIdCommentaire' => $fetch['idCommentaire'], 'archiIdAdresse' => $archiIdAdresse, 'archiIdEvenementGroupeAdresse' => $idEvenementGroupeAdresse)) . "';\">";
                 $urlSupprimer = $this->creerUrl('supprimerCommentaireEvenement', '', array('archiIdCommentaire' => $fetch['idCommentaire'], 'archiIdAdresse' => $archiIdAdresse, 'archiIdEvenementGroupeAdresse' => $idEvenementGroupeAdresse));
                 $adresseMail = "<br><a style='font-size:9px;color:#FFFFFF;' itemprop='email' href='mailto:" . $fetch['email'] . "'>" . $fetch['email'] . "</a>";
                 $t->assign_block_vars('commentaires.supprimer', array('urlSupprimer' => $urlSupprimer));
             }
         }
         ob_start();
         $t->pparse('listeCommentaires');
         $html .= ob_get_contents();
         ob_end_clean();
         return $html;
     }
 }
 /**
  * Affichage du formulaire d'ajout d'un nouveau dossier (groupe d'adresse + evenement construction)
  * 
  * @param array  $parametres Paramètres
  * @param string $type       Type (adresse ou personne)
  * 
  * @return void
  * */
 public function afficheFormulaireNouveauDossier($parametres = array(), $type = "adresse")
 {
     $html = "";
     // initialisation de l'objet googlemap pour la recuperation des coordonnees
     $paramsGoogleMap = array('googleMapKey' => $this->googleMapKey);
     $googleMap = new googleMap($paramsGoogleMap);
     $html .= $googleMap->getJsFunctions();
     $html .= $googleMap->getJSInitGeoCoder();
     $t = new Template('modules/archi/templates/');
     $t->set_filenames(array('nouveauDossier' => 'nouveauDossier.tpl'));
     if ($type == "personne") {
         $formAction = "ajoutNouvelPersonne";
         $t->assign_block_vars("ajoutPersonne", array());
         $resJobs = $this->connexionBdd->requete("SELECT * FROM `metier`");
         $jobList = "";
         while ($job = mysql_fetch_assoc($resJobs)) {
             if (!empty($job["nom"])) {
                 $jobList .= "<option value='" . $job["idMetier"] . "'";
                 if (isset($_POST["metier"]) && $job["idMetier"] == $_POST["metier"]) {
                     $jobList .= " selected='selected' ";
                 }
                 $jobList .= ">" . $job["nom"] . "</option>";
             }
         }
         $t->assign_vars(array('titrePage' => _("Ajout d'une nouvelle personne (physique ou morale)"), "jobList" => $jobList, "typeBoutonValidation" => "submit"));
         if (!empty($_POST) && !isset($_POST["archiLogin"])) {
             $t->assign_vars(array("firstname" => $_POST["prenom"], "name" => $_POST["nom"], "birth" => $_POST["dateNaissance"], "death" => $_POST["dateDeces"], "desc" => $_POST["descriptionPerson"]));
         }
     } else {
         $formAction = "ajoutNouveauDossier";
         if (!isset($arrayJsCoordonneesFromGoogleMap['jsFunctionCall'])) {
             $arrayJsCoordonneesFromGoogleMap['jsFunctionCall'] = 0;
         }
         // assignation du titre de la page
         $t->assign_vars(array('titrePage' => _("Ajout d'une nouvelle adresse"), 'typeBoutonValidation' => "submit"));
         // ********
         // on affiche la partie ajout d'une adresse
         $t->assign_block_vars('isNotAjoutSousEvenement', array());
         // ********
     }
     // ********
     // on affiche la partie "ajout d'un evenement"
     $t->assign_block_vars('afficheAjoutEvenement', array());
     // *******
     // ******
     // si la personne n'est pas admin elle verra une version simplifiée du formulaire
     $authentification = new archiAuthentification();
     $u = new archiUtilisateur();
     if ($authentification->estConnecte() && ($authentification->estAdmin() || $u->canAddWithoutStreet(array('idUtilisateur' => $authentification->getIdUtilisateur())))) {
         $t->assign_block_vars('afficheAjoutEvenement.isAdmin', array());
         $t->assign_vars(array("displayQuartiers" => 'table-row'));
         $t->assign_vars(array("displaySousQuartiers" => 'table-row'));
     } else {
         $t->assign_block_vars('afficheAjoutEvenement.isNotAdmin', array());
         $t->assign_vars(array("displayQuartiers" => 'none'));
         $t->assign_vars(array("displaySousQuartiers" => 'none'));
     }
     // ******
     $typeStructure = 0;
     if (isset($this->variablesPost['typeStructure']) && $this->variablesPost['typeStructure'] != '') {
         $typeStructure = $this->variablesPost['typeStructure'];
     }
     $groupeTypeEvenement = 2;
     // par defaut on selectionne les evenement de type 'travaux'
     if (isset($this->variablesPost['typeGroupeEvenement']) && $this->variablesPost['typeGroupeEvenement'] != '') {
         $groupeTypeEvenement = $this->variablesPost['typeGroupeEvenement'];
     }
     $typeEvenement = 0;
     if (isset($this->variablesPost['typeEvenement']) && $this->variablesPost['typeEvenement'] != '') {
         $typeEvenement = $this->variablesPost['typeEvenement'];
     }
     if (!(isset($this->variablesPost['typeEvenement']) && $this->variablesPost['typeEvenement'] != '') && isset($this->variablesGet['archiOptionAjoutDossier']) && $this->variablesGet["archiOptionAjoutDossier"] == "nouvelleDemolition") {
         $groupeTypeEvenement = 2;
         // travaux
         $typeEvenement = 6;
     }
     if (!(isset($this->variablesPost['typeEvenement']) && $this->variablesPost['typeEvenement'] != '') && isset($this->variablesGet['archiOptionAjoutDossier']) && $this->variablesGet["archiOptionAjoutDossier"] == "nouvelEvenementCulturel") {
         $groupeTypeEvenement = 1;
         // travaux
         $typeEvenement = 0;
     }
     $ISMH = false;
     if (isset($this->variablesPost['ISMH'])) {
         $ISMH = true;
     }
     $MH = false;
     if (isset($this->variablesPost['MH'])) {
         $MH = true;
     }
     $isDateDebutEnviron = false;
     if (isset($this->variablesPost['isDateDebutEnviron'])) {
         $isDateDebutEnviron = true;
     }
     $personnes = array();
     if (isset($this->variablesPost['personnes']) && count($this->variablesPost['personnes']) > 0) {
         $personnes = $this->variablesPost['personnes'];
     }
     $ville = 0;
     if (isset($this->variablesPost['ville']) && $this->variablesPost['ville'] != '0' && $this->variablesPost['ville'] != '') {
         $ville = $this->variablesPost['ville'];
     }
     // ***********************************************************************************
     // recuperation des valeurs des champs textes du formulaire validé,  les autres champs sont mis en place individuellement
     $listeChamps = array('titre', 'source', 'sourcetxt', 'dateDebut', 'dateFin', 'nbEtages', 'description', 'ville', 'villetxt');
     foreach ($listeChamps as $indice => $fieldName) {
         if (isset($this->variablesPost[$fieldName]) && $this->variablesPost[$fieldName] != '') {
             $t->assign_vars(array($fieldName => $this->variablesPost[$fieldName]));
         }
     }
     // gestion du favori de la ville ou si on a une ville generale courante
     if ($ville == '0' && !isset($this->variablesGet['archiIdVilleGeneral'])) {
         $reqVilleTxt = "select nom from ville where idVille = '" . $this->session->getFromSession('idVilleFavoris') . "'";
         $resVilleTxt = $this->connexionBdd->requete($reqVilleTxt);
         $fetchVilleTxt = mysql_fetch_assoc($resVilleTxt);
         $t->assign_vars(array('ville' => $this->session->getFromSession('idVilleFavoris'), 'villetxt' => $fetchVilleTxt['nom']));
         $ville = $this->session->getFromSession('idVilleFavoris');
     } elseif (isset($this->variablesGet['archiIdVilleGeneral'])) {
         $reqVilleTxt = "select nom from ville where idVille = '" . $this->variablesGet['archiIdVilleGeneral'] . "'";
         $resVilleTxt = $this->connexionBdd->requete($reqVilleTxt);
         $fetchVilleTxt = mysql_fetch_assoc($resVilleTxt);
         $t->assign_vars(array('ville' => $this->variablesGet['archiIdVilleGeneral'], 'villetxt' => $fetchVilleTxt['nom']));
         $ville = $this->variablesGet['archiIdVilleGeneral'];
     }
     // ***********************************************************************************
     // si un idVille existe sur le formulaire ,  on affiche les quartiers correspondants
     if ($ville != 0) {
         $resQuartiers = $this->connexionBdd->requete("select idQuartier,  nom from quartier where idVille = '" . $ville . "' order by nom");
         while ($fetchQuartiers = mysql_fetch_assoc($resQuartiers)) {
             $selected = "";
             if (isset($this->variablesPost['quartiers']) && $this->variablesPost['quartiers'] != '0' && $fetchQuartiers['idQuartier'] == $this->variablesPost['quartiers']) {
                 $selected = " selected";
             }
             if ($fetchQuartiers['nom'] != 'autre') {
                 if ($type == "personne") {
                 } else {
                     $t->assign_block_vars("isNotAjoutSousEvenement.quartiers", array('id' => $fetchQuartiers['idQuartier'], 'nom' => $fetchQuartiers['nom'], 'selected' => $selected));
                 }
             }
         }
     }
     // ***********************************************************************************
     // si on a des personnes selectionnees ,  on les ajoute
     $d = new droitsObject();
     $u = new archiUtilisateur();
     if ($d->isAuthorized('personne_sur_evenement_ajouter', $u->getIdProfilFromUtilisateur($authentification->getIdUtilisateur()))) {
         $t->assign_vars(array("affichePersonnesBlock" => "table-row"));
     } else {
         $t->assign_vars(array("affichePersonnesBlock" => "none"));
     }
     if ($d->isAuthorized('affiche_selection_source', $u->getIdProfilFromUtilisateur($authentification->getIdUtilisateur()))) {
         $t->assign_block_vars('afficheAjoutEvenement.isDisplaySource', array());
     } else {
         $t->assign_block_vars('afficheAjoutEvenement.isNotDisplaySource', array());
     }
     if (count($personnes) > 0) {
         $listePersonnes = implode("', '", $personnes);
         $reqPersonnes = "select idPersonne,  nom,  prenom from personne where idPersonne in ('" . $listePersonnes . "')";
         $resPersonnes = $this->connexionBdd->requete($reqPersonnes);
         while ($fetchPersonnes = mysql_fetch_assoc($resPersonnes)) {
             $t->assign_block_vars('personnes', array('id' => $fetchPersonnes['idPersonne'], 'nom' => $fetchPersonnes['nom'] . ' ' . $fetchPersonnes['prenom'], 'selected' => " selected"));
         }
     }
     // ***********************************************************************************
     // si un idQuartier existe sur le formulaire on affiche les sous quartier correspondants
     if (isset($this->variablesPost['quartiers']) && $this->variablesPost['quartiers'] != '') {
         $resSousQuartiers = $this->connexionBdd->requete("select idSousQuartier,  nom from sousQuartier where idQuartier = '" . $this->variablesPost['quartiers'] . "' order by nom");
         while ($fetchSousQuartiers = mysql_fetch_assoc($resSousQuartiers)) {
             $selected = "";
             if (isset($this->variablesPost['sousQuartiers']) && $this->variablesPost['sousQuartiers'] != '0' && $fetchSousQuartiers['idSousQuartier'] == $this->variablesPost['sousQuartiers']) {
                 $selected = " selected";
             }
             if ($fetchSousQuartiers['nom'] != 'autre') {
                 if ($type == "personne") {
                 } else {
                     $t->assign_block_vars("isNotAjoutSousEvenement.sousQuartiers", array('id' => $fetchSousQuartiers['idSousQuartier'], 'nom' => $fetchSousQuartiers['nom'], 'selected' => $selected));
                 }
             }
         }
     }
     $numLigne = 0;
     if (isset($this->variablesPost['idUnique'])) {
         foreach ($this->variablesPost['idUnique'] as $indice => $valueIdUnique) {
             if (isset($this->variablesGet['supprAdresse']) && $this->variablesGet['supprAdresse'] == $valueIdUnique) {
                 //
             } else {
                 $arrayAdresse[$numLigne]['idAdresse'] = 0;
                 $arrayAdresse[$numLigne]['txt'] = $this->variablesPost['ruetxt'][$valueIdUnique];
                 $arrayAdresse[$numLigne]['id'] = $this->variablesPost['rue'][$valueIdUnique];
                 $arrayAdresse[$numLigne]['numero'] = $this->variablesPost['numero'][$valueIdUnique];
                 $arrayAdresse[$numLigne]['indicatif'] = $this->variablesPost['indicatif'][$valueIdUnique];
                 $numLigne++;
             }
         }
         if (isset($this->variablesPost['ajouterAdresse'])) {
             $arrayAdresse[$numLigne]['idAdresse'] = 0;
             $arrayAdresse[$numLigne]['txt'] = "";
             $arrayAdresse[$numLigne]['id'] = "";
             $arrayAdresse[$numLigne]['numero'] = "";
             $arrayAdresse[$numLigne]['indicatif'] = "";
             $numLigne++;
         }
         if (count($this->variablesPost['idUnique']) == 1 && isset($this->variablesPost['enleverAdresse'])) {
             $arrayAdresse[$numLigne]['idAdresse'] = 0;
             $arrayAdresse[$numLigne]['txt'] = "";
             $arrayAdresse[$numLigne]['id'] = "";
             $arrayAdresse[$numLigne]['numero'] = "";
             $arrayAdresse[$numLigne]['indicatif'] = "";
             $numLigne++;
         }
     } else {
         $arrayAdresse[$numLigne]['idAdresse'] = 0;
         $arrayAdresse[$numLigne]['txt'] = "";
         $arrayAdresse[$numLigne]['id'] = "";
         $arrayAdresse[$numLigne]['numero'] = "";
         $arrayAdresse[$numLigne]['indicatif'] = "";
         $numLigne++;
     }
     $configArrayRetrieveCoordonneesGoogleMap = array();
     for ($i = 0; $i < $numLigne; $i++) {
         // affichage des indicatifs pour chaque adresse
         if ($type == "personne") {
         } else {
             $t->assign_block_vars("isNotAjoutSousEvenement.adresses", array('idUnique' => $i, 'onClickBoutonChoixRue' => "document.getElementById('paramChampAppelantRue').value= 'rue" . $i . "';document.getElementById('iFrameRue').src='" . $this->creerUrl('', 'afficheChoixRue', array('noHeaderNoFooter' => 1)) . "&archiIdVille='+document.getElementById('ville').value+'&archiIdQuartier='+document.getElementById('quartiers').value+'&archiIdSousQuartier='+document.getElementById('sousQuartiers').value;document.getElementById('calqueRue').style.top=(getScrollHeight()+150)+'px';document.getElementById('calqueRue').style.display='block';", "nomRue" => $arrayAdresse[$i]["txt"], "rue" => $arrayAdresse[$i]["id"], "numero" => $arrayAdresse[$i]["numero"], "onClickBoutonSupprAdresse" => "document.getElementById('formAjoutDossier').action='" . $this->creerUrl('', 'ajoutNouveauDossier', array('supprAdresse' => $i)) . "'"));
         }
         // gestion des indicatifs de chaque adresse
         $reqIndicatif = "select idIndicatif,  nom from indicatif";
         $resIndicatif = $this->connexionBdd->requete($reqIndicatif);
         while ($fetchIndicatif = mysql_fetch_assoc($resIndicatif)) {
             $selected = "";
             if (isset($this->variablesPost['indicatif' . $i]) && $this->variablesPost['indicatif' . $i] != '' && $this->variablesPost['indicatif' . $i] == $fetchIndicatif['idIndicatif']) {
                 $selected = " selected";
             }
             if ($type == "personne") {
             } else {
                 $t->assign_block_vars("isNotAjoutSousEvenement.adresses.indicatifs", array("id" => $fetchIndicatif['idIndicatif'], "nom" => $fetchIndicatif['nom'], "selected" => $selected));
             }
         }
         $configArrayRetrieveCoordonneesGoogleMap[$i] = array('nomChampLatitudeRetour' => 'latitude_' . $i, 'nomChampLongitudeRetour' => 'longitude_' . $i, 'getAdresseFromElementById' => true, 'jsAdresseValue' => "document.getElementById('numero" . $i . "').value+' '+document.getElementById('rue" . $i . "txt').value+' '+document.getElementById('villetxt').value", 'jsToExecuteIfNoAddressFound' => "document.getElementById('latitude_" . $i . "').value='';document.getElementById('longitude_" . $i . "').value='';");
     }
     $jsToExecute = "document.getElementById('formAjoutDossier').action='" . $this->creerUrl('ajoutNouveauDossier', '') . "';testAdresseValideAndSubmit('formAjoutDossier');";
     $arrayJsCoordonneesFromGoogleMap = $googleMap->getJSMultipleRetriveCoordonnees(array('jsToExecuteIfOK' => $jsToExecute), $configArrayRetrieveCoordonneesGoogleMap);
     $html .= $arrayJsCoordonneesFromGoogleMap['jsFunctionToExecute'];
     // **************************************************************************************
     // ***********************************************************************************
     // liste des courants architecturaux
     $resCourants = $this->connexionBdd->requete("select idCourantArchitectural, nom from courantArchitectural order by nom");
     $tableauHtml = new tableau();
     while ($fetchCourants = mysql_fetch_assoc($resCourants)) {
         $checked = "";
         if (isset($this->variablesPost["courantArchitectural"]) && in_array($fetchCourants["idCourantArchitectural"], $this->variablesPost["courantArchitectural"])) {
             $checked = " checked";
         }
         $tableauHtml->addValue("<input type='checkbox' name='courantArchitectural[]' value='" . $fetchCourants["idCourantArchitectural"] . "' " . $checked . ">&nbsp;" . $fetchCourants['nom']);
     }
     $t->assign_vars(array('listeCourantsArchitecturaux' => $tableauHtml->createHtmlTableFromArray(3, 'white-space:nowrap;border:1px solid #000000;', 'listeCourantsArchitecturaux')));
     if ($type == "adresse") {
         $t->assign_block_vars("afficheAjoutEvenement.isAddress", array());
         // ***********************************************************************************
         // les des types de structures
         $resTypeStructure = $this->connexionBdd->requete("SELECT idTypeStructure,  nom FROM typeStructure order by nom");
         while ($fetchTypeStructure = mysql_fetch_assoc($resTypeStructure)) {
             $selected = "";
             if ($typeStructure != '' && $typeStructure == $fetchTypeStructure["idTypeStructure"] || $typeStructure == "" && $fetchTypeStructure["idTypeStructure"] == $this->getIdTypeStructureImmeuble()) {
                 $selected = " selected";
             }
             if ($fetchTypeStructure["idTypeStructure"] > 0) {
                 $t->assign_block_vars('afficheAjoutEvenement.isAddress.typesStructure', array('id' => $fetchTypeStructure["idTypeStructure"], 'nom' => $fetchTypeStructure["nom"], 'selected' => $selected));
             }
         }
     }
     // ***********************************************************************************
     // le type de groupe d'evenement
     // 1 - culturel
     // 2 - travaux
     if ($groupeTypeEvenement == '2') {
         $t->assign_vars(array('checkedTypeEvenement2' => " checked"));
         $t->assign_vars(array('styleChampsSupplementaireCulturel' => "display:none;", 'styleChampsSupplementaireTravaux' => "display:block;"));
     } elseif ($groupeTypeEvenement == '1') {
         $t->assign_vars(array('checkedTypeEvenement1' => " checked"));
         $t->assign_vars(array('styleChampsSupplementaireCulturel' => "display:table-row;", 'styleChampsSupplementaireTravaux' => "display:none;"));
     }
     $t->assign_vars(array('onClickTypeEvenement1' => "appelAjax('" . $this->creerUrl('', 'afficheSelectTypeEvenement', array('noHeaderNoFooter' => 1, 'archiTypeGroupeEvenement' => '1')) . "', 'typeEvenement');document.getElementById('afficheChampsSupplementairesCulturel').style.display='block';document.getElementById('afficheChampsSupplementairesTravaux').style.display='none';"));
     $t->assign_vars(array('onClickTypeEvenement2' => "appelAjax('" . $this->creerUrl('', 'afficheSelectTypeEvenement', array('noHeaderNoFooter' => 1, 'archiTypeGroupeEvenement' => '2')) . "', 'typeEvenement');document.getElementById('afficheChampsSupplementairesTravaux').style.display='block';document.getElementById('afficheChampsSupplementairesCulturel').style.display='none';"));
     if ($type == "adresse") {
         // ***********************************************************************************
         // les type d'evenements
         // par defaut on selectionne le typeEvenement=2 (travaux)
         $resTypeEvenement = $this->connexionBdd->requete("SELECT idTypeEvenement, nom FROM typeEvenement where groupe = '" . $groupeTypeEvenement . "'");
         while ($fetchTypeEvenement = mysql_fetch_assoc($resTypeEvenement)) {
             $selected = "";
             if ($typeEvenement != "" && $typeEvenement == $fetchTypeEvenement["idTypeEvenement"]) {
                 $selected = "selected";
             }
             $t->assign_block_vars('afficheAjoutEvenement.isAddress.typesEvenement', array('id' => $fetchTypeEvenement['idTypeEvenement'], 'nom' => $fetchTypeEvenement['nom'], 'selected' => $selected));
         }
     }
     // ***********************************************************************************
     // ISMH   (inscrit au s des monuments historiques)
     // MH (monument historique)
     if ($ISMH) {
         $t->assign_vars(array('ISMHchecked' => ' checked'));
     }
     if ($MH) {
         $t->assign_vars(array('MHchecked' => ' checked'));
     }
     // ***********************************************************************************
     // ***********************************************************************************
     // autre cas pour l'affichage du champ numeroArchive ,  il faut que l'utilisateur soit autorisé à l'afficher => table utilisateur
     $utilisateur = new archiUtilisateur();
     if ($utilisateur->canChangeNumeroArchiveField(array('idUtilisateur' => $authentification->getIdUtilisateur()))) {
         $t->assign_block_vars('afficheAjoutEvenement.canChangeNumeroArchive', array());
     } else {
         $t->assign_block_vars('afficheAjoutEvenement.noChangeNumeroArchive', array());
     }
     // ***********************************************************************************
     // idem champ dateFin
     if ($utilisateur->canChangeDateFinField(array('idUtilisateur' => $authentification->getIdUtilisateur()))) {
         $t->assign_block_vars('afficheAjoutEvenement.canChangeDateFin', array());
     } else {
         $t->assign_block_vars('afficheAjoutEvenement.noChangeDateFin', array());
     }
     $recherche = new archiRecherche();
     $source = new archiSource();
     $onClickBoutonValider = $type == "adresse" ? "affichePopupAttente();" . $arrayJsCoordonneesFromGoogleMap['jsFunctionCall'] : "";
     $typeBoutonValidation = $type == "adresse" ? "button" : "submit";
     $t->assign_vars(array('formAction' => $this->creerUrl($formAction), 'popupCalendrier' => $this->getPopupCalendrier(), 'popupVilles' => $this->getPopupChoixVille('nouveauDossier'), 'popupRues' => $this->getPopupChoixRue('nouveauDossier'), 'popupSources' => $recherche->getPopupChoixSource('nouveauDossier'), 'popupPersonnes' => $recherche->getPopupChoixPersonne('nouveauDossier'), 'onClickBoutonAjouterAdresse' => "document.getElementById('formAjoutDossier').action='" . $this->creerUrl('', 'ajoutNouveauDossier') . "'", 'onClickBoutonEnleverAdresse' => "document.getElementById('formAjoutDossier').action='" . $this->creerUrl('', 'ajoutNouveauDossier') . "'", 'onClickBoutonValider' => $onClickBoutonValider, 'typeBoutonValidation' => $typeBoutonValidation, 'onClickBoutonChoixVille' => "document.getElementById('paramChampAppelantVille').value='ville';document.getElementById('calqueVille').style.top=(getScrollHeight()+150)+'px';document.getElementById('calqueVille').style.display='block';", 'onChangeListeQuartier' => "appelAjax('" . $this->creerUrl('', 'afficheSelectSousQuartier', array('noHeaderNoFooter' => 1)) . "&archiIdQuartier='+document.getElementById('quartiers').value, 'listeSousQuartier')", 'onClickBoutonChoisirSource' => "document.getElementById('paramChampsAppelantSource').value='source';document.getElementById('calqueSource').style.top=(getScrollHeight()+150)+'px';document.getElementById('calqueSource').style.display='block';", 'onClickChoixPersonne' => "document.getElementById('paramChampsAppelantPersonne').value='personnes';document.getElementById('calquePersonne').style.top=(getScrollHeight()+150)+'px';document.getElementById('calquePersonne').style.display='block';", 'onClickDateDebut' => "document.getElementById('paramChampAppelantDate').value='dateDebut';document.getElementById('calqueDate').style.top=(getScrollHeight()+150)+'px';document.getElementById('calqueDate').style.display='block';", 'onClickDateFin' => "document.getElementById('paramChampAppelantDate').value='dateDebut';document.getElementById('calqueDate').style.top=(getScrollHeight()+150)+'px';document.getElementById('paramChampAppelantDate').value='dateFin';document.getElementById('calqueDate').style.display='block';", 'popupAttente' => $this->getPopupAttente()));
     //document.getElementById('formAjoutDossier').action='".$this->creerUrl('ajoutNouveauDossier', '')."';testAdresseValideAndSubmit('formAjoutDossier');
     // ******************************************************************************************************************************
     // on recupere les messages d'aide contextuelle et on les affiche :
     $helpMessages = $this->getHelpMessages("helpEvenement");
     foreach ($helpMessages as $fieldName => $helpMessage) {
         $t->assign_vars(array($fieldName => $helpMessage));
     }
     // ******************************************************************************************************************************
     ob_start();
     $t->pparse('nouveauDossier');
     $html .= ob_get_contents();
     ob_end_clean();
     return $html;
 }
 /**
  * Formulaire
  * 
  * @return string HTML
  * */
 public function afficherFormulaire()
 {
     $html = '';
     $u = new archiUtilisateur();
     $a = new archiAuthentification();
     $t = new Template('modules/archi/templates');
     $t->set_filenames(array('formulaire' => 'sourceFormulaire.tpl'));
     $modeAffichage = '';
     if (isset($this->variablesGet["modeAffichage"]) && $this->variablesGet["modeAffichage"] != '') {
         $modeAffichage = $this->variablesGet["modeAffichage"];
     }
     switch ($modeAffichage) {
         case 'nouveauDossier':
         case 'modifEvenement':
             break;
         default:
             if ($a->estConnecte()) {
                 if ($a->estAdmin()) {
                     $t->assign_block_vars('allowNewType', array());
                 }
             }
             break;
     }
     // action du formulaire
     $t->assign_vars(array('urlAction' => $this->creerUrl('ajouterSource', '', array('noHeaderNoFooter' => 1, 'modeAffichage' => $modeAffichage)), 'boutonAnnulation' => "location.href='" . $this->creerUrl('', 'sourceListe', array('noHeaderNoFooter' => 1, 'modeAffichage' => $modeAffichage)) . "';"));
     // récupération des métiers
     $sql = "SELECT nom,  idTypeSource FROM typeSource";
     $rep = $this->connexionBdd->requete($sql);
     while ($res = mysql_fetch_object($rep)) {
         $t->assign_block_vars('type', array('valeur' => $res->idTypeSource, 'nom' => $res->nom));
     }
     if ($this->erreurs->tabFormExiste()) {
         foreach ($this->erreurs->getErreursFromFormulaire() as $name => $value) {
             $val = htmlspecialchars(stripslashes($value["value"]));
             $t->assign_vars(array($name => $val, $name . "-error" => $value["error"]));
         }
     }
     ob_start();
     $t->pparse('formulaire');
     $html .= ob_get_contents();
     ob_end_clean();
     return $html;
 }
 /**
  * Envoi d'un mail a tous les administrateurs
  * 
  * @param string  $envoyeur                 Emetteur
  * @param string  $sujet                    Sujet
  * @param string  $message                  Message
  * @param $string $criteres                 Criteres
  * @param bool    $writeMailToLogs          ?
  * @param bool    $isEnvoiRegroupeDesactive ?
  * @param string  $logfile                  Fichier de logs
  * 
  * @return void
  * */
 public function sendMailToAdministrators($envoyeur = 'archi-strasbourg', $sujet = '', $message = '', $criteres = '', $writeMailToLogs = false, $isEnvoiRegroupeDesactive = false, $logfile = 'mail.log')
 {
     $replyTo = "";
     if (is_array($envoyeur)) {
         $replyTo = $envoyeur["replyTo"];
         $envoyeur = $envoyeur["envoyeur"];
     }
     // recherche les administrateurs
     $authentification = new archiAuthentification();
     $idUtilisateur = '0';
     if ($authentification->estConnecte()) {
         $idUtilisateur = $authentification->getIdUtilisateur();
     }
     // n'envoi pas le mail si l'utilisateur courant est lui meme admin
     $sqlNoSendToAdmin = "";
     if ($authentification->estAdmin()) {
         $sqlNoSendToAdmin = "and idUtilisateur!='" . $idUtilisateur . "'";
     }
     /* Envoi aux admins dont le compte est actif
      * et la periode d'envoi est "immediate"
      * */
     if ($isEnvoiRegroupeDesactive) {
         $sql = "SELECT mail from utilisateur where idProfil='4'" . " and compteActif='1' " . $criteres . " " . $sqlNoSendToAdmin;
     } else {
         $sql = "SELECT mail from utilisateur where idProfil='4' " . "and compteActif='1' and (idPeriodeEnvoiMailsRegroupes='1' " . "OR idPeriodeEnvoiMailsRegroupes='0') " . $criteres . " " . $sqlNoSendToAdmin;
     }
     $res = $this->connexionBdd->requete($sql);
     while ($fetch = mysql_fetch_assoc($res)) {
         $headers = 'From: "' . $envoyeur . '"<' . $envoyeur . '>' . "\r\nReply-To: " . $replyTo . "\r\nContent-Type: text/html; charset=\"utf-8\"\r\n";
         if (isset($this->isSiteLocal) && $this->isSiteLocal == true) {
             echo "Envoi d'un mail aux administrateurs<br>";
             echo $headers;
             echo "<br>to : " . $fetch['mail'] . "<br>";
             echo "subject : {$sujet}<br>";
             echo "{$message}<br>";
             echo "finMail<br>";
             if ($writeMailToLogs) {
                 $this->saveMailToLogs(array("envoyeur" => $envoyeur, "destinataire" => $fetch['mail'], "sujet" => $sujet, "message" => $message, "debug" => true, 'logfile' => $logfile));
             }
         } else {
             pia_mail($fetch['mail'], $sujet, $message, $headers, null);
             if ($writeMailToLogs) {
                 $this->saveMailToLogs(array("envoyeur" => $envoyeur, "destinataire" => $fetch['mail'], "sujet" => $sujet, "message" => $message, "debug" => false, 'logfile' => $logfile));
             }
         }
     }
 }
Example #8
0
if (!isset($_GET['noHTMLHeaderFooter'])) {
    if (!isset($_GET["noHeaderNoFooter"]) && !isset($_POST["noHeaderNoFooter"])) {
        $footerJS = "";
        if (ArchiConfig::getJsFooter() != '') {
            $footerJS = ArchiConfig::getJsFooter();
        }
        include 'modules/footer/index.php';
    } else {
        $footerJS = "";
        if (ArchiConfig::getJsFooter() != '') {
            $footerJS = ArchiConfig::getJsFooter();
        }
        ?>
		<?php 
        echo $footerJS;
        if (!isset($config->isSiteLocal) || $config->isSiteLocal == false) {
            echo "<script type=\"text/javascript\">\nvar gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTracker(\"UA-16282574-3\");\npageTracker._trackPageview();\n} catch(err) {}</script>";
        }
        ?>
		</body>
		</html><?php 
    }
}
$fin_compte = microtime(true);
$duree = $fin_compte - $microstart;
$authDebug = new archiAuthentification();
if (!isset($_GET['noHTMLHeaderFooter'])) {
    if ($authDebug->estAdmin()) {
        echo '<br><br>Page g&eacute;n&eacute;r&eacute;e en ' . substr($duree, 0, 5) . ' sec.';
    }
}
 public function afficher($idImage = 0)
 {
     $t = new Template('modules/archi/templates/');
     $t->set_filenames(array('detailImage' => 'detailImage.tpl'));
     $adresse = new archiAdresse();
     $evenement = new archiEvenement();
     $authentification = new archiAuthentification();
     $string = new stringObject();
     $u = new archiUtilisateur();
     $d = new droitsObject();
     $html = "";
     if ((isset($this->variablesGet['formatPhoto']) && $this->variablesGet['formatPhoto'] == 'moyenRedim' || isset($this->variablesGet['formatPhoto']) && $this->variablesGet['formatPhoto'] == 'original') && !$authentification->estConnecte()) {
         // il faut etre connecté et donc inscrit pour pouvoir voir les images dans un format different
         $html .= $authentification->afficheFormulaireAuthentification('noCompact', array("msg" => "<b>Pour voir les photos au format moyen ou l'original vous devez être connecté. Si vous n'avez pas encore de compte utilisateur pour vous connecter,  cliquez <a href='" . $this->creerUrl('', 'inscription') . "'>ici</a></b>"));
     } else {
         if ($authentification->estConnecte()) {
             $t->assign_block_vars("isConnected", array());
             $idProfilUtilisateur = $u->getIdProfilFromUtilisateur($authentification->getIdUtilisateur());
             if ($d->isAuthorized('image_supprimer', $idProfilUtilisateur)) {
                 require_once __DIR__ . '/archiPersonne.class.php';
                 $e = new ArchiEvenement();
                 // on verifie que l'utilisateur est moderateur de la ville ou est admin
                 if ($u->isModerateurFromVille($authentification->getIdUtilisateur(), $idImage, 'idImage') || $idProfilUtilisateur == '4' || ArchiPersonne::isPerson($e->getIdEvenementGroupeAdresseFromIdEvenement($_GET['archiRetourIdValue']))) {
                     if (isset($this->variablesGet['archiRetourAffichage'])) {
                         $t->assign_block_vars('isAdminOrModerateurFromVille', array('urlSupprimerImage' => $this->creerUrl('deleteImage', '', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue']))));
                     } else {
                         $t->assign_block_vars('isAdminOrModerateurFromVille', array('urlSupprimerImage' => $this->creerUrl('deleteImage', '', array('archiIdImage' => $idImage))));
                     }
                 }
             }
             if ($authentification->estAdmin()) {
                 if (isset($this->variablesGet['archiRetourAffichage']) && isset($this->variablesGet['archiRetourIdName']) && isset($this->variablesGet['archiRetourIdValue'])) {
                     $t->assign_block_vars('isAdmin', array('urlAfficheHistorique' => $this->creerUrl('', 'afficheHistoriqueImage', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue']))));
                 } else {
                     $t->assign_block_vars('isAdmin', array('urlAfficheHistorique' => $this->creerUrl('', 'afficheHistoriqueImage', array('archiIdImage' => $idImage))));
                 }
             }
         }
         // gestion des liens vers le detail de la photo et autres formats
         if (isset($this->variablesGet["formatPhoto"])) {
             switch ($this->variablesGet["formatPhoto"]) {
                 case 'petit':
                     $classLienPetit = "formatAffichePhotoSelected";
                     $classLienMoyen = "formatAffichePhoto";
                     $classLienOriginal = "formatAffichePhoto";
                     $formatPhoto = "grand";
                     // petit correspond au format 'grand' en interne
                     $formatPhotoUrl = "petit";
                     break;
                 case 'moyenRedim':
                     $classLienPetit = "formatAffichePhoto";
                     $classLienMoyen = "formatAffichePhotoSelected";
                     $classLienOriginal = "formatAffichePhoto";
                     $formatPhoto = "moyenRedim";
                     $formatPhotoUrl = "moyenRedim";
                     break;
                 case 'original':
                     $classLienPetit = "formatAffichePhoto";
                     $classLienMoyen = "formatAffichePhoto";
                     $classLienOriginal = "formatAffichePhotoSelected";
                     $formatPhoto = "originaux";
                     $formatPhotoUrl = "original";
                     break;
             }
         } else {
             $classLienPetit = "formatAffichePhotoSelected";
             $classLienMoyen = "formatAffichePhoto";
             $classLienOriginal = "formatAffichePhoto";
             $formatPhoto = "grand";
             $formatPhotoUrl = "petit";
         }
         if (isset($this->variablesGet['archiRetourAffichage'])) {
             $t->assign_vars(array("choixFormatPhoto" => "<span style='color:#007799;'>Photo au format : <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => $this->variablesGet['archiRetourAffichage'], "archiRetourIdName" => $this->variablesGet['archiRetourIdName'], "archiRetourIdValue" => $this->variablesGet['archiRetourIdValue'], "formatPhoto" => 'petit')) . "' class='{$classLienPetit}'>Petit</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => $this->variablesGet['archiRetourAffichage'], "archiRetourIdName" => $this->variablesGet['archiRetourIdName'], "archiRetourIdValue" => $this->variablesGet['archiRetourIdValue'], "formatPhoto" => 'moyenRedim')) . "' class='{$classLienMoyen}'>Moyen</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => $this->variablesGet['archiRetourAffichage'], "archiRetourIdName" => $this->variablesGet['archiRetourIdName'], "archiRetourIdValue" => $this->variablesGet['archiRetourIdValue'], "formatPhoto" => 'original')) . "' class='{$classLienOriginal}'>Original</a></span><br />"));
         } else {
             $idAdresseRetour = $this->getIdAdresseFromIdImage($idImage);
             $t->assign_vars(array("choixFormatPhoto" => "<span style='color:#007799;'>Photo au format : <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => 'adresseDetail', "archiRetourIdName" => 'archiIdAdresse', "archiRetourIdValue" => $idAdresseRetour, "formatPhoto" => 'petit')) . "' class='{$classLienPetit}'>Petit</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => 'adresseDetail', "archiRetourIdName" => 'archiIdAdresse', "archiRetourIdValue" => $idAdresseRetour, "formatPhoto" => 'moyenRedim')) . "' class='{$classLienMoyen}'>Moyen</a> | <a href='" . $this->creerUrl('', 'imageDetail', array("archiIdImage" => $idImage, "archiRetourAffichage" => 'adresseDetail', "archiRetourIdName" => 'archiIdAdresse', "archiRetourIdValue" => $idAdresseRetour, "formatPhoto" => 'original')) . "' class='{$classLienOriginal}'>Original</a></span><br />"));
         }
         // ***********************************************************************************************************************
         // on prend l'adresse de reference de la page si elle existe sinon celle de l'evenement courant et sinon on prend l'adresse de reference de l'image
         if (isset($this->variablesGet['archiIdAdresse'])) {
             $idAdresseReference = $this->variablesGet['archiIdAdresse'];
         } elseif (isset($this->variablesGet['archiRetourIdName']) && $this->variablesGet['archiRetourIdName'] == 'idEvenement' && isset($this->variablesGet['archiRetourIdValue'])) {
             $idAdresseReference = $adresse->getIdAdresseFromIdEvenementGroupeAdresse($this->variablesGet['archiRetourIdValue']);
         } else {
             $idAdresseReference = $this->getIdAdresseFromIdImage($idImage);
         }
         // **********************************************************************************************************************
         $arrayInfosImage = $this->getInfosCompletesFromIdImage($idImage, array('idAdresseReference' => $idAdresseReference, 'displayFirstTitreAdresse' => true, 'classCSSTitreAdresse' => "textePrisDepuisVueSur", 'withZonesOnMouseOver' => true));
         if (count($arrayInfosImage['vueSurLiens']) > 0) {
             if (count($arrayInfosImage['vueSurLiens']) > 1) {
                 $t->assign_vars(array("infosVueSur" => "<span class='textePrisDepuisVueSurEntete'>Vue sur :</span>&nbsp;<br>" . implode("<br>", $arrayInfosImage['vueSurLiens']) . "<br>"));
             } else {
                 $t->assign_vars(array("infosVueSur" => "<span class='textePrisDepuisVueSurEntete'>Vue sur </span>&nbsp;" . implode(" / ", $arrayInfosImage['vueSurLiens']) . "<br>"));
             }
         }
         if (count($arrayInfosImage['prisDepuisLiens']) > 0) {
             $t->assign_vars(array("infosPrisDepuis" => "<br><span class='textePrisDepuisVueSurEntete'>Pris depuis</span>&nbsp; " . implode(" / ", $arrayInfosImage['prisDepuisLiens']) . "<br>"));
         }
         $e = new archiEvenement();
         if (archiPersonne::isPerson($e->getIdEvenementGroupeAdresseFromIdEvenement($_GET["archiRetourIdValue"]))) {
             $resImage = $this->connexionBdd->requete("SELECT * FROM `historiqueImage` WHERE `idImage` =" . $idImage . ' ORDER BY idHistoriqueImage DESC');
         } else {
             $resImage = $this->connexionBdd->requete("SELECT * FROM `historiqueImage` WHERE `idImage` = {$idImage}\n                    ORDER BY idHistoriqueImage DESC");
             /*$resImage = $this->connexionBdd->requete("
                             select hI.idSource,  hI.nom, hI.dateUpload, hI.dateCliche, hI.description, hI.idUtilisateur, hI.idHistoriqueImage, ha1.idAdresse as idAdresse, ha1.numero as numero,
                             hI.isDateClicheEnviron as isDateClicheEnviron,
                             r.nom as nomRue,
                             sq.nom as nomSousQuartier,
                             q.nom as nomQuartier,
                             v.nom as nomVille,
                             p.nom as nomPays,
                             ha1.numero as numeroAdresse,
                             hI.numeroArchive as numeroArchive,
                             ha1.idRue,
                             r.prefixe as prefixeRue,
                             IF (ha1.idSousQuartier != 0,  ha1.idSousQuartier,  r.idSousQuartier) AS idSousQuartier,
                             IF (ha1.idQuartier != 0,  ha1.idQuartier,  sq.idQuartier) AS idQuartier,
                             IF (ha1.idVille != 0,  ha1.idVille,  q.idVille) AS idVille,
                             IF (ha1.idPays != 0,  ha1.idPays,  v.idPays) AS idPays
             
                             from historiqueImage hI2, historiqueImage hI
             
                             RIGHT JOIN _evenementImage ei ON ei.idImage = hI.idImage
                             RIGHT JOIN _evenementEvenement ee ON ee.idEvenementAssocie = ei.idEvenement
                             RIGHT JOIN _adresseEvenement ae ON ae.idEvenement = ee.idEvenement
                             RIGHT JOIN historiqueAdresse ha1 ON ha1.idAdresse = ae.idAdresse
                             RIGHT JOIN historiqueAdresse ha2 ON ha2.idAdresse = ha1.idAdresse
             
             
                             LEFT JOIN rue r         ON r.idRue = ha1.idRue
                             LEFT JOIN sousQuartier sq    ON sq.idSousQuartier = if (ha1.idRue='0' and ha1.idSousQuartier!='0' , ha1.idSousQuartier , r.idSousQuartier )
                             LEFT JOIN quartier q        ON q.idQuartier = if (ha1.idRue='0' and ha1.idSousQuartier='0' and ha1.idQuartier!='0' , ha1.idQuartier , sq.idQuartier )
                             LEFT JOIN ville v        ON v.idVille = if (ha1.idRue='0' and ha1.idSousQuartier='0' and ha1.idQuartier='0' and ha1.idVille!='0' , ha1.idVille , q.idVille )
                             LEFT JOIN pays p        ON p.idPays = if (ha1.idRue='0' and ha1.idSousQuartier='0' and ha1.idQuartier='0' and ha1.idVille='0' and ha1.idPays!='0' , ha1.idPays , v.idPays )
             
             
             
             
                             where hI.idImage='$idImage'
                             and hI2.idImage=hI.idImage
                             group by hI.idImage, hI.idHistoriqueImage, ha1.idAdresse,  ha1.idHistoriqueAdresse
                             having hI.idHistoriqueImage = max(hI2.idHistoriqueImage) and ha1.idHistoriqueAdresse = max(ha2.idHistoriqueAdresse)
                             LIMIT 1
                             ");*/
         }
         $fetch = mysql_fetch_array($resImage);
         /*
         stripslashes($fetch['nom'])
          $this->date->toFrench($fetch['dateCliche'])
         */
         $nomEtDateCliche = "";
         if (stripslashes($fetch['nom']) != '' && $this->date->toFrench($fetch['dateCliche']) != '') {
             $nomEtDateCliche = stripslashes($fetch['nom']) . ' - ' . $this->date->toFrench($fetch['dateCliche']);
         } else {
             $nomEtDateCLiche = stripslashes($fetch['nom']) . $this->date->toFrench($fetch['dateCliche']);
         }
         // on affiche les deux car on sait qu'il y en a un qui est vide,  donc pas de probleme
         $datePriseDeVue = "";
         if ($this->date->toFrench($fetch['dateCliche']) != '') {
             $environ = "";
             if ($fetch['isDateClicheEnviron'] == '1') {
                 $environ = "environ ";
             }
             $datePriseDeVue = "Date : {$environ}" . $this->date->toFrench($fetch['dateCliche']);
         }
         $description = $fetch['description'];
         $bbCode = new bbCodeObject();
         //$bbCode = new bbCodeObject();
         if (!empty($description)) {
             $description = $bbCode->convertToDisplay(array('text' => $description));
         }
         if (isset($fetch['idSource']) && $fetch['idSource'] != '' && $fetch['idSource'] != '0') {
             $reqSource = "\n                    SELECT s.idSource as idSource,  s.nom as nomSource,  ts.nom as nomTypeSource\n                    FROM source s\n                    LEFT JOIN typeSource ts ON ts.idTypeSource = s.idTypeSource\n                    WHERE s.idSource = '" . $fetch['idSource'] . "'";
             $resSource = $this->connexionBdd->requete($reqSource);
             $fetchSource = mysql_fetch_assoc($resSource);
             $description .= "<br>Source : <a href='" . $this->creerUrl('', 'listeAdressesFromSource', array('source' => $fetch['idSource'], 'submit' => 'Rechercher')) . "'>" . stripslashes($fetchSource['nomSource']) . " (" . stripslashes($fetchSource['nomTypeSource']) . ")</a>";
         }
         if (isset($fetch['numeroArchive']) && $fetch['numeroArchive'] != '') {
             // modif fabien du 15/04/2011 suite mail directrice Archives de Strasbourg Mme Perry Laurence
             $description .= "<br>Cote Archives de Strasbourg : " . $fetch['numeroArchive'];
         }
         $intituleAdresse = $adresse->getIntituleAdresse($fetch);
         $reqImages = "\n            SELECT idImage FROM _evenementImage WHERE idEvenement = " . mysql_real_escape_string($_GET['archiRetourIdValue']) . " ORDER BY position\n            ";
         $resImages = $this->connexionBdd->requete($reqImages);
         $found = false;
         while ($row = mysql_fetch_assoc($resImages)) {
             if (intval($row['idImage']) == $_GET['archiIdImage']) {
                 if (isset($prev)) {
                     $prevImage = $prev;
                     $t->assign_block_vars('previous', array());
                 }
                 $next = true;
             } else {
                 if (isset($next)) {
                     $nextImage = $row;
                     $t->assign_block_vars('next', array());
                     break;
                 }
             }
             $prev = $row;
         }
         $reqImages = "\n            SELECT idImage FROM _evenementImage  WHERE idEvenement = " . mysql_real_escape_string($_GET['archiRetourIdValue']) . " ORDER BY position\n            ";
         $resImages = $this->connexionBdd->requete($reqImages);
         $imgList = array();
         while ($row = mysql_fetch_row($resImages)) {
             $reqImage = '
             SELECT idHistoriqueImage, dateUpload, description, idImage
             FROM historiqueImage
             WHERE idImage = ' . mysql_real_escape_string($row[0]) . '
             ORDER BY idHistoriqueImage DESC
             LIMIT 1';
             $resImage = $this->connexionBdd->requete($reqImage);
             $imgList[] = mysql_fetch_row($resImage);
         }
         $intituleAdresseNoQuartierNoVille = $adresse->getIntituleAdresse($fetch, array('noQuartier' => true, 'noSousQuartier' => true, 'noVille' => true));
         $format = isset($_GET['formatPhoto']) ? $_GET['formatPhoto'] : 'petit';
         if ($u->canModifyTags(array('idUtilisateur' => $authentification->getIdUtilisateur()))) {
             $tags = 'Tags&nbsp;: ';
             if (empty($fetch["tags"])) {
                 $tags .= '<i>(aucun)</i>';
             } else {
                 $tags .= stripslashes($fetch["tags"]);
             }
         } else {
             $tags = '';
         }
         $t->assign_vars(array('datePriseDeVue' => $datePriseDeVue, 'cheminDetailImage' => 'photos-' . $string->convertStringToUrlRewrite($intituleAdresse) . '-' . $fetch['dateUpload'] . '-' . $fetch['idHistoriqueImage'] . '-' . $formatPhoto . '.jpg', 'nomEtDateCliche' => $nomEtDateCliche, 'tags' => $tags, 'description' => $description, 'fullscreenDesc' => strip_tags($description), 'nom' => $intituleAdresseNoQuartierNoVille, 'IDDivImage' => "divImage_" . $idImage, 'IDDivZones' => "divZones_" . $idImage, 'nextURL' => $this->creerUrl('', 'imageDetail', array('archiIdImage' => $nextImage['idImage'], 'archiRetourAffichage' => 'evenement', 'archiRetourIdName' => 'idEvenement', 'archiRetourIdValue' => $_GET['archiRetourIdValue'], "formatPhoto" => $format)), 'prevURL' => $this->creerUrl('', 'imageDetail', array('archiIdImage' => $prevImage['idImage'], 'archiRetourAffichage' => 'evenement', 'archiRetourIdName' => 'idEvenement', 'archiRetourIdValue' => $_GET['archiRetourIdValue'], "formatPhoto" => $format)), 'list' => rawurlencode(json_encode($imgList)), 'imgID' => rawurlencode(json_encode(array($fetch['idHistoriqueImage'], $fetch['idImage']))), 'imgDate' => $fetch['dateUpload'], 'orgId' => $fetch['idImage'], 'format' => $format));
         //$this->urlImagesGrand.$fetch['dateUpload'].'/'.$fetch['idHistoriqueImage'].".jpg"
         // si affichage du detail sans modification ,  on affiche les zones cliquables
         // pour la selection de zone modifiable
         // on ne l'affiche que si l'image figure dans la table _adresseImage et comporte des adresses sur lesquelles le champ vueSur est a 1
         if (count($arrayInfosImage['vueSurLiens']) > 0 && $authentification->estConnecte() && $u->isAuthorized('selection_zones_photo', $authentification->getIdUtilisateur())) {
             if ($u->getIdProfil($authentification->getIdUtilisateur()) == 4 || $u->isModerateurFromVille($authentification->getIdUtilisateur(), $idImage, 'idImage')) {
                 $styleMenuZoneSelection = "";
                 if (isset($this->variablesGet['archiSelectionZone']) && $this->variablesGet['archiSelectionZone'] == '1') {
                     // menu en rouge si on est sur la selection de zone
                     $styleMenuZoneSelection = "color:#FF0000;";
                 }
                 $t->assign_block_vars('selectionZonesCliquables', array('styleMenuZoneSelection' => $styleMenuZoneSelection, 'urlSelectionZone' => $this->creerUrl('', 'imageDetail', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue'], 'archiSelectionZone' => 1, 'formatPhoto' => $formatPhotoUrl))));
             }
         }
         $authentifie = new archiAuthentification();
         // gestion du lien de retour à la page précédente
         if (isset($this->variablesGet['archiRetourAffichage']) && isset($this->variablesGet['archiRetourIdName']) && isset($this->variablesGet['archiRetourIdValue'])) {
             //$t->assign_block_vars('isRetour',  array('urlRetour'=>$this->creerUrl('',  $this->variablesGet['archiRetourAffichage'],  array($this->variablesGet['archiRetourIdName']=>$this->variablesGet['archiRetourIdValue']))));
             // affichage de l'encars des adresses
             $idEvenementGroupeAdresse = $evenement->getIdEvenementGroupeAdresseFromIdEvenement($this->variablesGet['archiRetourIdValue']);
             if ($idPerson = archiPersonne::isPerson($idEvenementGroupeAdresse)) {
                 $person = new archiPersonne();
                 $infos = $person->getInfosPersonne($idPerson);
                 $html .= "<h2 class='h1'><a href='" . $this->creerUrl('', '', array('archiAffichage' => 'evenementListe', 'selection' => "personne", 'id' => $idPerson)) . "'>" . $infos["prenom"] . " " . $infos["nom"] . "</a></h2>";
             } else {
                 $html .= $adresse->afficherRecapitulatifAdresses($idEvenementGroupeAdresse);
             }
             $t->assign_vars(array('urlModifierImage' => $this->creerUrl('', 'modifierImage', array('archiIdImageModification' => $idImage, 'archiIdEvenementGroupeAdresseAffichageAdresse' => $idEvenementGroupeAdresse))));
         } elseif (isset($idAdresseRetour) && $idAdresseRetour != '' && $idAdresseRetour != '0') {
             $resIdGroupeAdresse = $adresse->getIdEvenementGroupeAdresseFromAdresse($idAdresseRetour);
             $fetchIdGroupeAdresse = mysql_fetch_assoc($resIdGroupeAdresse);
             $html .= $adresse->afficherRecapitulatifAdresses($fetchIdGroupeAdresse['idEvenement']);
             $t->assign_vars(array('urlModifierImage' => $this->creerUrl('', 'modifierImage', array('archiIdImageModification' => $idImage, 'archiIdEvenementGroupeAdresseAffichageAdresse' => $fetchIdGroupeAdresse['idEvenement']))));
         } else {
             $t->assign_vars(array('urlModifierImage' => $this->creerUrl('', 'modifierImage', array('archiIdImageModification' => $idImage))));
         }
         // ***********************************************************************************************************************
         if (isset($this->variablesGet['archiRetourIdName']) && $this->variablesGet['archiRetourIdName'] == 'idEvenement' && isset($this->variablesGet['archiRetourIdValue'])) {
             $reqVerifZone = "\n                    SELECT 0\n                    FROM _adresseImage ai\n                    WHERE\n                        ai.idImage='" . $idImage . "'\n                    AND ai.idEvenementGroupeAdresse = '" . $this->variablesGet['archiRetourIdValue'] . "'\n                    AND vueSur='1'\n                    AND ai.coordonneesZoneImage<>''\n                    AND ai.largeurBaseZoneImage<>''\n                    AND ai.longueurBaseZoneImage<>''\n\n                ";
             $resVerifZone = $this->connexionBdd->requete($reqVerifZone);
             if (mysql_num_rows($resVerifZone) > 0) {
                 $imageZoom = $this->getUrlRacine() . "imageZoomZone.php?idImage=" . $idImage . "&idEvenementGroupeAdresse=" . $this->variablesGet['archiRetourIdValue'] . "&idAdresseCourante=" . $idAdresseReference . "&date=" . $fetch['dateUpload'] . "&idHistorique=" . $fetch['idHistoriqueImage'];
                 $t->assign_vars(array('imageZoom' => "<img src='{$imageZoom}' alt=''>"));
                 $t->assign_vars(array('txtZoom' => "<br>" . _("L'image ci-dessus est un zoom de l'image ci-dessous :")));
             }
         }
         $licence = $this->getLicence($idImage);
         $textLicence = "<img src='images/licences/" . $licence["logo"] . "' alt=''/> ";
         if (!empty($licence["link"])) {
             $textLicence .= "<a rel='license' href='" . $licence["link"] . "'>";
         }
         $textLicence .= $licence["name"];
         if (!empty($licence["link"])) {
             $textLicence .= "</a>";
         }
         $auteur = $this->getAuteur($idImage);
         if (is_array($auteur)) {
             if (!empty($auteur["nom"]) && $auteur["nom"] != " ") {
                 $textLicence .= " (<span itemprop='author'><a rel='author' href='profil-" . $auteur["id"] . ".html'>" . $auteur["nom"] . "</a></span>)";
             }
         } else {
             $textLicence .= " (<span itemprop='author'>" . $auteur . "</span>)";
         }
         $t->assign_vars(array("licence" => $textLicence));
         // ***********************************************************************************************************************
         ob_start();
         $t->pparse('detailImage');
         $html .= ob_get_contents();
         ob_end_clean();
         $image = new imageObject();
         $html .= $image->getJsSetOpacityFunction();
         $html .= $image->getJsCodeDrawFunctions();
         if (isset($this->variablesGet['archiSelectionZone']) && $this->variablesGet['archiSelectionZone'] == '1') {
             // recuperation des longueur et largeur de l'image affiché pour avoir le rapport de base entre ces deux dimensions,  comme cela on pourra reporter les zones sur les images d'autres longueurs et largeurs grace au taux calculé
             $calque = new calqueObject(array('idPopup' => 'popupSelectAdresseVueSurZone'));
             // calque de selection d'adresse une fois que la zone est selectionnee
             $html .= $calque->getDiv(array('height' => 300, 'lienSrcIFrame' => $this->creerUrl('', 'affichePopupSelectionZoneVueSur', array("noHeaderNoFooter" => '1', "archiIdImage" => $idImage)), "titre" => "Selectionnez l'adresse de la zone", "codeJsFermerButton" => "location.href=location.href;"));
             $html .= "<script  >" . $calque->getJsToDragADiv() . "</script>";
             // fonctions de trace,  obligatoire si on veut afficher les zones
             $html .= $image->getJsCodeSelectionZone(array('nomIDImage' => 'divImage', 'tracePolygoneResultat' => true, 'onZoneSelectedAction' => "\n                                        document.getElementById('" . $calque->getJSDivId() . "').style.display='block';\n                                        imageElement = document.getElementById('imageAfficheeID');\n                                        document.getElementById('largeurBaseImageZoneSelection').value=imageElement.clientWidth;\n                                        document.getElementById('longueurBaseImageZoneSelection').value=imageElement.clientHeight;\n                                ", 'addHTMLElementsToFormValidatedAfterZoneSelection' => "<input type='hidden' id='idAdresseRetourZone' name='idAdresseRetourZone' value=''>\n                                <input type='hidden' name='largeurBaseImageZoneSelection' id='largeurBaseImageZoneSelection' value=''>\n                                <input type='hidden' name='longueurBaseImageZoneSelection' id='longueurBaseImageZoneSelection' value=''>\n                                ", 'actionFormValidateZone' => $this->creerUrl('enregistreZoneImage', 'imageDetail', array('archiIdImage' => $idImage, 'archiRetourAffichage' => $this->variablesGet['archiRetourAffichage'], 'archiRetourIdName' => $this->variablesGet['archiRetourIdName'], 'archiRetourIdValue' => $this->variablesGet['archiRetourIdValue']))));
         }
         // affichage des zones existantes,  map sur l'image et divs des formes
         if ($formatPhoto == 'moyenRedim') {
             // vu que le format de la photo moyenRedim est generé a la volée,  il faut calculer les hauteurs et largeurs en fonction d'une autre photo. Ici on prendra le format grand c'est suffisamment precis pas besoin de prendre le format original
             // les photos redimensionnées ont une largeur X de 700px ,  voir le htaccess
             $sizes = getimagesize($this->getCheminPhysiqueImage("grand") . $fetch['dateUpload'] . "/" . $fetch['idHistoriqueImage'] . ".jpg");
             // on converti les dimensions
             $sizeX = 0;
             $sizeY = 0;
             if ($sizes[0] >= $sizes[1]) {
                 $sizeX = 700;
                 $sizeY = round(700 * $sizes[0] / $sizes[1]);
             } else {
                 $sizeY = 700;
                 $sizeX = round(700 * $sizes[1] / $sizes[0]);
             }
             $arrayZones = $this->getDivsAndMapsZonesImagesVueSur(array("idImage" => $idImage, 'largeurImageCourante' => $sizeX, 'longueurImageCourante' => $sizeY));
         } else {
             $sizes = getimagesize($this->getCheminPhysique() . "images/" . $formatPhoto . "/" . $fetch['dateUpload'] . "/" . $fetch['idHistoriqueImage'] . ".jpg");
             $arrayZones = $this->getDivsAndMapsZonesImagesVueSur(array("idImage" => $idImage, 'largeurImageCourante' => $sizes[0], 'longueurImageCourante' => $sizes[1]));
         }
         $html .= $arrayZones['htmlDivs'];
         $html .= $arrayZones['htmlMaps'];
         $html .= $arrayZones['htmlJs'];
     }
     return $html;
 }