Subversion Repositories eFlore/Applications.del

Compare Revisions

Regard whitespace Rev 1283 → Rev 1284

/trunk/services/modules/0.1/syndication/SyndicationCommentaires.php
115,8 → 115,8
private function construireDonneesCommunesAuFlux($infos) {
$donnees = array();
$donnees['guid'] = '';
$donnees['titre'] = 'Dernières déterminations et commentaires de l\'application identiplante';
$donnees['description'] = 'Ce flux regroupe les dernières déterminations et commentaires rédigés dans l\'application identiplante';
$donnees['titre'] = 'identiPlante : commentaires et propositions';
$donnees['description'] = 'Ce flux regroupe les dernières déterminations et commentaires rédigés dans l\'application identiPlante';
$donnees['lien_service'] = $this->creerUrlService();
$donnees['lien_del'] = $this->conteneur->getParametre('delAppliLien');
$donnees['editeur'] = $this->conteneur->getParametre('editeur');
165,18 → 165,15
}
private function creerDescription($donnees, $item) {
$description = '<ul>';
$nomSel = ($donnees['nom_sel'] != '') ? htmlspecialchars($donnees['nom_sel']) : '';
$txt = ($donnees['texte'] != '') ? htmlspecialchars($donnees['texte']) : '';
$auteur = htmlspecialchars($this->creerAuteur($donnees)).
($this->fluxAdminDemande() ? ' ('.$donnees['utilisateur_courriel'].')' : '');
if($donnees['nom_sel'] != '') {
$description .= '<li>Proposition : <em>'.htmlspecialchars($donnees['nom_sel']).'</em></li>';
}
if($donnees['texte'] != '') {
$description .= '<li>Commentaire : <pre>'.htmlspecialchars($donnees['texte']).'</pre></li>';
}
$auteur = htmlspecialchars($this->creerAuteur($donnees));
$auteur .= $this->fluxAdminDemande() ? ' ('.$donnees['utilisateur_courriel'].')' : '';
$description .= '<li>Auteur : '.$auteur.'</li>'.
$description = '<ul>'.
(($nomSel != '') ? "<li>Proposition : <em>$nomSel</em></li>" : '').
(($txt != '') ? "<li>Commentaire : <pre>$txt</pre></li>" : '').
"<li>Auteur du commentaire : $auteur</li>".
'</ul>';
return $description;
}
186,16 → 183,17
}
private function getDerniersCommentaires() {
$requete = "SELECT DISTINCT dc.*, dob.id_observation as dob_id_observation, dob.ce_zone_geo as dob_ce_zone_geo, ".
"dob.zone_geo as dob_zone_geo, dob.date_observation as dob_date_observation, dob.nom_sel as dob_nom_sel ".
"FROM del_commentaire dc ".
"INNER JOIN del_observation dob ".
"ON dob.id_observation = dc.ce_observation ".
"WHERE ((dob.ce_utilisateur = dc.ce_utilisateur AND dob.nom_sel != dc.nom_sel) ".
" OR (dob.ce_utilisateur != dc.ce_utilisateur)) ".
$this->chargerClauseWhere()." ".
"ORDER BY dc.date DESC ".
"LIMIT ".$this->navigation->getDepart().",".$this->navigation->getLimite()." ";
$requete = 'SELECT DISTINCT dc.*, '.
' dob.id_observation AS dob_id_observation, dob.ce_zone_geo AS dob_ce_zone_geo, '.
' dob.zone_geo AS dob_zone_geo, dob.date_observation AS dob_date_observation, dob.nom_sel AS dob_nom_sel '.
'FROM del_commentaire AS dc '.
' INNER JOIN del_observation AS dob '.
' ON dob.id_observation = dc.ce_observation '.
'WHERE ((dob.ce_utilisateur = dc.ce_utilisateur AND dob.nom_sel != dc.nom_sel) '.
' OR (dob.ce_utilisateur != dc.ce_utilisateur)) '.
$this->chargerClauseWhere().' '.
'ORDER BY dc.date DESC '.
'LIMIT '.$this->navigation->getDepart().','.$this->navigation->getLimite().' ';
$elements = $this->gestionBdd->getBdd()->recupererTous($requete);
return $elements;
212,8 → 210,10
$idMasque = str_replace('masque.', '', $idMasque);
switch ($idMasque) {
case 'espece':
$where[] = ' dob.'.$this->mappingFiltre[$idMasque].' LIKE '.$this->gestionBdd->getBdd()->proteger($valeurMasque.'%').' '.
' OR '.' dc.'.$this->mappingFiltre[$idMasque].' LIKE '.$this->gestionBdd->getBdd()->proteger($valeurMasque.'%').' ';
$where[] = ' dob.'.$this->mappingFiltre[$idMasque].
' LIKE '.$this->gestionBdd->getBdd()->proteger($valeurMasque.'%').' '.
' OR '.' dc.'.$this->mappingFiltre[$idMasque].
' LIKE '.$this->gestionBdd->getBdd()->proteger($valeurMasque.'%').' ';
break;
case 'auteur':
$where[] = $this->creerFiltreAuteur($valeurMasque).' ';
220,7 → 220,6
break;
default:
$where[] = ' '.$this->mappingFiltre[$idMasque].' = '.$this->gestionBdd->getBdd()->proteger($valeurMasque);
break;
}
}
}
231,32 → 230,33
}
}
private function creerFiltreAuteur($valeurMasque) {
private function creerFiltreAuteur($auteurId) {
$masque = '';
$auteurId = $valeurMasque;
if (is_numeric($auteurId)) {
$masque = ' dc.ce_utilisateur = '.$auteurId;
$masque = " dc.ce_utilisateur = $auteurId ";
} else {
$auteurIdMotif = $this->gestionBdd->getBdd()->proteger($auteurId.'%');
 
if (strpos($auteurId, '@') === false) {
$tableauNomPrenom = explode(' ',$auteurId, 2);
if(count($tableauNomPrenom) == 2) {
// on teste potentiellement un nom prenom ou bien un prénom nom
$nomMotif = $this->gestionBdd->getBdd()->proteger($tableauNomPrenom[0].'%');
$prenomMotif = $this->gestionBdd->getBdd()->proteger($tableauNomPrenom[1].'%');
 
$masque = '('.
'(dc.utilisateur_nom LIKE '.$this->gestionBdd->getBdd()->proteger($tableauNomPrenom[0].'%').' AND '.
'dc.utilisateur_prenom LIKE '.$this->gestionBdd->getBdd()->proteger($tableauNomPrenom[1].'%').') OR '.
'(dc.utilisateur_nom LIKE '.$this->gestionBdd->getBdd()->proteger($tableauNomPrenom[1].'%').' AND '.
'dc.utilisateur_prenom LIKE '.$this->gestionBdd->getBdd()->proteger($tableauNomPrenom[0].'%').')'.
"(dc.utilisateur_nom LIKE $nomMotif AND dc.utilisateur_prenom LIKE $prenomMotif) ".
'OR '.
"(dc.utilisateur_nom LIKE $nomMotif AND dc.utilisateur_prenom LIKE $prenomMotif) ".
')';
} else {
$masque = '(
(dc.utilisateur_nom LIKE '.$this->gestionBdd->getBdd()->proteger($auteurId.'%').' OR '.
'dc.utilisateur_prenom LIKE '.$this->gestionBdd->getBdd()->proteger($auteurId.'%').')'.
')';
$masque = "(dc.utilisateur_nom LIKE $auteurIdMotif OR dc.utilisateur_prenom LIKE $auteurIdMotif) ";
}
} else {
$masque = " dob.utilisateur_courriel LIKE ".$this->gestionBdd->getBdd()->proteger($valeurMasque.'%')." ";
$masque = " dob.utilisateur_courriel LIKE $auteurIdMotif ";
}
}
return $masque;
}
}
}
?>