Subversion Repositories eFlore/Applications.coel-consultation

Rev

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

Rev 10 Rev 11
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 10 2010-03-05 14:15:42Z jpm $
12
 * @version		SVN: $Id: ColControleur.php 11 2010-03-05 16:04:01Z jpm $
13
 */
13
 */
14
abstract class ColControleur {
14
abstract class ColControleur extends Controleur {
Line 15... Line 15...
15
 
15
 
16
	const RENDU_TETE = 'tete';
16
	const RENDU_TETE = 'tete';
17
	const RENDU_CORPS = 'corps';
17
	const RENDU_CORPS = 'corps';
Line 18... Line 18...
18
	const RENDU_PIED = 'pied';
18
	const RENDU_PIED = 'pied';
19
	
19
	
-
 
20
	private $sortie = array();
20
	private $sortie = array();
21
	private $parametres = array();
Line 21... Line 22...
21
	private $parametres = array();
22
	// FIXME : voir s'il est plus intéressant d'utiliser une méthode dans les classes filles
22
	private $url = null;
23
	protected $url = null;
23
	
24
	
24
	public function __construct()  {
25
	public function __construct()  {
25
		$registre = Registre::getInstance();
26
		$registre = Registre::getInstance();
26
		$this->parametres = $registre->get('parametres');
27
		$this->parametres = $registre->get('parametres');
Line 27... Line 28...
27
		$this->url = $this->parametres['url'];
28
		$this->url = $this->parametres['url'];
28
		parent::__construct();
29
		parent::__construct();
29
	}
30
	}
30
	
31
	
31
	/**
32
	/**
32
	 * Fonction d'affichage par défaut, elle appelle la liste des administrateurs
-
 
33
	 */
-
 
34
	protected function setSortie($position, $contenu, $fusionner = false) {
-
 
35
		if ($position != self::RENDU_TETE &&
-
 
36
			$position != self::RENDU_CORPS &&
33
	 * Attribue à la bonne position de sortie un contenu.
37
			$position != self::RENDU_PIED) {
34
	 */
38
			trigger_error("La position '$position' n'existe pas", E_USER_WARNING);
35
	protected function setSortie($position, $contenu, $fusionner = false) {
39
		} else {
36
		if ($this->verifierExistencePosition($position)) {
40
			if ($fusionner) {
37
			if ($fusionner) {
41
				$this->sortie[$position] .= $contenu;
38
				$this->sortie[$position] .= $contenu;
42
			} else {
39
			} else {
-
 
40
				$this->sortie[$position] = $contenu;
-
 
41
			}
-
 
42
		}
-
 
43
	}
-
 
44
	
-
 
45
	/**
-
 
46
	 * Vérifie l'existence de la position indiquée pour son utilisation dans le tableau de sortie.
-
 
47
	 * @param string la position à tester.
-
 
48
	 * @return bool true si la position est valide, sinon false.
-
 
49
	 */
-
 
50
	private function verifierExistencePosition($position) {
-
 
51
		$existe = true;
-
 
52
		if ($position != self::RENDU_TETE &&
-
 
53
			$position != self::RENDU_CORPS &&
-
 
54
			$position != self::RENDU_PIED) {
-
 
55
			trigger_error("La position '$position' n'est pas une valeur prédéfinie.", E_USER_WARNING);
-
 
56
			$existe = false;
-
 
57
		}
-
 
58
		return $existe;
-
 
59
	}
43
				$this->sortie[$position] = $contenu;
60
	
44
			}
61
	/**
45
		}
62
	 * Retourne le tableau de sortie à utiliser dans le controleur principal de l'application.
Line -... Line 63...
-
 
63
	 */
-
 
64
	public function getSortie() {
-
 
65
		return $this->sortie;
-
 
66
	}
-
 
67
 
-
 
68
	/**
-
 
69
	 * Execute l'action d'un module donnée et fusionne le résultat avec le tableau de sortie.
-
 
70
	 */
-
 
71
	protected function executerAction($ClasseModule, $action) {
-
 
72
		$module = new $ClasseModule();
-
 
73
		$module->$action();
-
 
74
		$this->fusionnerSortie($module->getSortie());
-
 
75
		
-
 
76
	}
-
 
77
	
-
 
78
	/**
-
 
79
	 * Fusionne un tableau de sortie par défaut avec le tableau passé en paramêtre.
Line 46... Line 80...
46
	}
80
	 * @param array le tableau à fusionner
47
	public function getSortie() {
81
	 */