Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

Ignore whitespace Rev 18 → Rev 19

/trunk/modeles/RechercheDao.php
13,33 → 13,18
*
*/
class RechercheDao extends ColModele {
 
const SERVICE = 'CoelRecherche';
/**
* Recherche une collection en fonction de paramĂȘtres
* @return array un tableau contenant des objets d'informations sur les collections
*/
public function chercherStructureNbre($parametres) {
$requete = 'SELECT COUNT(cc_id_collection) AS nbre '.
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
'WHERE ('.
" cc_nom LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_code LIKE '%{$parametres['mots']}%' ".
" OR cc_description LIKE '%{$parametres['mots']}%' ".
" OR cc_description_specialiste LIKE '%{$parametres['mots']}%' ".
" OR cc_historique LIKE '%{$parametres['mots']}%' ".
" OR cs_nom LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_01 LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_02 LIKE '%{$parametres['mots']}%' ".
" OR cs_ville LIKE '%{$parametres['mots']}%' ".
" OR cs_truk_identifiant_alternatif LIKE '%{$parametres['mots']}%' ".
') '.
'ORDER BY cs_ville ASC, cc_nom ASC ';
$donnees = $this->requeteUn($requete);
//Debug::printr($requete);
return $donnees['nbre'];
$mots = urlencode($parametres['mots']);
$url = $this->url_jrest.self::SERVICE."/Nombre/$mots";
$json = file_get_contents($url);
$donnees = json_decode($json);
return $donnees;
}
/**
47,29 → 32,12
* @return array un tableau contenant des objets d'informations sur les collections
*/
public function chercher($parametres) {
$requete = 'SELECT cs_id_structure, cs_ville, cs_nom, '.
' cc_id_collection, cc_nom '.
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
'WHERE ('.
" cc_nom LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
" OR cc_truk_code LIKE '%{$parametres['mots']}%' ".
" OR cc_description LIKE '%{$parametres['mots']}%' ".
" OR cc_description_specialiste LIKE '%{$parametres['mots']}%' ".
" OR cc_historique LIKE '%{$parametres['mots']}%' ".
" OR cs_nom LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_01 LIKE '%{$parametres['mots']}%' ".
" OR cs_adresse_02 LIKE '%{$parametres['mots']}%' ".
" OR cs_ville LIKE '%{$parametres['mots']}%' ".
" OR cs_truk_identifiant_alternatif LIKE '%{$parametres['mots']}%' ".
') '.
'ORDER BY cs_ville ASC, cc_nom ASC '.
($this->avoirLimitation() ? "LIMIT {$this->getLimiteDebut()}, {$this->getLimiteNbre()} " : '');
$donnees = $this->requeteTous($requete);
//Debug::printr($requete);
$mots = urlencode($parametres['mots']);
$url = $this->url_jrest.self::SERVICE."/ParDefaut/$mots";
$url .= ($this->avoirLimitation() ? "?start={$this->getLimiteDebut()}&limit={$this->getLimiteNbre()}" : '');
$json = file_get_contents($url);
$donnees = json_decode($json, true);
return $donnees;
}
}
}
?>