7 |
jpm |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Modèle d'accès à la base de données des Collections pour la Recherche
|
|
|
5 |
*
|
|
|
6 |
* @package Collection
|
|
|
7 |
* @category php5
|
|
|
8 |
* @author aurelien <aurelien@tela-botanica.org>
|
|
|
9 |
* @copyright 2010 Tela-Botanica
|
|
|
10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
|
|
11 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
|
|
|
12 |
* @version SVN: $Id: RechercheDao.php 10 2010-03-05 14:15:42Z jpm $
|
|
|
13 |
*
|
|
|
14 |
*/
|
|
|
15 |
class RechercheDao extends ColModele {
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Recherche une collection en fonction de paramêtres
|
|
|
19 |
* @return array un tableau contenant des objets d'informations sur les collections
|
|
|
20 |
*/
|
|
|
21 |
public function chercherStructureNbre($parametres) {
|
|
|
22 |
$requete = 'SELECT COUNT(cc_id_collection) AS nbre '.
|
|
|
23 |
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
|
|
|
24 |
'WHERE ('.
|
|
|
25 |
" cc_nom LIKE '%{$parametres['mots']}%' ".
|
|
|
26 |
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
|
|
|
27 |
" OR cc_truk_code LIKE '%{$parametres['mots']}%' ".
|
|
|
28 |
" OR cc_description LIKE '%{$parametres['mots']}%' ".
|
|
|
29 |
" OR cc_description_specialiste LIKE '%{$parametres['mots']}%' ".
|
|
|
30 |
" OR cc_historique LIKE '%{$parametres['mots']}%' ".
|
|
|
31 |
|
|
|
32 |
" OR cs_nom LIKE '%{$parametres['mots']}%' ".
|
|
|
33 |
" OR cs_adresse_01 LIKE '%{$parametres['mots']}%' ".
|
|
|
34 |
" OR cs_adresse_02 LIKE '%{$parametres['mots']}%' ".
|
|
|
35 |
" OR cs_ville LIKE '%{$parametres['mots']}%' ".
|
|
|
36 |
" OR cs_truk_identifiant_alternatif LIKE '%{$parametres['mots']}%' ".
|
|
|
37 |
') '.
|
|
|
38 |
'ORDER BY cs_ville ASC, cc_nom ASC ';
|
|
|
39 |
|
|
|
40 |
$donnees = $this->requeteUn($requete);
|
|
|
41 |
//Debug::printr($requete);
|
|
|
42 |
return $donnees['nbre'];
|
|
|
43 |
}
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Recherche une collection en fonction de paramêtres
|
|
|
47 |
* @return array un tableau contenant des objets d'informations sur les collections
|
|
|
48 |
*/
|
|
|
49 |
public function chercher($parametres) {
|
|
|
50 |
$requete = 'SELECT cs_id_structure, cs_ville, cs_nom, '.
|
9 |
jpm |
51 |
' cc_id_collection, cc_nom '.
|
7 |
jpm |
52 |
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
|
|
|
53 |
'WHERE ('.
|
|
|
54 |
" cc_nom LIKE '%{$parametres['mots']}%' ".
|
|
|
55 |
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
|
|
|
56 |
" OR cc_truk_code LIKE '%{$parametres['mots']}%' ".
|
|
|
57 |
" OR cc_description LIKE '%{$parametres['mots']}%' ".
|
|
|
58 |
" OR cc_description_specialiste LIKE '%{$parametres['mots']}%' ".
|
|
|
59 |
" OR cc_historique LIKE '%{$parametres['mots']}%' ".
|
|
|
60 |
|
|
|
61 |
" OR cs_nom LIKE '%{$parametres['mots']}%' ".
|
|
|
62 |
" OR cs_adresse_01 LIKE '%{$parametres['mots']}%' ".
|
|
|
63 |
" OR cs_adresse_02 LIKE '%{$parametres['mots']}%' ".
|
|
|
64 |
" OR cs_ville LIKE '%{$parametres['mots']}%' ".
|
|
|
65 |
" OR cs_truk_identifiant_alternatif LIKE '%{$parametres['mots']}%' ".
|
|
|
66 |
') '.
|
|
|
67 |
'ORDER BY cs_ville ASC, cc_nom ASC '.
|
|
|
68 |
($this->avoirLimitation() ? "LIMIT {$this->getLimiteDebut()}, {$this->getLimiteNbre()} " : '');
|
|
|
69 |
|
|
|
70 |
$donnees = $this->requeteTous($requete);
|
|
|
71 |
//Debug::printr($requete);
|
|
|
72 |
return $donnees;
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
?>
|