Subversion Repositories eFlore/Applications.coel-consultation

Compare Revisions

No changes between revisions

Ignore whitespace Rev 146 → Rev 147

/trunk/bibliotheque/dao/RechercheDao.php
New file
0,0 → 1,57
<?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 Dao {
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) {
$url = $this->construireUrlRecherche('Nombre', $parametres, false);
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json);
return $donnees;
}
/**
* Recherche une collection en fonction de paramêtres
* @return array un tableau contenant des objets d'informations sur les collections
*/
public function chercher($parametres) {
$url = $this->construireUrlRecherche('ParDefaut', $parametres);
$json = $this->envoyerRequeteConsultation($url);
$donnees = json_decode($json, true);
return $donnees;
}
private function construireUrlRecherche($type, $parametres, $limitation = true) {
$url = $this->url_jrest.self::SERVICE.'/'.$type;
$params_a_passer = array('mots', 'sci', 'bot', 'zg', 'p', 'pr', 'str-d', 'veg');
foreach ($params_a_passer as $param_cle) {
if (isset($parametres[$param_cle]) && $parametres[$param_cle] != '') {
$valeur = urlencode(trim($parametres[$param_cle]));
$url .= '/'.$valeur;
} else {
$url .= '/*';
}
}
return $url;
}
}
?>
Property changes:
Added: svn:keywords
+Id Author Date Revision HeadURL
\ No newline at end of property
/trunk/controleurs/Recherche.php
86,7 → 86,7
*/
public function rechercher() {
$donnees = array();
$rechercheDao = $this->getModele('RechercheDao');
$rechercheDao = new RechercheDao();
$parametres = array('mots' => '*');
// Récupération des paramêtres de l'url