public function getListeCommentaires($idEvenementGroupeAdresse = 0)
 {
     $bbCode = new bbCodeObject();
     $u = new archiUtilisateur();
     $html = "";
     $t = new Template('modules/archi/templates/');
     $t->set_filenames(array('listeCommentaires' => 'listeCommentaires.tpl'));
     $req = "SELECT c.idCommentaire 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, u.urlSiteWeb as urlSiteWeb\n        \t\t ,date_format( c.date, '%Y%m%d%H%i%s' ) AS dateTri\n        \t\tFROM commentaires c\n        \t\tLEFT JOIN utilisateur u ON u.idUtilisateur = c.idUtilisateur\n        \t\tWHERE c.idEvenementGroupeAdresse = '" . $idEvenementGroupeAdresse . "'\n        \t\t\t\tAND CommentaireValide=1\n        \t\t\t\tORDER BY DateTri DESC\n        \t\t\t\t";
     $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>";
             }
             $so = new StringObject();
             $t->assign_block_vars('commentaires', array('htmlId' => 'commentaireAdresse' . $fetch['idCommentaire'], 'adresseMail' => $adresseMail, 'commentaire' => $bbCode->convertToDisplay(array('text' => stripslashes($fetch['commentaire']), 'type' => 'commentaire')), 'boutonSupprimer' => $boutonSupprimer, 'urlProfilPic' => $urlProfilePic, 'prenom' => $fetch['prenom'], 'nom' => $fetch['nom'], 'labelCommentAction' => _("a ajouté un commentaire"), 'date' => $fetch['dateF'], 'urlSupprimer' => $urlSupprimer));
             if ($isAdmin) {
                 $archiIdAdresse = '';
                 if (isset($this->variablesGet['archiIdAdresse'])) {
                     $archiIdAdresse = $this->variablesGet['archiIdAdresse'];
                 }
                 $urlSupprimer = $this->creerUrl('supprimerCommentaire', '', 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;
     }
 }
