Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1140 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1140 Rev 1143
1
<?php
1
<?php
2
class Recherche extends aControleur {
2
class Recherche extends aControleur {
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 $type_resultat = '';
9
	protected $submit = '';
9
	protected $submit = '';
10
	protected $acces_fiche = false;
10
	protected $acces_fiche = false;
11
	private $recherche_avancee;
11
	private $recherche_avancee;
12
	private $param;
12
	private $param;
13
	private $i18n =	 array();
13
	private $i18n =	 array();
14
	
14
	
15
	private $parametresAvancesGeneriques = array('gen','fam','nn','nt','sp','ssp','type','sto','sti','stc');
15
	private $parametresAvancesGeneriques = array('gen','fam','nn','nt','sp','ssp','type','sto','sti','stc');
16
	
16
	
17
	public function initialiser() {
17
	public function initialiser() {
18
		$this->capturerParametres();
18
		$this->capturerParametres();
19
		$this->capturerParametresAvances();	
19
		$this->capturerParametresAvances();	
20
		$this->i18n = I18n::get('Recherche-form-avancee');
20
		$this->i18n = I18n::get('Recherche-form-avancee');
21
	}
21
	}
22
	
22
	
23
	/**
23
	/**
24
	 * Fonction d'affichage par défaut
24
	 * Fonction d'affichage par défaut
25
	 */
25
	 */
26
	public function executerActionParDefaut() {
26
	public function executerActionParDefaut() {
27
		$this->executerAccueil();
27
		$this->executerAccueil();
28
	}
28
	}
29
	
29
	
30
	public function executerAccueil($donneesMoteur = array()) {
30
	public function executerAccueil($donneesMoteur = array()) {
-
 
31
		
-
 
32
		$meta = new MetaDonnees();
-
 
33
		$meta->setProjet(Registre::get('parametres.referentiel'));
-
 
34
		$metadonnees = $meta->getMetaDonnees();
-
 
35
		$donneesMoteur['metadonnees_referentiel'] = $metadonnees[0];
-
 
36
		
31
		$niveau = new Niveau();
37
		$niveau = new Niveau();
32
		$donnees['form_niveau'] = $niveau->afficherNiveau();
38
		$donnees['form_niveau'] = $niveau->afficherNiveau();
33
		$recherchesimple = new RechercheSimple();
39
		$recherchesimple = new RechercheSimple();
34
		$donnees['form_nom'] = $recherchesimple->executerFormulaireNom($donneesMoteur);
40
		$donnees['form_nom'] = $recherchesimple->executerFormulaireNom($donneesMoteur);
35
		if (Registre::get('parametres.niveau') != 1) {
41
		if (Registre::get('parametres.niveau') != 1) {
36
			$recherche_avancee = new RechercheAvancee();
42
			$recherche_avancee = new RechercheAvancee();
37
			$donnees['form_recherche_av'] = $recherche_avancee->executerFormulaireRechercheAv($donneesMoteur);
43
			$donnees['form_recherche_av'] = $recherche_avancee->executerFormulaireRechercheAv($donneesMoteur);
38
		}
44
		}
39
		$donnees['description'] = "";
45
		$donnees['description'] = "";
40
 
46
 
41
		// le descriptif du référentiel est affiché lorsque seul le moteur est affiché (donc ni résultats, ni fiche)
47
		// le descriptif du référentiel est affiché lorsque seul le moteur est affiché (donc ni résultats, ni fiche)
42
		if(Registre::get('parametres.module') == 'recherche' && 
48
		if(Registre::get('parametres.module') == 'recherche' && 
43
			Registre::get('parametres.action') == 'action-par-defaut' &&
49
			Registre::get('parametres.action') == 'action-par-defaut' &&
44
			!Registre::get('resultats')) {
50
			!Registre::get('resultats')) {
45
			$referentiel = Registre::get('parametres.referentiel');
51
			$referentiel = Registre::get('parametres.referentiel');
46
			$wiki = new Wikini();
52
			$wiki = new Wikini();
47
			$description = $wiki->getDescriptionReferentielFormate($referentiel);
53
			$description = $wiki->getDescriptionReferentielFormate($referentiel);
48
			$donnees['description'] = $description;
54
			$donnees['description'] = $description;
49
		}
55
		}
50
		$this->afficherAccueil($donnees);
56
		$this->afficherAccueil($donnees);
51
	}
57
	}
52
	
58
	
53
	private function afficherAccueil($donnees) {
59
	private function afficherAccueil($donnees) {
54
		$donnees['i18n'] = I18n::get('Recherche-accueil');
60
		$donnees['i18n'] = I18n::get('Recherche-accueil');
55
		$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees), true);
61
		$this->setSortie(self::RENDU_CORPS, $this->getVue('recherche_accueil', $donnees), true);
56
	}
62
	}
