Subversion Repositories eFlore/Applications.coel-consultation

Rev

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

Rev 19 Rev 55
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe Controleur générale de l'application Collection.
4
 * Classe Controleur générale de l'application Collection.
5
 *
5
 *
6
 * @category	php5.2
6
 * @category	php5.2
7
 * @package		Collection
7
 * @package		Collection
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @copyright	2010 Tela-Botanica
9
 * @copyright	2010 Tela-Botanica
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		SVN: $Id: ColControleur.php 19 2010-03-24 18:22:25Z jpm $
12
 * @version		SVN: $Id: ColControleur.php 55 2010-04-30 16:18:31Z jpm $
13
 */
13
 */
14
abstract class ColControleur extends Controleur {
14
abstract class ColControleur extends Controleur {
15
 
15
	
-
 
16
	const FMT_DATE = '%d/%m/%Y';
-
 
17
	const FMT_DATE_HEURE = '%d/%m/%Y %H:%i:%s';
-
 
18
	const FMT_DATE_HEURE_TXT = '%A %d %B %Y à %H:%M';
-
 
19
	
16
	const RENDU_TETE = 'tete';
20
	const RENDU_TETE = 'tete';
17
	const RENDU_CORPS = 'corps';
21
	const RENDU_CORPS = 'corps';
18
	const RENDU_PIED = 'pied';
22
	const RENDU_PIED = 'pied';
19
	const TYPE_AUTRE = 'AUTRE';
23
	const TYPE_AUTRE = 'AUTRE';
20
	const TYPE_TOTAL = 'TOTAL';
24
	const TYPE_TOTAL = 'TOTAL';
21
	const SEPARATEUR_TYPE_VALEUR = '##';
25
	const SEPARATEUR_TYPE_VALEUR = '##';
22
	const SEPARATEUR_VALEURS = ';;';
26
	const SEPARATEUR_VALEURS = ';;';
23
	const SEPARATEUR_DONNEES = '||';
27
	const SEPARATEUR_DONNEES = '||';
24
	const VALEUR_NULL = 'NC';
28
	const VALEUR_NULL = 'NC';
25
	
29
	
26
	private $sortie = array();
30
	private $sortie = array();
27
	private $parametres = array();
31
	private $parametres = array();
28
	// FIXME : voir s'il est plus intéressant d'utiliser une méthode dans les classes filles
32
	// FIXME : voir s'il est plus intéressant d'utiliser une méthode dans les classes filles
29
	protected $url = null;
33
	protected $url = null;
30
	
34
	
31
	public function __construct()  {
35
	public function __construct()  {
32
		$registre = Registre::getInstance();
36
		$registre = Registre::getInstance();
33
		$this->parametres = $registre->get('parametres');
37
		$this->parametres = $registre->get('parametres');
34
		$this->url = $this->parametres['url'];
38
		$this->url = $this->parametres['url'];
35
		parent::__construct();
39
		parent::__construct();
36
	}
40
	}
37
	
41
	
38
	/**
42
	/**
39
	 * Attribue à la bonne position de sortie un contenu.
43
	 * Attribue à la bonne position de sortie un contenu.
40
	 */
44
	 */
41
	protected function setSortie($position, $contenu, $fusionner = false) {
45
	protected function setSortie($position, $contenu, $fusionner = false) {
42
		if ($this->verifierExistencePosition($position)) {
46
		if ($this->verifierExistencePosition($position)) {
43
			if ($fusionner) {
47
			if ($fusionner) {
44
				$this->sortie[$position] .= $contenu;
48
				$this->sortie[$position] .= $contenu;
45
			} else {
49
			} else {
46
				$this->sortie[$position] = $contenu;
50
				$this->sortie[$position] = $contenu;
47
			}
51
			}
48
		}
52
		}
49
	}
53
	}
50
	
54
	
51
	/**
55
	/**
52
	 * Vérifie l'existence de la position indiquée pour son utilisation dans le tableau de sortie.
56
	 * Vérifie l'existence de la position indiquée pour son utilisation dans le tableau de sortie.
53
	 * @param string la position à tester.
57
	 * @param string la position à tester.
54
	 * @return bool true si la position est valide, sinon false.
58
	 * @return bool true si la position est valide, sinon false.
55
	 */
59
	 */
56
	private function verifierExistencePosition($position) {
60
	private function verifierExistencePosition($position) {
57
		$existe = true;
61
		$existe = true;
58
		if ($position != self::RENDU_TETE &&
62
		if ($position != self::RENDU_TETE &&
59
			$position != self::RENDU_CORPS &&
63
			$position != self::RENDU_CORPS &&
60
			$position != self::RENDU_PIED) {
64
			$position != self::RENDU_PIED) {
61
			trigger_error("La position '$position' n'est pas une valeur prédéfinie.", E_USER_WARNING);
65
			trigger_error("La position '$position' n'est pas une valeur prédéfinie.", E_USER_WARNING);
62
			$existe = false;
66
			$existe = false;
63
		}
67
		}
64
		return $existe;
68
		return $existe;
65
	}
69
	}
66
	
70
	
67
	/**
71
	/**
68
	 * Retourne le tableau de sortie à utiliser dans le controleur principal de l'application.
72
	 * Retourne le tableau de sortie à utiliser dans le controleur principal de l'application.
69
	 */
73
	 */
70
	public function getSortie() {
74
	public function getSortie() {
71
		return $this->sortie;
75
		return $this->sortie;
72
	}
76
	}
73
 
77
 
74
	/**
78
	/**
75
	 * Execute l'action d'un module donnée et fusionne le résultat avec le tableau de sortie.
79
	 * Execute l'action d'un module donnée et fusionne le résultat avec le tableau de sortie.
76
	 */
80
	 */
77
	protected function executerAction($ClasseModule, $action) {
81
	protected function executerAction($ClasseModule, $action) {
78
		$module = new $ClasseModule();
82
		$module = new $ClasseModule();
79
		$module->$action();
83
		$module->$action();
80
		$this->fusionnerSortie($module->getSortie());
84
		$this->fusionnerSortie($module->getSortie());
81
		
85
		
82
	}
86
	}
83
	
87
	
84
	/**
88
	/**
85
	 * Fusionne un tableau de sortie par défaut avec le tableau passé en paramêtre.
89
	 * Fusionne un tableau de sortie par défaut avec le tableau passé en paramêtre.
86
	 * @param array le tableau à fusionner
90
	 * @param array le tableau à fusionner
87
	 */
91
	 */
88
	private function fusionnerSortie($sortie) {
92
	private function fusionnerSortie($sortie) {
89
		$this->sortie = array_merge($this->sortie, $sortie);
93
		$this->sortie = array_merge($this->sortie, $sortie);
90
	}
94
	}
91
	
95
	
92
	protected function construireTxtTruckSimple($chaine_a_analyser) {
96
	protected function construireTxtTruckSimple($chaine_a_analyser) {
93
		return $this->construireTxtTruck($chaine_a_analyser, false, false);
97
		return $this->construireTxtTruck($chaine_a_analyser, false, false);
94
	}
98
	}
95
	
99
	
96
	protected function construireTxtTruckSansMajuscule($chaine_a_analyser) {
100
	protected function construireTxtTruckSansMajuscule($chaine_a_analyser) {
97
		return $this->construireTxtTruck($chaine_a_analyser, false);
101
		return $this->construireTxtTruck($chaine_a_analyser, false);
98
	}
102
	}
99
	
103
	
100
	protected function construireTxtTruckSansPointFinal($chaine_a_analyser) {
104
	protected function construireTxtTruckSansPointFinal($chaine_a_analyser) {
101
		return $this->construireTxtTruck($chaine_a_analyser, true, false);
105
		return $this->construireTxtTruck($chaine_a_analyser, true, false);
102
	}
106
	}
103
	
107
	
104
	protected function construireTxtTruck($chaine_a_analyser, $majuscule = true, $point_final = true) {
108
	protected function construireTxtTruck($chaine_a_analyser, $majuscule = true, $point_final = true) {
105
		$termes = array();
109
		$termes = array();
106
		if ((!is_null($chaine_a_analyser)) && (trim($chaine_a_analyser) != ''))	{
110
		if ((!is_null($chaine_a_analyser)) && (trim($chaine_a_analyser) != ''))	{
107
			$valeurs = explode(self::SEPARATEUR_VALEURS, $chaine_a_analyser);
111
			$valeurs = explode(self::SEPARATEUR_VALEURS, $chaine_a_analyser);
108
			$nbre_valeurs = count($valeurs);
112
			$nbre_valeurs = count($valeurs);
109
			if ($nbre_valeurs > 0) {
113
			if ($nbre_valeurs > 0) {
110
				for ($i = 0; $i < $nbre_valeurs; $i++)	{
114
				for ($i = 0; $i < $nbre_valeurs; $i++)	{
111
					$valeur = trim($valeurs[$i]);
115
					$valeur = trim($valeurs[$i]);
112
					if ($valeur != '') {
116
					if ($valeur != '') {
113
						$valeur_formatee = $this->formaterValeurTruck($valeur);
117
						$valeur_formatee = $this->formaterValeurTruck($valeur);
114
						$termes[] = $valeur_formatee;
118
						$termes[] = $valeur_formatee;
115
					}
119
					}
116
				}
120
				}
117
			}
121
			}
118
		}
122
		}
119
		
123
		
120
		$chaine_a_retourner = $this->formaterTableauDeTxt($termes, $majuscule, $point_final);
124
		$chaine_a_retourner = $this->formaterTableauDeTxt($termes, $majuscule, $point_final);
121
		return $chaine_a_retourner;
125
		return $chaine_a_retourner;
122
	}
126
	}
-
 
127
	
-
 
128
	protected function getTxtTruckParPosition($chaine_a_analyser, $position = 1) {
-
 
129
		$retour = '';
-
 
130
		if ((!is_null($chaine_a_analyser)) && (trim($chaine_a_analyser) != ''))	{
-
 
131
			$valeurs = explode(self::SEPARATEUR_VALEURS, $chaine_a_analyser);
-
 
132
			$nbre_valeurs = count($valeurs);
-
 
133
			if ($nbre_valeurs > 0) {
-
 
134
				$position = $position - 1;
-
 
135
				$valeur = trim($valeurs[$position]);
-
 
136
				if ($valeur != '') {
-
 
137
					$retour = $this->formaterValeurTruck($valeur);
-
 
138
				}
-
 
139
			}
-
 
140
		}
-
 
141
		return $retour;
-
 
142
	}
-
 
143
	
-
 
144
	protected function getTableauTruck($chaine_a_analyser) {
-
 
145
		$tableau_retour = array();
-
 
146
		if ((!is_null($chaine_a_analyser)) && (trim($chaine_a_analyser) != ''))	{
-
 
147
			$valeurs = explode(self::SEPARATEUR_VALEURS, $chaine_a_analyser);
-
 
148
			$nbre_valeurs = count($valeurs);
-
 
149
			if ($nbre_valeurs > 0) {
-
 
150
				for ($i = 0; $i < $nbre_valeurs; $i++)	{
-
 
151
					$valeur = trim($valeurs[$i]);
-
 
152
					if ($valeur != '') {
-
 
153
						$tableau_retour[] = $valeur;
-
 
154
					}
-
 
155
				}
-
 
156
			}
-
 
157
		}
-
 
158
		return $tableau_retour;
-
 
159
	}
123
	
160
	
124
	private function formaterValeurTruck($valeur) {
161
	private function formaterValeurTruck($valeur) {
125
		$chaine_a_retourner = '';
162
		$chaine_a_retourner = '';
126
		
163
		
127
		if (preg_match('/^[^#]+##[^$]+$/', $valeur))	{
164
		if (preg_match('/^[^#]+##[^$]+$/', $valeur))	{
128
			$cle_valeur = explode(self::SEPARATEUR_TYPE_VALEUR, $valeur);
165
			$cle_valeur = explode(self::SEPARATEUR_TYPE_VALEUR, $valeur);
129
			$chaine_a_retourner = (($cle_valeur[1] == '' || $cle_valeur[1] == 'null') ? self::VALEUR_NULL : $cle_valeur[1]);
166
			$chaine_a_retourner = (($cle_valeur[1] == '' || $cle_valeur[1] == 'null') ? self::VALEUR_NULL : $cle_valeur[1]);
130
			$chaine_a_retourner .= ' '.$this->formaterParenthese($cle_valeur[0]);
167
			$chaine_a_retourner .= ' '.$this->formaterParenthese($cle_valeur[0]);
131
		} else if ($valeur != '')	{
168
		} else if ($valeur != '')	{
132
			$chaine_a_retourner = $valeur;
169
			$chaine_a_retourner = $valeur;
133
		} else {
170
		} else {
134
			trigger_error("Valeur truck posant problème :$valeur", E_USER_NOTICE);
171
			trigger_error("Valeur truck posant problème :$valeur", E_USER_NOTICE);
135
		}
172
		}
136
		
173
		
137
		return $chaine_a_retourner;
174
		return $chaine_a_retourner;
138
	}
175
	}
139
	
176
	
140
	protected function formaterParenthese($chaine_a_afficher) {
177
	protected function formaterParenthese($chaine_a_afficher) {
141
		if ($chaine_a_afficher != '') {
178
		if ($chaine_a_afficher != '') {
142
			$chaine_a_afficher = '('.$chaine_a_afficher.')';
179
			$chaine_a_afficher = '('.$chaine_a_afficher.')';
143
		}
180
		}
144
		return $chaine_a_afficher;
181
		return $chaine_a_afficher;
145
	}
182
	}
146
	
183
	
147
	protected function formaterSautDeLigne($chaine_a_formater) {
184
	protected function formaterSautDeLigne($chaine_a_formater) {
148
		$txt_a_retourner = preg_replace('/\n/', '<br />', $chaine_a_formater);
185
		$txt_a_retourner = preg_replace('/\n/', '<br />', $chaine_a_formater);
149
		return $txt_a_retourner;
186
		return $txt_a_retourner;
150
	}
187
	}
151
	
188
	
152
	protected function formaterTableauDeTxt($tableau_de_txt, $majuscule = true, $point_final = true) {
189
	protected function formaterTableauDeTxt($tableau_de_txt, $majuscule = true, $point_final = true) {
153
		$chaine_a_afficher = '';
190
		$chaine_a_afficher = '';
154
		$taille_du_tableau = count($tableau_de_txt);
191
		$taille_du_tableau = count($tableau_de_txt);
155
		if ($taille_du_tableau > 0) {
192
		if ($taille_du_tableau > 0) {
156
			$index_avt_dernier = $taille_du_tableau - 1;
193
			$index_avt_dernier = $taille_du_tableau - 1;
157
			for ($i = 0; $i < $taille_du_tableau; $i++)	{
194
			for ($i = 0; $i < $taille_du_tableau; $i++)	{
158
				$mot = $tableau_de_txt[$i];
195
				$mot = $tableau_de_txt[$i];
159
				if ($i != $index_avt_dernier) {
196
				if ($i != $index_avt_dernier) {
160
					$chaine_a_afficher .= $mot.', ';
197
					$chaine_a_afficher .= $mot.', ';
161
				} else {
198
				} else {
162
					$chaine_a_afficher .= $this->nettoyerPointFinal($mot);
199
					$chaine_a_afficher .= $this->nettoyerPointFinal($mot);
163
					if ($point_final) {
200
					if ($point_final) {
164
						$chaine_a_afficher .= '.';
201
						$chaine_a_afficher .= '.';
165
					}
202
					}
166
				}
203
				}
167
			}
204
			}
168
		}
205
		}
169
		if ($majuscule) {
206
		if ($majuscule) {
170
			$chaine_a_afficher = ucfirst($chaine_a_afficher);
207
			$chaine_a_afficher = ucfirst($chaine_a_afficher);
171
		}
208
		}
172
		return $chaine_a_afficher;
209
		return $chaine_a_afficher;
173
	}
210
	}
174
	
211
	
175
	protected function formaterAutre($chaine_a_afficher) {
212
	protected function formaterAutre($chaine_a_afficher) {
176
		if ($chaine_a_afficher != '') {
213
		if ($chaine_a_afficher != '') {
177
			$chaine_a_afficher = ' [Autre : '.$chaine_a_afficher.']';
214
			$chaine_a_afficher = ' [Autre : '.$chaine_a_afficher.']';
178
		}
215
		}
179
		return $chaine_a_afficher;
216
		return $chaine_a_afficher;
180
	}
217
	}
181
	
218
	
182
	protected function formaterOuiNon($chaine_a_formater) {
219
	protected function formaterOuiNon($chaine_a_formater) {
183
		$txt_a_retourner = '';
220
		$txt_a_retourner = '';
184
		if ($chaine_a_formater == '0') {
221
		if ($chaine_a_formater == '0') {
185
			$txt_a_retourner = 'non';
222
			$txt_a_retourner = 'non';
186
		} else if ($chaine_a_formater == '1') {
223
		} else if ($chaine_a_formater == '1') {
187
			$txt_a_retourner = 'oui';
224
			$txt_a_retourner = 'oui';
188
		}
225
		}
189
		return $txt_a_retourner;
226
		return $txt_a_retourner;
190
	}
227
	}
191
	
228
	
192
	protected function formaterDate($date) {
229
	protected function formaterDate($date, $format = self::FMT_DATE_HEURE) {
193
		if ($date == '' || $date == '0000-00-00' || $date == '0000-00-00 00:00:00') {
230
		if ($date == '' || $date == '0000-00-00' || $date == '0000-00-00 00:00:00') {
-
 
231
			$date = 'Inconnue';
-
 
232
		} else {
-
 
233
			$timestamp = strtotime($date);
194
			$date = 'Inconnue';
234
			$date = strftime($format, $timestamp);
195
		}
235
		}
196
		return $date;
236
		return $date;
197
	}
237
	}
198
	
238
	
199
	protected function nettoyerPointFinal($mot) {
239
	protected function nettoyerPointFinal($mot) {
200
		$mot = preg_replace('/[.]$/', '', $mot);
240
		$mot = preg_replace('/[.]$/', '', $mot);
201
		return $mot;
241
		return $mot;
202
	}
242
	}
203
	
243
	
204
	public function construireTxtListeOntologie($chaineAAnalyser, $valeurEstOntologie = true, $typeEstOntologie = true, $donneeEstOntologie = false) {
244
	public function construireTxtListeOntologie($chaineAAnalyser, $valeurEstOntologie = true, $typeEstOntologie = true, $donneeEstOntologie = false) {
205
		$termes = array();
245
		$termes = array();
206
		$autres = array();
246
		$autres = array();
207
		$chaineAAnalyser = trim($chaineAAnalyser);
247
		$chaineAAnalyser = trim($chaineAAnalyser);
208
		if ($chaineAAnalyser != '') {
248
		if ($chaineAAnalyser != '') {
209
			$valeurs = explode(self::SEPARATEUR_VALEURS, $chaineAAnalyser);
249
			$valeurs = explode(self::SEPARATEUR_VALEURS, $chaineAAnalyser);
210
			$nbreValeurs = count($valeurs);
250
			$nbreValeurs = count($valeurs);
211
			if ($nbreValeurs > 0)	{
251
			if ($nbreValeurs > 0)	{
212
				for ($i = 0; $i < $nbreValeurs; $i++)	{
252
				for ($i = 0; $i < $nbreValeurs; $i++)	{
213
					$valeur = $valeurs[$i];
253
					$valeur = $valeurs[$i];
214
					
254
					
215
					// VALEUR SANS TYPE 
255
					// VALEUR SANS TYPE 
216
					// La valeur sans type est une entrée de l'ontologie
256
					// La valeur sans type est une entrée de l'ontologie
217
					if ($valeurEstOntologie && preg_match('/^[0-9]+$/', $valeur)) {
257
					if ($valeurEstOntologie && preg_match('/^[0-9]+$/', $valeur)) {
218
						if ($valeur == '0') {
258
						if ($valeur == '0') {
219
							$valeur = '';
259
							$valeur = '';
220
						} else {
260
						} else {
221
							$valeurOntologie = Ontologie::getValeur($valeur);
261
							$valeurOntologie = Ontologie::getValeur($valeur);
222
							if ($valeurOntologie != '') {
262
							if ($valeurOntologie != '') {
223
								$valeur = $valeurOntologie['nom'];
263
								$valeur = $valeurOntologie['nom'];
224
							}
264
							}
225
						}
265
						}
226
					}
266
					}
227
					
267
					
228
					// VALEUR AVEC TYPE
268
					// VALEUR AVEC TYPE
229
					// Type : AUTRE
269
					// Type : AUTRE
230
					$valeurTypeAutre = self::TYPE_AUTRE.self::SEPARATEUR_TYPE_VALEUR;
270
					$valeurTypeAutre = self::TYPE_AUTRE.self::SEPARATEUR_TYPE_VALEUR;
231
					if (preg_match('/^'.$valeurTypeAutre.'.+$/', $valeur)) {
271
					if (preg_match('/^'.$valeurTypeAutre.'.+$/', $valeur)) {
232
						$txtAutre = preg_replace('/^'.$valeurTypeAutre.'/', '', $valeur);
272
						$txtAutre = preg_replace('/^'.$valeurTypeAutre.'/', '', $valeur);
233
						if ($txtAutre != '') {
273
						if ($txtAutre != '') {
234
							$autres[] = $txtAutre;
274
							$autres[] = $txtAutre;
235
						}
275
						}
236
						$valeur = '';
276
						$valeur = '';
237
					}
277
					}
238
					// Type correspondant à une entrée de l'ontologie
278
					// Type correspondant à une entrée de l'ontologie
239
					if ($typeEstOntologie) {
279
					if ($typeEstOntologie) {
240
						$valeurTypeOntologie = '([0-9]+)'.self::SEPARATEUR_TYPE_VALEUR;
280
						$valeurTypeOntologie = '([0-9]+)'.self::SEPARATEUR_TYPE_VALEUR;
241
						if (preg_match('/^'.$valeurTypeOntologie.'.*$/', $valeur, $match)) {
281
						if (preg_match('/^'.$valeurTypeOntologie.'.*$/', $valeur, $match)) {
242
							$type = $match[1];
282
							$type = $match[1];
243
							$valeurOntologieNom = Ontologie::getValeurNom($type);
283
							$valeurOntologieNom = Ontologie::getValeurNom($type);
244
							if ($valeurOntologieNom !== false) {
284
							if ($valeurOntologieNom !== false) {
245
								$valeur = preg_replace('/^'.$type.'/', $valeurOntologieNom.': ', $valeur);
285
								$valeur = preg_replace('/^'.$type.'/', $valeurOntologieNom.': ', $valeur);
246
							}
286
							}
247
						}
287
						}
248
					}
288
					}
249
					// Donnée correspondant à une entrée de l'ontologie
289
					// Donnée correspondant à une entrée de l'ontologie
250
					if ($donneeEstOntologie) {
290
					if ($donneeEstOntologie) {
251
						$donneeOntologie = self::SEPARATEUR_TYPE_VALEUR.'([0-9]+)';
291
						$donneeOntologie = self::SEPARATEUR_TYPE_VALEUR.'([0-9]+)';
252
						if (preg_match('/^.+'.$donneeOntologie.'$/', $valeur, $match)) {
292
						if (preg_match('/^.+'.$donneeOntologie.'$/', $valeur, $match)) {
253
							$donnee = $match[1];
293
							$donnee = $match[1];
254
							$donnee = str_replace(self::SEPARATEUR_TYPE_VALEUR, '', $donnee);
294
							$donnee = str_replace(self::SEPARATEUR_TYPE_VALEUR, '', $donnee);
255
							$valeurOntologieNom = Ontologie::getValeurNom($donnee);
295
							$valeurOntologieNom = Ontologie::getValeurNom($donnee);
256
							if ($valeurOntologieNom !== false) {
296
							if ($valeurOntologieNom !== false) {
257
								$valeur = preg_replace('/'.$donnee.'$/', $valeurOntologieNom, $valeur);
297
								$valeur = preg_replace('/'.$donnee.'$/', $valeurOntologieNom, $valeur);
258
							}
298
							}
259
						}
299
						}
260
					}
300
					}
261
					
301
					
262
					// Nettoyage final
302
					// Nettoyage final
263
					$valeur = preg_replace('/'.self::SEPARATEUR_TYPE_VALEUR.'/', '', $valeur);
303
					$valeur = preg_replace('/'.self::SEPARATEUR_TYPE_VALEUR.'/', '', $valeur);
264
					
304
					
265
					if ($valeur != '') {
305
					if ($valeur != '') {
266
						$termes[] = $valeur;
306
						$termes[] = $valeur;
267
					}
307
					}
268
				}
308
				}
269
			}
309
			}
270
		}
310
		}
271
		
311
		
272
		$chaineTermes = $this->formaterTableauDeTxt($termes);
312
		$chaineTermes = $this->formaterTableauDeTxt($termes);
273
		$chaineAutres = $this->formaterTableauDeTxt($autres);
313
		$chaineAutres = $this->formaterTableauDeTxt($autres);
274
		$chaineARetourner = $chaineTermes.$this->formaterAutre($chaineAutres);
314
		$chaineARetourner = $chaineTermes.$this->formaterAutre($chaineAutres);
275
		
315
		
276
		return $chaineARetourner;
316
		return $chaineARetourner;
277
	}
317
	}
278
	
318
	
279
	protected function obtenirUrlFicheStructure($id_structure) {
319
	protected function obtenirUrlFicheStructure($id_structure) {
280
		$this->url->setVariableRequete('module', 'Fiche');
320
		$this->url->setVariableRequete('module', 'Fiche');
281
		$this->url->setVariableRequete('action', 'afficherStructure');
321
		$this->url->setVariableRequete('action', 'afficherStructure');
282
		$this->url->setVariableRequete('id', $id_structure);
322
		$this->url->setVariableRequete('id', $id_structure);
283
		$url = $this->url->getURL();
323
		$url = $this->url->getURL();
284
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
324
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
285
		return $url;
325
		return $url;
286
	}
326
	}
287
	
327
	
288
	protected function obtenirUrlFicheColletion($id_collection) {
328
	protected function obtenirUrlFicheCollection($id_collection) {
289
		$this->url->setVariableRequete('module', 'Fiche');
329
		$this->url->setVariableRequete('module', 'Fiche');
290
		$this->url->setVariableRequete('action', 'afficherCollection');
330
		$this->url->setVariableRequete('action', 'afficherCollection');
291
		$this->url->setVariableRequete('id', $id_collection);
331
		$this->url->setVariableRequete('id', $id_collection);
292
		$url = $this->url->getURL();
332
		$url = $this->url->getURL();
-
 
333
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
-
 
334
		return $url;
-
 
335
	}
-
 
336
	
-
 
337
	protected function obtenirUrlFichePersonne($id_personne) {
-
 
338
		$this->url->setVariableRequete('module', 'Fiche');
-
 
339
		$this->url->setVariableRequete('action', 'afficherPersonne');
-
 
340
		$this->url->setVariableRequete('id', $id_personne);
-
 
341
		$url = $this->url->getURL();
293
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
342
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
294
		return $url;
343
		return $url;
295
	}
344
	}
296
	
345
	
297
	protected function postraiterDonnees(&$tableau) {
346
	protected function postraiterDonnees(&$tableau) {
298
		if (count($tableau) > 0) {
347
		if (count($tableau) > 0) {
299
			foreach ($tableau as $cle => &$valeur) {
348
			foreach ($tableau as $cle => &$valeur) {
300
				if ($valeur == '') {
349
				if ($valeur == '') {
301
					$valeur = '&nbsp;';
350
					$valeur = '&nbsp;';
302
				} else if (is_string($valeur)) {
351
				} else if (is_string($valeur)) {
303
					$valeur = preg_replace('/&(?!amp;)/i', '&amp;', $valeur, -1);
352
					$valeur = preg_replace('/&(?!amp;)/i', '&amp;', $valeur, -1);
304
				} else if (is_array($valeur)) {
353
				} else if (is_array($valeur)) {
305
					$this->postraiterDonnees($valeur);
354
					$this->postraiterDonnees($valeur);
306
				}
355
				}
307
			}
356
			}
308
		}
357
		}
309
	}
358
	}
310
}
359
}