Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 156 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 165
Line 3... Line 3...
3
	
3
	
4
	//+----------------------------------------------------------------------------------------------------------------+
4
	//+----------------------------------------------------------------------------------------------------------------+
5
	// Méthodes
5
	// Méthodes
6
	protected $nom = null;
6
	protected $nom = null;
-
 
7
	protected $type_nom = 'nom_scientifique';
7
	protected $type_nom = 'nom_scientifique';
8
	protected $type_resultat = '';
8
	protected $submit = '';
9
	protected $submit = '';
9
	public function initialiser() {
10
	public function initialiser() {
10
		$this->capturerParametres();
11
		$this->capturerParametres();
11
	}
12
	}
Line 45... Line 46...
45
	private function rechercherNom() {
46
	private function rechercherNom() {
46
		$noms = ($this->type_nom == 'nom_vernaculaire') 
47
		$noms = ($this->type_nom == 'nom_vernaculaire') 
47
				? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) 
48
				? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) 
48
				: new Noms(Registre::get('parametres.referentiel'));
49
				: new Noms(Registre::get('parametres.referentiel'));
49
		$approche = '';
50
		$approche = '';
50
		$res = $noms->getRechercheEtendue($this->nom);
51
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
51
		$form = I18n::get('Recherche-form-nom');
52
		$form = I18n::get('Recherche-form-nom');
52
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
53
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
53
			$approche = $this->rechercherNomApproche($noms);
54
			$approche = $this->rechercherNomApproche($noms);
54
		} elseif ($res['entete']['total'] == 1 || $this->submit == $form['fiche']) { // renvoie à la fiche
55
		} elseif ($res['entete']['total'] == 1 || $this->submit == $form['fiche']) { // renvoie à la fiche
55
			$ids = array_keys($res['resultat']);
56
			$ids = array_keys($res['resultat']);
Line 88... Line 89...
88
		}
89
		}
Line 89... Line 90...
89
		
90
		
90
		if (isset($_GET['submit'])) {
91
		if (isset($_GET['submit'])) {
91
			$this->submit = urldecode($_GET['submit']);
92
			$this->submit = urldecode($_GET['submit']);
-
 
93
		}
-
 
94
		
-
 
95
		if (isset($_GET['resultat'])) {
-
 
96
			$this->type_resultat = urldecode($_GET['resultat']);
-
 
97
		} else {
-
 
98
			$onglet_resultat = $this->recupererTableauConfig('affich_resultats');
-
 
99
			$this->type_resultat = $onglet_resultat[Registre::get('parametres.niveau').'_'.$this->type_nom];
-
 
100
		}
-
 
101
	}
-
 
102
	
-
 
103
	protected function recupererTableauConfig($param) {
-
 
104
		$tableau = array();
-
 
105
		$tableauPartiel = explode(',', Config::get($param));
-
 
106
		$tableauPartiel = array_map('trim', $tableauPartiel);
-
 
107
		foreach ($tableauPartiel as $champ) {
-
 
108
			if (strpos($champ, '=') === false) {
-
 
109
				$tableau[] = $champ;
-
 
110
			} else {
-
 
111
				list($cle, $val) = explode('=', $champ);
-
 
112
				$tableau[$cle] = $val;
-
 
113
			}
-
 
114
		}
92
		}
115
		return $tableau;
Line 93... Line 116...
93
	}
116
	}
94
	
117
	
95
}
118
}