57
 
63
 
58
	
64
	
59
	//+---------------------------------------------recherche avancee-------------------------------------+	
65
	//+---------------------------------------------recherche avancee-------------------------------------+	
60
	public function executerRechercheAvancee() {
66
	public function executerRechercheAvancee() {
61
		$this->param = $this->nettoyerParametresDefautRechercheAvancee($this->param);
67
		$this->param = $this->nettoyerParametresDefautRechercheAvancee($this->param);
62
		$donnees['param'] = $this->param;
68
		$donnees['param'] = $this->param;
63
		$presence = $this->rechercherCriteresDemandes();
69
		$presence = $this->rechercherCriteresDemandes();
64
		if (empty($presence) && !empty($this->param)) {
70
		if (empty($presence) && !empty($this->param)) {
65
			$donnees['message_av']['attention'] = 'info_res_vide';
71
			$donnees['message_av']['attention'] = 'info_res_vide';
66
		} 
72
		} 
67
		$this->executerAccueil($donnees);
73
		$this->executerAccueil($donnees);
68
		if (Registre::get('resultats')) {
74
		if (Registre::get('resultats')) {
69
			$_GET['resultat'] = $this->type_resultat;
75
			$_GET['resultat'] = $this->type_resultat;
70
			$this->executerAction('Resultat', 'executerResultat');
76
			$this->executerAction('Resultat', 'executerResultat');
71
		}
77
		}
72
	}
78
	}
73
 
79
 
74
	private function nettoyerParametresDefautRechercheAvancee($params) {
80
	private function nettoyerParametresDefautRechercheAvancee($params) {
75
		$params_nettoyes = array();
81
		$params_nettoyes = array();
76
		foreach ($params as $cle => $param) {
82
		foreach ($params as $cle => $param) {
77
			if(!preg_match("#^\(.*\)$#", $param)) {
83
			if(!preg_match("#^\(.*\)$#", $param)) {
78
				$params_nettoyes[$cle] = $param;
84
				$params_nettoyes[$cle] = $param;
79
			}
85
			}
80
		}
86
		}
81
		return $params_nettoyes;
87
		return $params_nettoyes;
82
	}
88
	}
83
	
89
	
84
	public function rechercherCriteresDemandes() {
90
	public function rechercherCriteresDemandes() {
85
		$noms = new Noms(Registre::get('parametres.referentiel'));
91
		$noms = new Noms(Registre::get('parametres.referentiel'));
86
		$res = $noms->getRechercheAvancee($this->param);
92
		$res = $noms->getRechercheAvancee($this->param);
87
		if ($res != false || $res['entete']['total'] != 0) {
93
		if ($res != false || $res['entete']['total'] != 0) {
88
			if ($res['entete']['total'] == 1 ) {
94
			if ($res['entete']['total'] == 1 ) {
89
				$ids = array_keys($res['resultat']);
95
				$ids = array_keys($res['resultat']);
90
				$nom = $res['resultat'][$ids[0]]['nom_sci'];
96
				$nom = $res['resultat'][$ids[0]]['nom_sci'];
91
				$url = $this->urls->obtenirUrlFiche($ids[0], 'nom_scientifique', $nom);
97
				$url = $this->urls->obtenirUrlFiche($ids[0], 'nom_scientifique', $nom);
92
				$this->redirigerVers($url);
98
				$this->redirigerVers($url);
93
			} else {
99
			} else {
94
			$res['type'] = $this->type_nom;
100
			$res['type'] = $this->type_nom;
95
			Registre::set('resultats', $res);
101
			Registre::set('resultats', $res);
96
			}
102
			}
97
		} else {
103
		} else {
98
			$res = '';
104
			$res = '';
99
		}
105
		}
100
		return $res;
106
		return $res;
101
	}
107
	}
