Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

Ignore whitespace Rev 6 → Rev 7

/trunk/modeles/RechercheDao.php
New file
0,0 → 1,75
<?php
// declare(encoding='UTF-8');
/**
* Modèle d'accès à la base de données des Collections pour la Recherche
*
* @package Collection
* @category php5
* @author aurelien <aurelien@tela-botanica.org>
* @copyright 2010 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
* @version SVN: $Id$
*
*/
class RechercheDao extends ColModele {
 
/**
* 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'];
}
/**
* Recherche une collection en fonction de paramêtres
* @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_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);
return $donnees;
}
}
?>