Line 7... |
Line 7... |
7 |
* @category php5
|
7 |
* @category php5
|
8 |
* @author aurelien <aurelien@tela-botanica.org>
|
8 |
* @author aurelien <aurelien@tela-botanica.org>
|
9 |
* @copyright 2010 Tela-Botanica
|
9 |
* @copyright 2010 Tela-Botanica
|
10 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
|
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
|
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 $
|
12 |
* @version SVN: $Id: RechercheDao.php 19 2010-03-24 18:22:25Z jpm $
|
13 |
*
|
13 |
*
|
14 |
*/
|
14 |
*/
|
15 |
class RechercheDao extends ColModele {
|
15 |
class RechercheDao extends ColModele {
|
- |
|
16 |
const SERVICE = 'CoelRecherche';
|
16 |
|
17 |
|
17 |
/**
|
18 |
/**
|
18 |
* Recherche une collection en fonction de paramêtres
|
19 |
* Recherche une collection en fonction de paramêtres
|
19 |
* @return array un tableau contenant des objets d'informations sur les collections
|
20 |
* @return array un tableau contenant des objets d'informations sur les collections
|
20 |
*/
|
21 |
*/
|
21 |
public function chercherStructureNbre($parametres) {
|
22 |
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']}%' ".
|
23 |
$mots = urlencode($parametres['mots']);
|
26 |
" OR cc_truk_nom_alternatif LIKE '%{$parametres['mots']}%' ".
|
24 |
$url = $this->url_jrest.self::SERVICE."/Nombre/$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 ';
|
25 |
$json = file_get_contents($url);
|
39 |
|
- |
|
40 |
$donnees = $this->requeteUn($requete);
|
26 |
$donnees = json_decode($json);
|
41 |
//Debug::printr($requete);
|
- |
|
42 |
return $donnees['nbre'];
|
27 |
return $donnees;
|
43 |
}
|
28 |
}
|
Line 44... |
Line 29... |
44 |
|
29 |
|
45 |
/**
|
30 |
/**
|
46 |
* Recherche une collection en fonction de paramêtres
|
31 |
* Recherche une collection en fonction de paramêtres
|
47 |
* @return array un tableau contenant des objets d'informations sur les collections
|
32 |
* @return array un tableau contenant des objets d'informations sur les collections
|
48 |
*/
|
33 |
*/
|
49 |
public function chercher($parametres) {
|
- |
|
50 |
$requete = 'SELECT cs_id_structure, cs_ville, cs_nom, '.
|
- |
|
51 |
' cc_id_collection, cc_nom '.
|
- |
|
52 |
'FROM coel_collection LEFT JOIN coel_structure ON (cc_ce_structure = cs_id_structure) '.
|
- |
|
53 |
'WHERE ('.
|
34 |
public function chercher($parametres) {
|
54 |
" cc_nom LIKE '%{$parametres['mots']}%' ".
|
35 |
$mots = urlencode($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 '.
|
36 |
$url = $this->url_jrest.self::SERVICE."/ParDefaut/$mots";
|
68 |
($this->avoirLimitation() ? "LIMIT {$this->getLimiteDebut()}, {$this->getLimiteNbre()} " : '');
|
- |
|
69 |
|
37 |
$url .= ($this->avoirLimitation() ? "?start={$this->getLimiteDebut()}&limit={$this->getLimiteNbre()}" : '');
|
70 |
$donnees = $this->requeteTous($requete);
|
38 |
$json = file_get_contents($url);
|
71 |
//Debug::printr($requete);
|
39 |
$donnees = json_decode($json, true);
|
72 |
return $donnees;
|
40 |
return $donnees;
|
73 |
}
|
41 |
}
|
74 |
}
|
42 |
}
|
75 |
?>
|
43 |
?>
|