102
	
108
	
103
	//+---------------------------------------------recherche simple-------------------------------------+
109
	//+---------------------------------------------recherche simple-------------------------------------+
104
	/*
110
	/*
105
	  grep-friendly: ICI->executerRechercheSimple()
111
	  grep-friendly: ICI->executerRechercheSimple()
106
	  En effet, cette méthode n'est jamais invoquée explicitement.
112
	  En effet, cette méthode n'est jamais invoquée explicitement.
107
	  Le processus est le suivant:
113
	  Le processus est le suivant:
108
	  * URL = index.php?type_nom=...&referentiel=..&module=recherche&action=rechercheSimple
114
	  * URL = index.php?type_nom=...&referentiel=..&module=recherche&action=rechercheSimple
109
	  * AppControleur::initialiser()
115
	  * AppControleur::initialiser()
110
	  * `-> AppControleur::$parametres['action'] = $_GET['action']
116
	  * `-> AppControleur::$parametres['action'] = $_GET['action']
111
	  * `-> AppControleur::executerModule()
117
	  * `-> AppControleur::executerModule()
112
	  *	 `-> effecture $module->$action()
118
	  *	 `-> effecture $module->$action()
113
	  * qui nous appelle ici
119
	  * qui nous appelle ici
114
	 */
120
	 */
115
	public function executerRechercheSimple() {
121
	public function executerRechercheSimple() {
116
		$donnees['type_nom'] = $this->type_nom;
122
		$donnees['type_nom'] = $this->type_nom;
117
		$donnees['nom'] = $this->nom;
123
		$donnees['nom'] = $this->nom;
118
		if (strlen($donnees['nom']) < 3) {
124
		if (strlen($donnees['nom']) < 3) {
119
			$donnees['message']['attention'] = 'info_nb_lettres';
125
			$donnees['message']['attention'] = 'info_nb_lettres';
120
		} else {
126
		} else {
121
			$presence = $this->rechercherNom();
127
			$presence = $this->rechercherNom();
122
			if ($presence == '') { // s'il n'y a pas de nom
128
			if ($presence == '') { // s'il n'y a pas de nom
123
				$donnees['message']['attention'] = 'info_sp_abs';
129
				$donnees['message']['attention'] = 'info_sp_abs';
124
			} elseif ($presence == 'sans_correspondance') {
130
			} elseif ($presence == 'sans_correspondance') {
125
				$res = Registre::get('resultats');
131
				$res = Registre::get('resultats');
126
				$id = array_keys($res['resultat']);
132
				$id = array_keys($res['resultat']);
127
				$donnees['message']['nom_ss_corresp']['id'] = $id[0];
133
				$donnees['message']['nom_ss_corresp']['id'] = $id[0];
128
				$nom = array_shift($res['resultat']);
134
				$nom = array_shift($res['resultat']);
129
				$donnees['message']['nom_ss_corresp']['nom'] = $nom['nom_sci'];
135
				$donnees['message']['nom_ss_corresp']['nom'] = $nom['nom_sci'];
130
			} elseif ($presence != 'ok') { // s'il y a des noms approchés
136
			} elseif ($presence != 'ok') { // s'il y a des noms approchés
131
				if (!Registre::get('resultats')) { // s'il n'y a aucun nom exact
137
				if (!Registre::get('resultats')) { // s'il n'y a aucun nom exact
132
					$donnees['message']['attention'] = 'info_sp_abs';
138
					$donnees['message']['attention'] = 'info_sp_abs';
133
				}
139
				}
134
				$donnees['message']['nom_approche'] = $presence;
140
				$donnees['message']['nom_approche'] = $presence;
135
			}
141
			}
136
		}
142
		}
137
 
143
 
138
		$this->executerAccueil($donnees);
144
		$this->executerAccueil($donnees);
139
		if (Registre::get('resultats')) {
145
		if (Registre::get('resultats')) {
140
			$_GET['resultat'] = $this->type_resultat;
146
			$_GET['resultat'] = $this->type_resultat;
141
			$this->executerAction('Resultat', 'executerResultat');
147
			$this->executerAction('Resultat', 'executerResultat');
142
		}
148
		}
143
	}
149
	}