Ejemplo n.º 2
0
    if ($authentification->estConnecte()) {
        $t->assign_vars(array('etatConnexion' => _("Vous êtes connecté!")));
    } else {
        $t->assign_vars(array('etatConnexion' => _("Vous n'êtes pas connecté")));
    }
    $t->assign_vars(array('formulaireConnexion' => $authentification->afficheFormulaireAuthentification('compact'), 'formulaireRecherche' => $recherche->afficheFormulaire(array(), 0, array('noDisplayRechercheAvancee' => false, 'noDisplayCheckBoxResultatsCarte' => false)), 'inscriptionDeconnexion' => _("Inscrivez-vous !"), 'urlInscriptDeconnexion' => $config->creerUrl('', 'inscription'), 'urlAccueil' => $config->creerUrl('', 'afficheAccueil'), 'txtAccueil' => 'Accueil', 'classAuthLinkWrapper' => 'notConnectedAuthLink'));
    $t->assign_block_vars('linkConnected', array('authLinkOneClass' => ' authLinkOneClass forgetPasswordLabel', 'authLinkUrl' => $config->creerUrl('', 'formulaireMotDePasseOublie'), 'authLinkLabel' => 'Mot de passe oublié ?'));
    $t->assign_block_vars('linkConnected', array('authLinkOneClass' => 'authLinkTwoClass subscribeLabel', 'authLinkUrl' => $config->creerUrl('', 'inscription'), 'authLinkLabel' => 'Inscrivez-vous !'));
} else {
    if ($authentification->estAdmin()) {
        $t->assign_block_vars('isAdmin', array());
    }
    // utilisateur connecté
    $classFastConnect = "hidden";
    $userId = $authentification->getIdUtilisateur();
    $imgConnexion = $utilisateur->getImageAvatar(array('idUtilisateur' => $userId, 'default' => "images/logo_connexion.png"));
    $reqTitre = "SELECT prenom, nom FROM utilisateur WHERE idUtilisateur = {$userId}";
    $res = $config->connexionBdd->requete($reqTitre);
    $arrayUser = mysql_fetch_assoc($res);
    $labelConnexion = $arrayUser['prenom'] . " " . $arrayUser['nom'];
    $t->assign_block_vars('utilisateurConnecte', array());
    $t->assign_vars(array('inscriptionDeconnexion' => _("Déconnexion"), 'formulaireRecherche' => $recherche->afficheFormulaire(array(), 0, array('noDisplayRechercheAvancee' => false, 'noDisplayCheckBoxResultatsCarte' => false)), 'urlInscriptDeconnexion' => $config->creerUrl('deconnexion', 'authentification'), 'urlAccueil' => $config->creerUrl('', 'afficheAccueil'), 'txtAccueil' => _("Accueil"), 'urlMonArchi' => $config->creerUrl('', 'afficheAccueil', array('modeAffichage' => 'monArchi')), 'txtMonArchi' => _("Mon Archi"), 'authLinkOneUrl' => $config->creerUrl('', 'afficheAccueil', array('modeAffichage' => 'profil')), 'classAuthLinkWrapper' => 'connectedAuthLink', 'classFastConnect' => $classFastConnect));
    if ($utilisateur->getIdProfil($userId) >= 4) {
        $t->assign_block_vars('linkConnected', array('authLinkOneClass' => 'authLinkTwoClass subscribeLabel', 'authLinkUrl' => $config->creerUrl('', 'utilisateurListe'), 'authLinkLabel' => _("Utilisateurs")));
    }
    if ($utilisateur->getIdProfil($userId) >= 3) {
        $t->assign_block_vars('linkConnected', array('authLinkOneClass' => 'authLinkTwoClass subscribeLabel', 'authLinkUrl' => $config->creerUrl('', 'administration'), 'authLinkLabel' => _("Administration")));
    }
    $t->assign_block_vars('linkConnected', array('authLinkOneClass' => ' authLinkOneClass forgetPasswordLabel', 'authLinkUrl' => $config->creerUrl('', 'afficheAccueil', array('modeAffichage' => 'profil')), 'authLinkLabel' => _("Mon Profil")));
    $t->assign_block_vars('linkConnected', array('authLinkOneClass' => ' authLinkOneClass forgetPasswordLabel', 'authLinkUrl' => $config->creerUrl('', 'afficheAccueil', array('modeAffichage' => 'monArchi')), 'authLinkLabel' => _("Mon Archi")));
    $t->assign_block_vars('linkConnected', array('authLinkOneClass' => 'authLinkTwoClass subscribeLabel', 'authLinkUrl' => $config->creerUrl('deconnexion', 'authentification'), 'authLinkLabel' => _("Déconnexion")));
 /**
  * Get the form for comment
  *
  *
  * @param unknown $idEvenement
  * @param unknown $fields
  * @param string $ty : type of comment
  * @return string
  */
 public function getFormComment($idEvenement, $fields, $ty = '')
 {
     $t = new Template('modules/archi/templates/');
     $labelButton = "Ajouter un commentaire";
     $type = $ty == '' ? 0 : $ty;
     $classButton = 'addCommentButtonWrapper';
     $auth = new ArchiAuthentification();
     if ($auth->estConnecte()) {
         $t->set_filenames(array('formComment' => 'comment/comment.tpl'));
         $url = "";
         $userId = $auth->getIdUtilisateur();
         $utilisateur = new archiUtilisateur();
         $utilisateur->setUserId($userId);
         $nom = $utilisateur->getNom();
         $prenom = $utilisateur->getPrenom();
         $email = $utilisateur->getEmail();
         $urlProfilePic = $utilisateur->getImageAvatar(array('idUtilisateur' => $userId));
         $profileAlt = $prenom . " " . $nom;
         if ($ty == '') {
             $array_type = array();
             $url = $this->creerUrl('enregistreCommentaire', '', array());
             $labelButton .= " sur l'adresse";
             $classButton .= " addCommentAdresseButtonWrapper";
         } else {
             $array_type = array('type' => array('id' => 'type', 'type' => 'hidden', 'value' => $type));
             $url = $this->creerUrl('enregistreCommentaireEvenement', '', array());
         }
         $inputs = array('nom' => array('id' => 'nom', 'type' => 'hidden', 'value' => $nom), 'prenom' => array('id' => 'prenom', 'type' => 'hidden', 'value' => $prenom), 'email' => array('id' => 'email', 'type' => 'hidden', 'value' => $email), 'idEvenementGroupeAdresse' => array('id' => 'idEvenementGroupeAdresse', 'type' => 'hidden', 'value' => $idEvenement));
         $inputs = array_merge($inputs, $array_type);
         foreach ($inputs as $input) {
             $t->assign_block_vars('input', $input);
         }
         $t->assign_vars(array('urlRedirect' => $url, 'name' => 'formAjoutCommentaire', 'urlProfilePic' => $urlProfilePic, 'profileAlt' => $profileAlt, 'labelButton' => $labelButton, 'classButton' => $classButton, 'idEvenement' => $idEvenement));
     } else {
         $t->set_filenames(array('formComment' => 'comment/notconnected.tpl'));
         $urlConnexion = $this->creerUrl('', 'authentification');
         $urlInscription = $this->creerUrl('', 'inscription');
         if ($ty == '') {
             $labelButton .= " sur l'adresse";
             $classButton .= " addCommentAdresseButtonWrapper";
         }
         $t->assign_vars(array('urlInscription' => $urlInscription, 'urlConnexion' => $urlConnexion, 'labelButton' => $labelButton, 'classButton' => $classButton, 'idEvenement' => $idEvenement));
     }
     //Setting CSS class for opening the form
     if (isset($this->variablesGet['commentFormActive']) && $this->variablesGet['commentFormActive']) {
         if ($this->variablesGet['commentFormActive'] == $idEvenement) {
             $t->assign_var('classWrappingDiv', 'active');
         }
     }
     ob_start();
     $t->pparse('formComment');
     $html .= ob_get_contents();
     ob_end_clean();
     return $html;
 }