Subversion Repositories eFlore/Applications.coel-consultation

Rev

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

Rev 19 Rev 55
Line 7... Line 7...
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';
Line 119... Line 123...
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;
Line -... Line 126...
-
 
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;
122
	}
159
	}
123
	
160
	
Line 124... Line 161...
124
	private function formaterValeurTruck($valeur) {
161
	private function formaterValeurTruck($valeur) {
125
		$chaine_a_retourner = '';
162
		$chaine_a_retourner = '';
Line 187... Line 224...
187
			$txt_a_retourner = 'oui';
224
			$txt_a_retourner = 'oui';
188
		}
225
		}
189
		return $txt_a_retourner;
226
		return $txt_a_retourner;
190
	}
227
	}
Line 191... Line 228...
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;
Line 197... Line 237...
197
	}
237
	}
Line 283... Line 323...
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
	}
Line 287... Line 327...
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();
293
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
333
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
294
		return $url;
334
		return $url;
Line -... Line 335...
-
 
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();
-
 
342
		$this->url->unsetVariablesRequete(array('module', 'action', 'id'));
-
 
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) {