144
	
150
	
145
	
151
	
146
	// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché
152
	// regarde si il y a des résultats correspondant au nom recherché sinon recherche un nom approché
147
	// $noms classe métier nom ou nom
153
	// $noms classe métier nom ou nom
148
	private function rechercherNom() {
154
	private function rechercherNom() {
149
		$noms = ($this->type_nom == 'nom_vernaculaire') 
155
		$noms = ($this->type_nom == 'nom_vernaculaire') 
150
				? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) 
156
				? new NomsVernaculaires(Config::get(Registre::get('parametres.referentiel').'.referentielVerna')) 
151
				: new Noms(Registre::get('parametres.referentiel'));
157
				: new Noms(Registre::get('parametres.referentiel'));
152
		$approche = '';
158
		$approche = '';
153
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
159
		$res = $noms->getRechercheEtendue($this->nom, $this->type_resultat);
154
		$form = I18n::get('Recherche-form-nom');
160
		$form = I18n::get('Recherche-form-nom');
155
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
161
		if ($res == false || $res['entete']['total'] == 0) { // recherche nom approché
156
			$approche = $this->rechercherNomApproche($noms);
162
			$approche = $this->rechercherNomApproche($noms);
157
		} elseif ($res['entete']['total'] == 1 || $this->acces_fiche) { // renvoie à la fiche
163
		} elseif ($res['entete']['total'] == 1 || $this->acces_fiche) { // renvoie à la fiche
158
			$approche = $this->traiterAccesFiche($res);
164
			$approche = $this->traiterAccesFiche($res);
159
		} else { // affiche les résultats
165
		} else { // affiche les résultats
160
			$res['type'] = $this->type_nom;
166
			$res['type'] = $this->type_nom;
161
			Registre::set('resultats', $res);
167
			Registre::set('resultats', $res);
162
			$approche = 'ok';
168
			$approche = 'ok';
163
			if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché
169
			if ($res['entete']['total'] < 3) { // si moins de 16 noms affiche en plus un nom approché
164
				$approche = $this->rechercherNomApproche($noms);
170
				$approche = $this->rechercherNomApproche($noms);
165
			}
171
			}
166
		}
172
		}
167
		return $approche;
173
		return $approche;
168
	}
174
	}
169
	
175
	
170
	private function traiterAccesFiche($res) {
176
	private function traiterAccesFiche($res) {
171
		$ids = array_keys($res['resultat']);
177
		$ids = array_keys($res['resultat']);
172
		if ($this->type_nom == 'nom_vernaculaire') {
178
		if ($this->type_nom == 'nom_vernaculaire') {
173
			$id = explode(':',$res['resultat'][$ids[0]]['nom_retenu.code']);
179
			$id = explode(':',$res['resultat'][$ids[0]]['nom_retenu.code']);
174
			$id = $id[1];
180
			$id = $id[1];
175
		} else {
181
		} else {
176
			if ($res['resultat'][$ids[0]]['retenu'] == 'absent') { // dans le cas d'un nom sans correspondance
182
			if ($res['resultat'][$ids[0]]['retenu'] == 'absent') { // dans le cas d'un nom sans correspondance
177
				$res['type'] = $this->type_nom;
183
				$res['type'] = $this->type_nom;
178
				Registre::set('resultats', $res);
184
				Registre::set('resultats', $res);
179
				$approche = 'sans_correspondance';
185
				$approche = 'sans_correspondance';
180
				return $approche;
186
				return $approche;
181
			} else {
187
			} else {
182
				$id = $ids[0];
188
				$id = $ids[0];
183
			}
189
			}
184
		}
190
		}
185
		$url = $this->urls->obtenirUrlFiche($id, $this->type_nom, $this->nom);
191
		$url = $this->urls->obtenirUrlFiche($id, $this->type_nom, $this->nom);
186
		$this->redirigerVers($url);
192
		$this->redirigerVers($url);
187
	}
193
	}
