Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 720 Rev 729
Line 5... Line 5...
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 $type_resultat = '';
9
	protected $submit = '';
9
	protected $submit = '';
-
 
10
	private $recherche_avancee;
-
 
11
	private $param;
-
 
12
	private $i18n =  array();
-
 
13
	
10
	public function initialiser() {
14
	public function initialiser() {
11
		$this->capturerParametres();
15
		$this->capturerParametres();
-
 
16
		$this->capturerParametresAvances();	
-
 
17
		$this->i18n = I18n::get('Recherche-form-avancee');
12
	}
18
	}
-
 
19
	
13
	/**
20
	/**
14
	 * Fonction d'affichage par défaut
21
	 * Fonction d'affichage par défaut
15
	 */
22
	 */
16
	public function executerActionParDefaut() {
23
	public function executerActionParDefaut() {
17
		$this->executerAccueil();
24
		$this->executerAccueil();
Line 20... Line 27...
20
	public function executerAccueil($donneesMoteur = array()) {
27
	public function executerAccueil($donneesMoteur = array()) {
21
		$niveau = new Niveau();
28
		$niveau = new Niveau();
22
		$donnees['form_niveau'] = $niveau->afficherNiveau();
29
		$donnees['form_niveau'] = $niveau->afficherNiveau();
23
		$recherchesimple = new RechercheSimple();
30
		$recherchesimple = new RechercheSimple();
24
		$donnees['form_nom'] = $recherchesimple->executerFormulaireNom($donneesMoteur);
31
		$donnees['form_nom'] = $recherchesimple->executerFormulaireNom($donneesMoteur);
-
 
32
		if (Registre::get('parametres.niveau') != 1) {
-
 
33
			$recherche_avancee = new RechercheAvancee();
-
 
34
			$donnees['form_recherche_av'] = $recherche_avancee->executerFormulaireRechercheAv($donneesMoteur);
-
 
35
		}
25
		$this->afficherAccueil($donnees);
36
		$this->afficherAccueil($donnees);
26
	}
37
	}
Line 27... Line 38...
27
	
38
	
28
	private function afficherAccueil($donnees) {
39
	private function afficherAccueil($donnees) {
29
		$donnees['i18n'] = I18n::get('Recherche-accueil');
40
		$donnees['i18n'] = I18n::get('Recherche-accueil');
30
		$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees), true);
41
		$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees), true);
Line -... Line 42...
-
 
42
	}
-
 
43
 
-
 
44
	
-
 
45
	//+---------------------------------------------recherche avancee-------------------------------------+	
-
 
46
	public function executerRechercheAvancee() {
-
 
47
		$donnees['param'] = $this->param;
-
 
48
		$presence = $this->rechercherCriteresDemandes();
-
 
49
			if (empty($presence) && !empty($this->param)) {
-
 
50
				$donnees['message_av']['attention'] = 'info_res_vide';
-
 
51
				} 
-
 
52
		$this->executerAccueil($donnees);
-
 
53
		if (Registre::get('resultats')) {
-
 
54
			$_GET['resultat'] = $this->type_resultat;
-
 
55
			$this->executerAction('Resultat', 'executerResultat');
-
 
56
		}
-
 
57
	}
-
 
58
	
-
 
59
	public function rechercherCriteresDemandes() {
-
 
60
		$noms = new Noms(Registre::get('parametres.referentiel'));
-
 
61
		$res = $noms->getRechercheAvancee($this->param);
-
 
62
		if ($res != false || $res['entete']['total'] != 0) {
-
 
63
			if ($res['entete']['total'] == 1 ) {
-
 
64
				$ids = array_keys($res['resultat']);
-
 
65
				$nom = $res['resultat'][$ids[0]]['nom_sci'];
-
 
66
				$url = $this->urls->obtenirUrlFiche($ids[0], 'nom_scientifique', $nom);
-
 
67
				$this->redirigerVers($url);
-
 
68
			} else {
-
 
69
			$res['type'] = $this->type_nom;
-
 
70
			Registre::set('resultats', $res);
-
 
71
			}
-
 
72
		} else {
-
 
73
			$res = '';
-
 
74
		}
-
 
75
		return $res;
-
 
76
	}
31
	}
77
	
32
 
78
	//+---------------------------------------------recherche simple-------------------------------------+
33
	public function executerRechercheSimple() {
79
	public function executerRechercheSimple() {
34
		$donnees['type_nom'] = $this->type_nom;
80
		$donnees['type_nom'] = $this->type_nom;
35
		$donnees['nom'] = $this->nom;
81
		$donnees['nom'] = $this->nom;
Line 57... Line 103...
57
			$_GET['resultat'] = $this->type_resultat;
103
			$_GET['resultat'] = $this->type_resultat;
58
			$this->executerAction('Resultat', 'executerResultat');
104
			$this->executerAction('Resultat', 'executerResultat');
59
		}
105
		}
60
	}
106
	}
Line -... Line 107...
-
 
107
	
61
	
108
	
62
	// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché
109
	// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché
63
	// $noms classe métier nom ou nom
110
	// $noms classe métier nom ou nom
64
	private function rechercherNom() {
111
	private function rechercherNom() {
65
		$noms = ($this->type_nom == 'nom_vernaculaire') 
112
		$noms = ($this->type_nom == 'nom_vernaculaire') 
Line 113... Line 160...
113
			}
160
			}
114
		}
161
		}
115
		return $approche;
162
		return $approche;
116
	}
163
	}
Line -... Line 164...
-
 
164
	
Line 117... Line 165...
117
	
