/** * Get the last news * @param unknown $params * @return string html of the last news encarts */ public function getActualites($params = array()) { $tActualites = new Template($this->getCheminPhysique() . $this->cheminTemplates); $tActualites->set_filenames(array('encartActualites' => 'encartAccueil.tpl')); $tActualites->assign_vars(array('titre' => _("Actualités"), "type" => "actualites")); $i = 0; if (count($params['actualites']) > 0) { $tActualites->assign_vars(array('lienVersTout' => "<a href='" . $this->creerUrl('', 'toutesLesActualites', array()) . "'>" . _("Toutes les actualités") . "</a>")); } // s'il y a un parcours plus récent que la derniere actu , on affiche le parcours comme une actualité ( ...je sais mais bon , va comprendre....) $reqDateDerniereActualite = "SELECT max(date) as maxDate FROM actualites WHERE desactive<>'1'"; $resDateDerniereActualite = $this->connexionBdd->requete($reqDateDerniereActualite); $indiceGlobalNbActu = 0; $isParcoursToDisplay = false; // est ce que l'on va afficher un parcours plutot qu'une actu en place principale sur l'encars des actus if (mysql_num_rows($resDateDerniereActualite) > 0) { $fetchDateDerniereActualite = mysql_fetch_assoc($resDateDerniereActualite); $dateActu = $fetchDateDerniereActualite['maxDate']; // voyons maintenant s'il y a un parcours ajouté actif plus recent $reqParcoursActif = "SELECT idParcours, dateAjoutParcours, libelleParcours, commentaireParcours FROM parcoursArt WHERE dateAjoutParcours>'" . $dateActu . "' AND isActif='1' ORDER BY dateAjoutParcours DESC, idParcours DESC LIMIT 1"; $resParcoursActif = $this->connexionBdd->requete($reqParcoursActif); if (mysql_num_rows($resParcoursActif) > 0) { $isParcoursToDisplay = true; $fetchParcoursActif = mysql_fetch_assoc($resParcoursActif); // recuperation d'une photo appartenant a une adresse du parcours (en principe dans le meilleur des cas la premiere photo de la premiere etape) $reqEtapes = "SELECT idEtape, commentaireEtape FROM etapesParcoursArt WHERE idParcours = '" . $fetchParcoursActif['idParcours'] . "'"; $resEtapes = $this->connexionBdd->requete($reqEtapes); if (mysql_num_rows($resEtapes) > 0) { $trouvePhoto = false; while (!$trouvePhoto && ($fetchEtape = mysql_fetch_assoc($resEtapes))) { $arrayPhoto = $adresse->getPhotoFromEtape(array('idEtape' => $fetchEtape['idEtape'], 'format' => 'moyen')); $trouvePhoto = $arrayPhoto['trouve']; } mysql_data_seek($resEtapes, 0); $commentaire = ""; if ($fetchParcoursActif['commentaireParcours'] != '') { $bbCode = new bbCodeObject(); $trouveCommentaire = true; $commentaire = $bbCode->convertToDisplay(array('text' => $fetchParcoursActif['commentaireParcours'])); } else { $trouveCommentaire = false; } while (!$trouveCommentaire && ($fetchEtape = mysql_fetch_assoc($resEtapes))) { if ($fetchEtape['commentaireEtape'] != '') { $trouveCommentaire = true; $commentaire = $fetchEtape['commentaireEtape']; } } if ($trouvePhoto) { $s = new stringObject(); // si une photo pour le dernier parcours a ete trouvee , alors on affiche le parcours en actu principale $i = 1; // pour que la boucle des actus commence a 1 et ne remplace pas l'actu principale $indiceGlobalNbActu = 1; // pour que l'on affiche pas la derniere actu ramenee par la fonction sinon il y en aurait une de plus que dans les autres encars $urlImage = $arrayPhoto['url']; $url = $this->creerUrl('', 'detailParcours', array('archiIdParcours' => $fetchParcoursActif['idParcours'])); $dimensionImage = ""; $tActualites->assign_block_vars("premiereAdresseAvecPhoto", array()); $tActualites->assign_vars(array("photoAdresse1" => "<a href='" . $url . "'><img alt='' style='border:1px #000000 solid;margin-right:2px;float:left;' src='" . $urlImage . "' {$dimensionImage} ></a>", "descriptionAdresse1" => "<a href='" . $url . "'>" . $d->toFrenchAffichage($fetchParcoursActif['dateAjoutParcours']) . " " . stripslashes($fetchParcoursActif['libelleParcours']) . "</a><br>" . $s->coupureTexte($s->sansBalisesHtml(stripslashes($commentaire)), 10) . "<br>" . mysql_num_rows($resEtapes) . " étapes... <a href='" . $url . "' style='font-size:11px;'>lire la suite</a>")); } } } } foreach ($params['actualites'] as $indice => $value) { if ($indiceGlobalNbActu < 5) { if ($i == 0) { // premiere actualite @(list($w, $h) = getimagesize($this->getCheminPhysique() . "images/actualites/" . $value['idActualite'] . "/" . $value['photoIllustration'])); if ($w > $h) { $dimensionImage = "width=130"; // modif par fabien pour que l'image soit au même format que les autres rubriques (01/02/2013) } else { $dimensionImage = "height=130"; } $urlImage = $this->getUrlRacine() . "images/actualites/" . $value['idActualite'] . "/" . $value['photoIllustration']; if ($value['urlFichier'] != '') { $url = $value['urlFichier']; } else { $url = $this->creerUrl('', 'afficherActualite', array('archiIdActualite' => $value['idActualite'])); } $tActualites->assign_block_vars("premiereAdresseAvecPhoto", array()); $tActualites->assign_vars(array("photoAdresse1" => "<a href='" . $url . "'><img alt='' style='border:1px #000000 solid;margin-right:2px;float:left;' src='" . $urlImage . "' {$dimensionImage}></a>", "descriptionAdresse1" => "<a href='" . $url . "'>" . $d->toFrenchAffichage($value['date']) . " " . stripslashes($value['titre']) . "</a><br>" . stripslashes($string->coupureTexte($string->sansBalisesHtml($value['texte']), 20)) . " <a href='" . $url . "' style='font-size:11px;'>lire la suite</a>")); } else { if ($value['urlFichier'] != '') { $url = $value['urlFichier']; } else { $url = $this->creerUrl('', 'afficherActualite', array('archiIdActualite' => $value['idActualite'])); } // by fabien le 23/03/2012 : ajout de stripslashes pour virer les \ sur la page d'acceuil $tActualites->assign_block_vars('listeAdressesSuivantes', array('lien' => "<a style='font-size:12px;' href='" . $url . "'><span class='date'>" . $d->toFrenchAffichage($value['date']) . "</span> " . stripslashes($value['titre']) . "</a>")); } $i++; } $indiceGlobalNbActu++; } ob_start(); $tActualites->pparse('encartActualites'); $htmlActualites = ob_get_contents(); ob_end_clean(); return $htmlActualites; }
public function getParcoursListe($params = array()) { $html = ""; $page = new archiPage(9, LANG); // liste des parcours $html .= '<h2>' . $page->title . '</h2>'; $resParcours = $this->getMysqlParcours(array('sqlOrderBy' => 'ORDER BY dateAjoutParcours DESC, idParcours DESC')); $t = new tableau(); if (mysql_num_rows($resParcours) == 0) { $html .= "Aucun parcours n'est disponible pour le moment."; } $s = new stringObject(); $html .= stripcslashes($page->content); $i = 0; while ($fetchParcours = mysql_fetch_assoc($resParcours)) { $photoTrouvee = false; $photo = " "; $urlParcours = $this->creerUrl('', 'detailParcours', array('archiIdParcours' => $fetchParcours['idParcours'])); //if($i==0) //{ // recuperation des etapes pour afficher la premiere photo rencontree $reqEtapes = "SELECT idEtape, commentaireEtape FROM etapesParcoursArt WHERE idParcours='" . $fetchParcours['idParcours'] . "'"; $resEtapes = $this->connexionBdd->requete($reqEtapes); $commentaire = ""; $isCommentaire = false; if (mysql_num_rows($resEtapes) > 0) { while (!$photoTrouvee && ($fetchEtapes = mysql_fetch_assoc($resEtapes))) { $arrayPhoto = $this->getPhotoFromEtape(array('idEtape' => $fetchEtapes['idEtape'])); if ($arrayPhoto['trouve'] == true) { $photoTrouvee = true; $photo = "<a href='" . $urlParcours . "'><img src='" . $arrayPhoto['url'] . "' border=0></a>"; } if (!$isCommentaire) { if ($fetchEtapes['commentaireEtape'] != '') { $commentaire = $fetchEtapes['commentaireEtape']; $isCommentaire = true; } } } } //} $t->addValue($photo); $t->addValue("<a href='" . $urlParcours . "'>" . stripslashes($fetchParcours['libelleParcours']) . "</a><br>" . $s->coupureTexte($s->sansBalisesHtml(stripslashes($commentaire)), 10) . "<br>" . mysql_num_rows($resEtapes) . " étapes"); $i++; } $html .= $t->createHtmlTableFromArray(2); return $html; }
/** * Afficher la gestion des étapes d'un parcours * * @param array $params Paramètres * * @return string HTML * */ public function getHtmlGestionEtapesParcours($params = array()) { $html = "<h1>Gestion des étapes du parcours</h1>"; $idParcours = 0; if (isset($this->variablesGet['archiIdParcours']) && $this->variablesGet['archiIdParcours'] != '') { $f = new formGenerator(); $a = new archiAdresse(); $bbCode = new bbCodeObject(); $s = new stringObject(); $formName = 'formGestionEtapes'; $popupChoixAdresses = new calqueObject(array('idPopup' => 'popupChoixAdresses')); $popupVisualisationGoogleMap = new calqueObject(array('idPopup' => 'popupVisualisationGoogleMap')); $idParcours = $this->variablesGet['archiIdParcours']; $reqNbEtapes = "SELECT idEtape FROM etapesParcoursArt WHERE idParcours = '" . $idParcours . "'"; $resNbEtapes = $this->connexionBdd->requete($reqNbEtapes); $html .= "<br>nombre d'étapes : " . mysql_num_rows($resNbEtapes) . "<br>"; $reqListeEtapes = "SELECT idEtape,idEvenementGroupeAdresse,position,commentaireEtape FROM etapesParcoursArt WHERE idParcours = '" . $idParcours . "' ORDER BY position ASC,idEtape ASC"; $resListeEtapes = $this->connexionBdd->requete($reqListeEtapes); $listeTriableObject = new imageObject(); // dans l'objet image , il y a une fonction qui permet de creer des listes triables par drag and drop $html .= "<script>" . $listeTriableObject->getJSFunctionsDragAndDrop() . "</script>"; $i = 0; $arrayListeEtapes = array(); while ($fetchListeEtapes = mysql_fetch_assoc($resListeEtapes)) { $arrayListeEtapes[$i]['idEtape'] = array('value' => $fetchListeEtapes['idEtape'], 'type' => 'identifiant'); $arrayListeEtapes[$i]['#'] = array('value' => $i + 1, 'type' => 'free'); $arrayListeEtapes[$i][' '] = array('value' => "<a href='" . $this->creerUrl('', 'etapesParcoursFormulaire', array('archiIdEtape' => $fetchListeEtapes['idEtape'], 'archiIdParcours' => $idParcours)) . "'>" . $fetchListeEtapes['idEtape'] . "</a>", 'type' => 'free', 'widthColonne' => 50); $arrayListeEtapes[$i]['adresse'] = array('value' => $a->getIntituleAdresseFrom($fetchListeEtapes['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse', array('setSeparatorAfterTitle' => '<br>', 'displayFirstTitreAdresse' => true, 'noVille' => true, 'noQuartier' => true, 'noSousQuartier' => true)), 'type' => 'free', 'widthColonne' => 250); $arrayListeEtapes[$i]['commentaire'] = array('type' => 'free', 'widthColonne' => 400, 'value' => $s->coupureTexte($s->sansBalisesHtml(stripslashes($fetchListeEtapes['commentaireEtape'])), 10)); $coords = $a->getCoordonneesFrom($fetchListeEtapes['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse'); $i++; } $boutonValidationOrdreEtapes = "<input type='button' name='validationOrdreAffichage' value='Validation ordre des étapes' onclick=\"document.getElementById('" . $formName . "').action='" . $this->creerUrl('enregistrerOrdreEtapesParcours', 'etapesParcoursFormulaire', array('archiIdParcours' => $idParcours)) . "';" . $listeTriableObject->getJSSubmitDragAndDrop() . "document.getElementById('" . $formName . "').submit();\">"; $html .= $listeTriableObject->createSortableFormListeFromArray($arrayListeEtapes, array('styleEntete' => 'font-weight:bold;background-color:#007799;color:#FFFFFF;')) . $boutonValidationOrdreEtapes; $sousTitre = "Ajout d'une étape"; $idEtape = 0; $libelleAdresse = ''; $commentaireEtape = ''; $idAdresse = ''; $idEvenementGroupeAdresse = 0; $boutonNouveau = ""; $boutonVisualisation = "<input type='button' name='visualisation' value='Visualiser' onclick=\"" . $popupVisualisationGoogleMap->getJSOpenPopup() . "document.getElementById('" . $popupVisualisationGoogleMap->getJSIFrameId() . "').src='" . $this->creerUrl('', 'carteGoogleMapParcoursArt', array('noHeaderNoFooter' => 1, 'archiIdParcours' => $idParcours)) . "'\">"; $boutonRetour = "<input type='button' name='retour' value='Retour' onclick=\"location.href='" . $this->creerUrl('', 'adminListeParcours', array()) . "';\">"; $boutonSupprimer = ""; // ajout d'une nouvelle etape $formAction = $this->creerUrl('ajouterEtapeParcours', 'etapesParcoursFormulaire', array('archiIdParcours' => $idParcours)); if (mysql_num_rows($resNbEtapes) == 0) { // si pas d'etapes encore , on peut definir un message } else { // il y a une ou plusieurs etapes dans le parcours if (isset($this->variablesGet['archiIdEtape']) && $this->variablesGet['archiIdEtape'] != '') { $idEtape = $this->variablesGet['archiIdEtape']; $reqEtape = "SELECT idEvenementGroupeAdresse,commentaireEtape FROM etapesParcoursArt WHERE idEtape='" . $idEtape . "'"; $resEtape = $this->connexionBdd->requete($reqEtape); $fetchEtape = mysql_fetch_assoc($resEtape); $sousTitre = _("Modification d'une étape"); $formAction = $this->creerUrl('modifierEtapeParcours', 'etapesParcoursFormulaire', array('archiIdParcours' => $idParcours, 'archiIdEtape' => $this->variablesGet['archiIdEtape'])); $commentaireEtape = $fetchEtape['commentaireEtape']; $libelleAdresse = $a->getIntituleAdresseFrom($fetchEtape['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse'); $idAdresse = ''; $idEvenementGroupeAdresse = $fetchEtape['idEvenementGroupeAdresse']; $boutonNouveau = "<input type='button' name='boutonNouveau' value='Nouveau' onclick=\"location.href='" . $this->creerUrl('', 'etapesParcoursFormulaire', array('archiIdParcours' => $idParcours)) . "';\">"; $boutonSupprimer = "<input type='button' name='boutonSupprimer' value='Supprimer' onclick=\"location.href='" . $this->creerUrl('supprimerEtapeParcours', 'etapesParcoursFormulaire', array('archiIdParcours' => $idParcours, 'archiIdEtapeSupprimer' => $idEtape)) . "';\">"; $coord = $a->getCoordonneesFrom($fetchEtape['idEvenementGroupeAdresse'], 'idEvenementGroupeAdresse'); } else { $coord = array("latitude" => "", "longitude" => ""); } } $bbCodeElementsArray = $bbCode->getBoutonsMiseEnFormeTextArea(array('formName' => $formName, 'fieldName' => 'commentaireEtape')); $html .= "<hr/>"; // formulaire ajout-modif etape $html .= "<h2>{$sousTitre}</h2>"; $configFields = array('idParcours' => array('libelle' => 'idParcours', 'type' => 'hidden', 'error' => '', 'value' => '', 'forceValueTo' => $idParcours, 'htmlCode' => ''), 'idEtape' => array('libelle' => 'idEtape', 'type' => 'hidden', 'error' => '', 'value' => '', 'forceValueTo' => $idEtape, 'htmlCode' => ''), 'libelleEvenementGroupeAdresse' => array('libelle' => _('Adresse'), 'type' => 'text', 'error' => '', 'value' => '', 'forceValueTo' => $libelleAdresse, 'htmlCode' => "style='width:300px;' disabled", 'htmlCode2' => "<input type='button' name='choixAdresse' value='Choisir' onclick=\"document.getElementById('" . $popupChoixAdresses->getJSDivId() . "').style.top=(getScrollHeight()+70)+'px';" . $popupChoixAdresses->getJSOpenPopup() . "document.getElementById('" . $popupChoixAdresses->getJSIFrameId() . "').src='" . $this->creerUrl('', 'recherche', array('noHeaderNoFooter' => 1, 'modeAffichage' => 'popupRechercheAdresseAdminParcours')) . "';\">"), 'latitude' => array('libelle' => _('Latitude'), 'type' => 'text', 'error' => '', 'value' => '', 'forceValueTo' => $coord["latitude"], 'htmlCode' => "style='width:300px;' readonly onclick='this.select();'"), 'longitude' => array('libelle' => _('Longitude'), 'type' => 'text', 'error' => '', 'value' => '', 'forceValueTo' => $coord["longitude"], 'htmlCode' => "style='width:300px;' readonly onclick='this.select();'"), 'idEvenementGroupeAdresse' => array('libelle' => 'idEvenementGroupeAdresse', 'type' => 'hidden', 'error' => '', 'value' => '', 'forceValueTo' => $idEvenementGroupeAdresse, 'htmlCode' => "style='width:300px;'"), 'commentaireEtape' => array('libelle' => 'commentaire', 'type' => 'bigText', 'error' => '', 'value' => '', 'forceValueTo' => $commentaireEtape, 'default' => '', 'htmlCode' => "style='width:500px;height:200px;'", 'htmlCodeBeforeField' => $bbCodeElementsArray['boutonsHTML'], 'htmlCode2' => $bbCodeElementsArray['divAndJsAfterForm'])); $configForm = array('fields' => $configFields, 'formAction' => $formAction, 'formName' => $formName, 'onClickSubmitButton' => $listeTriableObject->getJSSubmitDragAndDrop(), 'codeHtmlAfterSubmitButton' => $boutonSupprimer . $boutonNouveau . $boutonVisualisation . $boutonRetour, 'codeHtmlInFormAfterFields' => $listeTriableObject->getJSInitAfterListDragAndDrop()); $html .= $f->afficherFromArray($configForm); $html .= $popupChoixAdresses->getDiv(array('lienSrcIFrame' => $this->creerUrl('', 'recherche', array('noHeaderNoFooter' => 1, 'modeAffichage' => 'popupRechercheAdresseAdminParcours')), 'width' => 750, 'height' => 500, 'left' => 10, 'top' => 70, 'titre' => 'archi-strasbourg.org : Parcours')); $html .= $popupVisualisationGoogleMap->getDiv(array('lienSrcIFrame' => '')); // on ne precharge pas la carte google map sinon il y a un bug au niveau de la carte , le centre se placerai en haut a gauche $html .= "<script >" . $popupChoixAdresses->getJsToDragADiv() . "</script>"; // on rend le div deplacable $html .= "<script >" . $popupVisualisationGoogleMap->getJsToDragADiv() . "</script>"; // on rend le div deplacable } return $html; }