23,7 → 23,7 |
$info = array(); |
|
// Pré traitement des paramêtres |
$p = $this->traiterParametresUrl(array('id_projet', 'id_commentaire', 'titre'), $param); |
$p = $this->traiterParametresUrl(array('id_projet', 'id_commentaire', 'recherche'), $param); |
|
// Construction de la requête |
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' ccm.*, '. |
36,7 → 36,7 |
((count($p) != 0) ? 'WHERE ' : ''). |
(isset($p['id_projet']) ? "AND ccm_ce_projet = {$p['id_projet']} " : ''). |
(isset($p['id_commentaire']) ? "AND ccm_id_commentaire = {$p['id_commentaire']} " : ''). |
(isset($p['titre']) ? "AND ccm_titre LIKE {$p['titre']} " : ''). |
(isset($p['recherche']) ? $this->construireWhereRecherche($p['recherche']) : ''). |
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'ccm_id_commentaire ASC').' '; |
$requete = str_replace('WHERE AND', 'WHERE', $requete); |
$requeteCount = $requete; |
64,6 → 64,35 |
$this->envoyer($info); |
} |
|
private function construireWhereRecherche($recherche) { |
$recherche_public = null; |
if(strstr(strtolower($recherche),'public')) { |
$recherche_public = 1; |
} |
if(strstr(strtolower($recherche),'prive') || strstr(strtolower($recherche),'privé')) { |
$recherche_public = 0; |
} |
|
$sous_requete_type = 'SELECT cmlv_id_valeur '. |
'FROM coel_meta_liste_valeur '. |
'WHERE cmlv_nom LIKE '.$recherche.' '. |
'AND cmlv_ce_parent = 1068'; |
$types = $this->bdd->query($sous_requete_type)->fetchAll(PDO::FETCH_ASSOC); |
$str_types = ""; |
foreach($types as $type) { |
$str_types .= "ccac_truk_type LIKE ".$this->bdd->quote("%".$type['cmlv_id_valeur'].'%')." OR "; |
} |
|
$recherche = "AND ". |
"(". |
$str_types. |
"ccm_titre LIKE {$recherche} OR ". |
"ccm_ponderation LIKE {$recherche} ". |
($recherche_public !== null ? ("OR ccm_mark_public LIKE {$recherche_public} ") : ""). |
")"; |
return $recherche; |
} |
|
/** |
* Méthode appelée pour ajouter un élément. |
*/ |