188
	
194
	
189
	private function rechercherNomApproche($noms) {
195
	private function rechercherNomApproche($noms) {
190
		$approche = '';
196
		$approche = '';
191
		$res = $noms->getRechercheFloue($this->nom);
197
		$res = $noms->getRechercheFloue($this->nom);
192
		if (!($res == false || $res['entete']['total'] == 0)) {
198
		if (!($res == false || $res['entete']['total'] == 0)) {
193
			for ($i = 0; $i < 3; $i++) {
199
			for ($i = 0; $i < 3; $i++) {
194
				$nom_proche = array_shift($res['resultat']);
200
				$nom_proche = array_shift($res['resultat']);
195
				$approche[$i]['nom'] = ($this->type_nom == 'nom_vernaculaire') ? $nom_proche['nom'] : $nom_proche['nom_sci'];
201
				$approche[$i]['nom'] = ($this->type_nom == 'nom_vernaculaire') ? $nom_proche['nom'] : $nom_proche['nom_sci'];
196
				$approche[$i]['url_nom_approche'] = $this->urls->obtenirUrlRechercheSimple($approche[$i]['nom'], $this->type_nom);
202
				$approche[$i]['url_nom_approche'] = $this->urls->obtenirUrlRechercheSimple($approche[$i]['nom'], $this->type_nom);
197
			}
203
			}
198
		}
204
		}
199
		return $approche;
205
		return $approche;
200
	}
206
	}
201
	
207
	
202
	//+-----------------------------------------------méthodes utiles---------------------------------+
208
	//+-----------------------------------------------méthodes utiles---------------------------------+
203
	
209
	
204
	private function capturerParametres() {
210
	private function capturerParametres() {
205
		if (isset($_REQUEST['nom'])) {
211
		if (isset($_REQUEST['nom'])) {
206
			$this->nom = $this->convertirEncodageEntree(urldecode($_REQUEST['nom']));
212
			$this->nom = $this->convertirEncodageEntree(urldecode($_REQUEST['nom']));
207
		}
213
		}
208
		if (isset($_GET['type_nom'])) {
214
		if (isset($_GET['type_nom'])) {
209
			$this->type_nom = $this->convertirEncodageEntree(urldecode($_GET['type_nom']));
215
			$this->type_nom = $this->convertirEncodageEntree(urldecode($_GET['type_nom']));
210
		}
216
		}
211
		if (isset($_GET['submit'])) {
217
		if (isset($_GET['submit'])) {
212
			$this->submit = $this->convertirEncodageEntree(urldecode($_GET['submit']));
218
			$this->submit = $this->convertirEncodageEntree(urldecode($_GET['submit']));
213
		}
219
		}
214
		if(isset($_GET['acces_fiche'])) {
220
		if(isset($_GET['acces_fiche'])) {
215
			$this->acces_fiche = true;
221
			$this->acces_fiche = true;
216
		}
222
		}
217
		if (isset($_GET['niveau'])) {
223
		if (isset($_GET['niveau'])) {
218
			Registre::set('parametres.niveau', $this->convertirEncodageEntree($_GET['niveau']));
224
			Registre::set('parametres.niveau', $this->convertirEncodageEntree($_GET['niveau']));
219
		}
225
		}
220
		if (isset($_GET['resultat'])) {
226
		if (isset($_GET['resultat'])) {
221
			$this->type_resultat = $this->convertirEncodageEntree(urldecode($_GET['resultat']));
227
			$this->type_resultat = $this->convertirEncodageEntree(urldecode($_GET['resultat']));
222
		} else {
228
		} else {
223
			$onglet_resultat = $this->recupererTableauConfig('affich_resultats');
229
			$onglet_resultat = $this->recupererTableauConfig('affich_resultats');
224
			$this->type_resultat = $onglet_resultat[Registre::get('parametres.niveau').'_'.$this->type_nom];
230
			$this->type_resultat = $onglet_resultat[Registre::get('parametres.niveau').'_'.$this->type_nom];
225
		}
231
		}
226
	}
232
	}