165
	//+-----------------------------------------------méthodes utiles---------------------------------+
118
	
166
	
119
	private function capturerParametres() {
167
	private function capturerParametres() {
120
		if (isset($_REQUEST['nom'])) {
168
		if (isset($_REQUEST['nom'])) {
121
			$this->nom = $_REQUEST['nom'];
169
			$this->nom = $_REQUEST['nom'];
122
		}
170
		}
123
		if (isset($_GET['type_nom'])) {
171
		if (isset($_GET['type_nom'])) {
124
			$this->type_nom = $_GET['type_nom'];
-
 
125
		}
172
			$this->type_nom = $_GET['type_nom'];
126
		
173
		}
127
		if (isset($_GET['submit'])) {
174
		if (isset($_GET['submit'])) {
128
			$this->submit = urldecode($_GET['submit']);
-
 
129
		}
175
			$this->submit = urldecode($_GET['submit']);
130
		
176
		}
131
		if (isset($_GET['niveau'])) {
177
		if (isset($_GET['niveau'])) {
132
			Registre::set('parametres.niveau', $_GET['niveau']);
-
 
133
		}
178
			Registre::set('parametres.niveau', $_GET['niveau']);
134
		
179
		}
135
		if (isset($_GET['resultat'])) {
180
		if (isset($_GET['resultat'])) {
136
			$this->type_resultat = urldecode($_GET['resultat']);
181
			$this->type_resultat = urldecode($_GET['resultat']);
137
		} else {
182
		} else {
138
			$onglet_resultat = $this->recupererTableauConfig('affich_resultats');
183
			$onglet_resultat = $this->recupererTableauConfig('affich_resultats');
139
			$this->type_resultat = $onglet_resultat[Registre::get('parametres.niveau').'_'.$this->type_nom];
184
			$this->type_resultat = $onglet_resultat[Registre::get('parametres.niveau').'_'.$this->type_nom];
Line -... Line 185...
-
 
185
		}
-
 
186
	}
-
 
187
	
-
 
188
	private function capturerParametresAvances() {
-
 
189
		if (isset($_GET['gen']) && $_GET['gen'] != '') {
-
 
190
			$this->param['gen'] = urldecode($_GET['gen']);
-
 
191
		}
-
 
192
		if (isset($_GET['fam']) && $_GET['fam'] != '') {
-
 
193
			$this->param['fam'] = urldecode($_GET['fam']);
-
 
194
		}
-
 
195
		if (isset($_GET['au']) && $_GET['au'] != '' 
-
 
196
			&& $_GET['au'] != urlencode($this->i18n['valeur-form-auteur'])) {
-
 
197
			$this->param['au'] = urldecode($_GET['au']);
-
 
198
		}
-
 
199
		if (isset($_GET['bib']) && $_GET['bib'] != ''
-
 
200
			&& $_GET['bib'] != urlencode($this->i18n['valeur-form-bib'])) {
-
 
201
			$this->param['bib'] = urldecode($_GET['bib']);
-
 
202
		}
-
 
203
		if (isset($_GET['nn']) && $_GET['nn'] != '') {
-
 
204
			$this->param['nn'] = urldecode($_GET['nn']);
-
 
205
		}
-
 
206
		if (isset($_GET['nt']) && $_GET['nt'] != '') {
-
 
207
			$this->param['nt'] = urldecode($_GET['nt']);
-
 
208
		}
-
 
209
		if (isset($_GET['sp']) && $_GET['sp'] != '') {
-
 
210
			$this->param['sp'] = urldecode($_GET['sp']);
-
 
211
		}
-
 
212
		if (isset($_GET['ssp']) && $_GET['ssp'] != '') {
-
 
213
			$this->param['ssp'] = urldecode($_GET['ssp']);
-
 
214
		}
-
 
215
		if (isset($_GET['type']) && $_GET['type'] != '') {
-
 
216
			$this->param['type'] = urldecode($_GET['type']);
-
 
217
		}
-
 
218
		if (isset($_GET['and']) && $_GET['and'] != ''
-
 
219
			&& $_GET['and'] != urlencode($this->i18n['valeur-form-date'])) {
-
 
220
			$this->param['and'] = urldecode($_GET['and']);
-
 
221
		}
-
 
222
		if (isset($_GET['anf']) && $_GET['anf'] != ''
-
 
223
			&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
-
 
224
			$this->param['anf'] = urldecode($_GET['anf']);
-
 
225
		}
-
 
226
		if (isset($_GET['prga']) && $_GET['prga'] != '') {
-
 
227
			$this->param['prga'] = urldecode($_GET['prga']);
-
 
228
		}
-
 
229
		if (isset($_GET['prco']) && $_GET['prco'] != '') {
-
 
230
			$this->param['prco'] = urldecode($_GET['prco']);
-
 
231
		}
-
 
232
		if (isset($_GET['sto']) && $_GET['sto'] != '') {
-
 
233
			$this->param['sto'] = urldecode($_GET['sto']);
-
 
234
		}
-
 
235
		if (isset($_GET['sti']) && $_GET['sti'] != '') {
-
 
236
			$this->param['sti'] = urldecode($_GET['sti']);
-
 
237
		}
-
 
238
		if (isset($_GET['stc']) && $_GET['stc'] != '') {
-
 
239
			$this->param['stc'] = urldecode($_GET['stc']);
140
		}
240
		}
141
	}
241
	}
142
	
242
	
143
	protected function recupererTableauConfig($param) {
243
	protected function recupererTableauConfig($param) {
144
		$tableau = array();
244
		$tableau = array();