Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1635 → Rev 1636

/trunk/jrest/services/CoelProjet.php
26,16 → 26,16
$info = array();
 
// Pré traitement des paramêtres
$p = $this->traiterParametresUrl(array('id_projet', 'cpr_nom'), $param);
$p = $this->traiterParametresUrl(array('id_projet', 'recherche'), $param);
 
// Nous avons un identifiant de projet, nous récupérons seulement les informations du projet donné
$requete = (($this->distinct) ? 'SELECT DISTINCT' : 'SELECT').' * '.
'FROM coel_projet '.
((count($p) != 0) ? 'WHERE ' : '').
((isset($p['cpr_nom'])) ? "AND cpr_nom LIKE {$p['cpr_nom']} " : '').
((isset($p['recherche'])) ? $this->construireWhereRecherche($p['recherche']) : '').
((isset($p['id_projet'])) ? "AND cpr_id_projet = {$p['id_projet']} " : '').
'ORDER BY '.((!is_null($this->orderby)) ? $this->orderby : 'cpr_id_projet ASC').' ';
 
$requete = str_replace('WHERE AND', 'WHERE', $requete);
$requeteCount = $requete;
$requete .= "LIMIT $this->start, $this->limit ";
61,6 → 61,18
$this->envoyer($info);
 
}
private function construireWhereRecherche($recherche) {
$recherche = "AND ".
"(".
"cpr_nom LIKE {$recherche} OR ".
"cpr_abreviation LIKE {$recherche} OR ".
"cpr_resume LIKE {$recherche} OR ".
"cpr_url LIKE {$recherche} OR ".
"cpr_mot_cles LIKE {$recherche} ".
")";
return $recherche;
}
 
/**
* Méthode appelée pour ajouter un élément.