227
	
233
	
228
	private function capturerParametresAvances() {
234
	private function capturerParametresAvances() {
229
		$this->capturerParametresAvancesGeneriques();
235
		$this->capturerParametresAvancesGeneriques();
230
		$this->capturerParametresAvancesDependantsLangage();
236
		$this->capturerParametresAvancesDependantsLangage();
231
		$this->capturerParametresAvancesPresenceSpecifiques();
237
		$this->capturerParametresAvancesPresenceSpecifiques();
232
	}
238
	}
233
	
239
	
234
	private function capturerParametresAvancesGeneriques() {
240
	private function capturerParametresAvancesGeneriques() {
235
		foreach($this->parametresAvancesGeneriques as $param) {
241
		foreach($this->parametresAvancesGeneriques as $param) {
236
			if (isset($_GET[$param]) && $_GET[$param] != '') {
242
			if (isset($_GET[$param]) && $_GET[$param] != '') {
237
				$this->param[$param] = $this->convertirEncodageEntree(urldecode($_GET[$param]));
243
				$this->param[$param] = $this->convertirEncodageEntree(urldecode($_GET[$param]));
238
			}
244
			}
239
		}
245
		}
240
	}
246
	}
241
	
247
	
242
	private function capturerParametresAvancesDependantsLangage() {
248
	private function capturerParametresAvancesDependantsLangage() {
243
		if (isset($_GET['au']) && $_GET['au'] != ''
249
		if (isset($_GET['au']) && $_GET['au'] != ''
244
		&& $_GET['au'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-auteur']))) {
250
		&& $_GET['au'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-auteur']))) {
245
			$this->param['au'] = $this->convertirEncodageEntree(urldecode($_GET['au']));
251
			$this->param['au'] = $this->convertirEncodageEntree(urldecode($_GET['au']));
246
		}
252
		}
247
		if (isset($_GET['bib']) && $_GET['bib'] != ''
253
		if (isset($_GET['bib']) && $_GET['bib'] != ''
248
		&& $_GET['bib'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-bib']))) {
254
		&& $_GET['bib'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-bib']))) {
249
			$this->param['bib'] = $this->convertirEncodageEntree(urldecode($_GET['bib']));
255
			$this->param['bib'] = $this->convertirEncodageEntree(urldecode($_GET['bib']));
250
		}
256
		}
251
		if (isset($_GET['and']) && $_GET['and'] != ''
257
		if (isset($_GET['and']) && $_GET['and'] != ''
252
		&& $_GET['and'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-date']))) {
258
		&& $_GET['and'] != $this->convertirEncodageEntree(urlencode($this->i18n['valeur-form-date']))) {
253
			$this->param['and'] = $this->convertirEncodageEntree(urldecode($_GET['and']));
259
			$this->param['and'] = $this->convertirEncodageEntree(urldecode($_GET['and']));
254
		}
260
		}
255
		if (isset($_GET['anf']) && $_GET['anf'] != ''
261
		if (isset($_GET['anf']) && $_GET['anf'] != ''
256
		&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
262
		&& $_GET['anf'] != urlencode($this->i18n['valeur-form-date'])) {
257
			$this->param['anf'] = $this->convertirEncodageEntree(urldecode($_GET['anf']));
263
			$this->param['anf'] = $this->convertirEncodageEntree(urldecode($_GET['anf']));
258
		}
264
		}
259
	}
265
	}
260
	
266
	
261
	private function capturerParametresAvancesPresenceSpecifiques()	 {
267
	private function capturerParametresAvancesPresenceSpecifiques()	 {
262
		$champs_presence = $this->obtenirChampsPresence();
268
		$champs_presence = $this->obtenirChampsPresence();
263
		foreach($champs_presence as $champ) {
269
		foreach($champs_presence as $champ) {
264
			$param = $champ['param'];
270
			$param = $champ['param'];
265
			if (isset($_GET[$param]) && $_GET[$param] != '') {
271
			if (isset($_GET[$param]) && $_GET[$param] != '') {
266
				$this->param[$param] = $this->convertirEncodageEntree(urldecode($_GET[$param]));
272
				$this->param[$param] = $this->convertirEncodageEntree(urldecode($_GET[$param]));
267
			}
273
			}
268
		}
274
		}
269
	}
275
	}
270
	
276
	
271
	private function obtenirChampsPresence() {
277
	private function obtenirChampsPresence() {
272
		$tableau_champs_presence = array();
278
		$tableau_champs_presence = array();
273
		$referentiel = Registre::get('parametres.referentiel');
279
		$referentiel = Registre::get('parametres.referentiel');
274
		$champs_presence_spl = explode('|', Config::get($referentiel.'.champsPresence'));
280
		$champs_presence_spl = explode('|', Config::get($referentiel.'.champsPresence'));
275
		foreach($champs_presence_spl as $champ) {
281
		foreach($champs_presence_spl as $champ) {
276
			$label_param_champ = explode(':', $champ);
282
			$label_param_champ = explode(':', $champ);
277
			$tableau_champs_presence[] = array('param' => $label_param_champ[1],
283
			$tableau_champs_presence[] = array('param' => $label_param_champ[1],
278
														'label' => $label_param_champ[0]);
284
														'label' => $label_param_champ[0]);
279
		}
285
		}
280
		return $tableau_champs_presence;
286
		return $tableau_champs_presence;
281
	}
287
	}
282
	
288
	
283
	protected function recupererTableauConfig($param) {
289
	protected function recupererTableauConfig($param) {
284
		$tableau = array();
290
		$tableau = array();
285
		$tableauPartiel = explode(',', Config::get($param));
291
		$tableauPartiel = explode(',', Config::get($param));
286
		$tableauPartiel = array_map('trim', $tableauPartiel);
292
		$tableauPartiel = array_map('trim', $tableauPartiel);
287
		foreach ($tableauPartiel as $champ) {
293
		foreach ($tableauPartiel as $champ) {
288
			if (strpos($champ, '=') === false) {
294
			if (strpos($champ, '=') === false) {
289
				$tableau[] = $champ;
295
				$tableau[] = $champ;
290
			} else {
296
			} else {
291
				list($cle, $val) = explode('=', $champ);
297
				list($cle, $val) = explode('=', $champ);
292
				$tableau[$cle] = $val;
298
				$tableau[$cle] = $val;
293
			}
299
			}
294
		}
300
		}
295
		return $tableau;
301
		return $tableau;
296
	}
302
	}
297
 
303
 
298
 
304
 
299
	 /**
305
	 /**
300
	 * Convertion des valeurs de requête dans l'encodage de l'application (voir fichier config.ini : appli_encodage),
306
	 * Convertion des valeurs de requête dans l'encodage de l'application (voir fichier config.ini : appli_encodage),
301
	 * A cause d'un bug en cours d'investigation, celle ci utilise des paramètres différents de la fonction de conversion 
307
	 * A cause d'un bug en cours d'investigation, celle ci utilise des paramètres différents de la fonction de conversion 
302
	 * D'encodage de sortie
308
	 * D'encodage de sortie
303
	 * Cette convertion a lieu seulement si les formats sont différents.
309
	 * Cette convertion a lieu seulement si les formats sont différents.
304
	 */
310
	 */
305
	private function convertirEncodageEntree($contenu) {
311
	private function convertirEncodageEntree($contenu) {
306
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
312
		if (Config::get('sortie_encodage') != Config::get('appli_encodage')) {
307
			$contenu = mb_convert_encoding($contenu, Config::get('appli_encodage'), Config::get('sortie_encodage'));
313
			$contenu = mb_convert_encoding($contenu, Config::get('appli_encodage'), Config::get('sortie_encodage'));
308
		}
314
		}
309
		return $contenu;
315
		return $contenu;
310
	}
316
	}
311
	
317
	
312
}
318
}
313
?>
319
?>