Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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