Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 728 → Rev 729

/trunk/modules/recherche/Recherche.php
7,9 → 7,16
protected $type_nom = 'nom_scientifique';
protected $type_resultat = '';
protected $submit = '';
private $recherche_avancee;
private $param;
private $i18n = array();
public function initialiser() {
$this->capturerParametres();
$this->capturerParametresAvances();
$this->i18n = I18n::get('Recherche-form-avancee');
}
/**
* Fonction d'affichage par défaut
*/
22,6 → 29,10
$donnees['form_niveau'] = $niveau->afficherNiveau();
$recherchesimple = new RechercheSimple();
$donnees['form_nom'] = $recherchesimple->executerFormulaireNom($donneesMoteur);
if (Registre::get('parametres.niveau') != 1) {
$recherche_avancee = new RechercheAvancee();
$donnees['form_recherche_av'] = $recherche_avancee->executerFormulaireRechercheAv($donneesMoteur);
}
$this->afficherAccueil($donnees);
}
30,6 → 41,41
$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees), true);
}
 
//+---------------------------------------------recherche avancee-------------------------------------+
public function executerRechercheAvancee() {
$donnees['param'] = $this->param;
$presence = $this->rechercherCriteresDemandes();
if (empty($presence) && !empty($this->param)) {
$donnees['message_av']['attention'] = 'info_res_vide';
}
$this->executerAccueil($donnees);
if (Registre::get('resultats')) {
$_GET['resultat'] = $this->type_resultat;
$this->executerAction('Resultat', 'executerResultat');
}
}
public function rechercherCriteresDemandes() {
$noms = new Noms(Registre::get('parametres.referentiel'));
$res = $noms->getRechercheAvancee($this->param);
if ($res != false || $res['entete']['total'] != 0) {
if ($res['entete']['total'] == 1 ) {
$ids = array_keys($res['resultat']);
$nom = $res['resultat'][$ids[0]]['nom_sci'];
$url = $this->urls->obtenirUrlFiche($ids[0], 'nom_scientifique', $nom);
$this->redirigerVers($url);
} else {
$res['type'] = $this->type_nom;
Registre::set('resultats', $res);
}
} else {
$res = '';
}
return $res;
}
//+---------------------------------------------recherche simple-------------------------------------+
public function executerRechercheSimple() {
$donnees['type_nom'] = $this->type_nom;
$donnees['nom'] = $this->nom;
59,6 → 105,7
}
}
// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché
// $noms classe métier nom ou nom
private function rechercherNom() {
115,6 → 162,7
return $approche;
}
//+-----------------------------------------------méthodes utiles---------------------------------+
private function capturerParametres() {
if (isset($_REQUEST['nom'])) {
123,15 → 171,12
if (isset($_GET['type_nom'])) {
$this->type_nom = $_GET['type_nom'];
}
if (isset($_GET['submit'])) {
$this->submit = urldecode($_GET['submit']);
}
if (isset($_GET['niveau'])) {
Registre::set('parametres.niveau', $_GET['niveau']);
}
if (isset($_GET['resultat'])) {
$this->type_resultat = urldecode($_GET['resultat']);
} else {
140,6 → 185,61
}
}
private function capturerParametresAvances() {
if (isset($_GET['gen']) && $_GET['gen'] != '') {
$this->param['gen'] = urldecode($_GET['gen']);
}
if (isset($_GET['fam']) && $_GET['fam'] != '') {
$this->param['fam'] = urldecode($_GET['fam']);
}
if (isset($_GET['au']) && $_GET['au'] != ''
&& $_GET['au'] != urlencode($this->i18n['valeur-form-auteur'])) {
$this->param['au'] = urldecode($_GET['au']);
}
if (isset($_GET['bib']) && $_GET['bib'] != ''
&& $_GET['bib'] != urlencode($this->i18n['valeur-form-bib'])) {
$this->param['bib'] = urldecode($_GET['bib']);
}
if (isset($_GET['nn']) && $_GET['nn'] != '') {
$this->param['nn'] = urldecode($_GET['nn']);
}
if (isset($_GET['nt']) && $_GET['nt'] != '') {
$this->param['nt'] = urldecode($_GET['nt']);
}
if (isset($_GET['sp']) && $_GET['sp'] != '') {
$this->param['sp'] = urldecode($_GET['sp']);
}
if (isset($_GET['ssp']) && $_GET['ssp'] != '') {
$this->param['ssp'] = urldecode($_GET['ssp']);
}
if (isset($_GET['type']) && $_GET['type'] != '') {
$this->param['type'] = urldecode($_GET['type']);
}
if (isset($_GET['and']) && $_GET['and'] != ''
&& $_GET['and'] != urlencode($this->i18n['valeur-form-date'])) {
$this->param['and'] = urldecode($_GET['and']);
}
if (isset($_GET['anf']) && $_GET['anf'] != ''
&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
$this->param['anf'] = urldecode($_GET['anf']);
}
if (isset($_GET['prga']) && $_GET['prga'] != '') {
$this->param['prga'] = urldecode($_GET['prga']);
}
if (isset($_GET['prco']) && $_GET['prco'] != '') {
$this->param['prco'] = urldecode($_GET['prco']);
}
if (isset($_GET['sto']) && $_GET['sto'] != '') {
$this->param['sto'] = urldecode($_GET['sto']);
}
if (isset($_GET['sti']) && $_GET['sti'] != '') {
$this->param['sti'] = urldecode($_GET['sti']);
}
if (isset($_GET['stc']) && $_GET['stc'] != '') {
$this->param['stc'] = urldecode($_GET['stc']);
}
}
protected function recupererTableauConfig($param) {
$tableau = array();
$tableauPartiel = explode(',', Config::get($param));