Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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