Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 231 Rev 238
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Fiche extends aControleur {
15
class Fiche extends aControleur {
16
	private $onglet = 'synthese';
16
	private $onglet = 'synthese';
-
 
17
	private $num_nom = 0;
-
 
18
	
17
	
19
	
18
	public function initialiser() {
20
	public function initialiser() {
19
		$this->capturerParametres();
21
		$this->capturerParametres();
-
 
22
		spl_autoload_register(array($this, 'chargerClassesOnglets'));
-
 
23
	}
-
 
24
	
-
 
25
	private function chargerClassesOnglets($classe) {
-
 
26
		$base = dirname(__FILE__).DS;
-
 
27
		$cheminFormateurs = $base.'formateurs'.DS;
-
 
28
		$dossiers = array($base, $cheminFormateurs);
-
 
29
		foreach ($dossiers as $chemin) {
-
 
30
			$fichierATester = $chemin.$classe.'.php';
-
 
31
			if (file_exists($fichierATester)) {
-
 
32
				include_once $fichierATester;
-
 
33
				return null;
-
 
34
			}
-
 
35
		}
20
	}
36
	}
21
	
37
	
22
	public function executerActionParDefaut() {
38
	public function executerActionParDefaut() {
23
		$this->executerFiche();
39
		$this->executerFiche();
24
	}
40
	}
25
	
41
	
26
	public function executerFiche(){
42
	public function executerFiche(){
27
		$donnees_recherche = array('type_nom' => $this->type_nom, 'nom' => $this->nom);
43
		$donnees = array('type_nom' => $this->type_nom, 'nom' => $this->nom);
28
		$this->executerAction('Recherche', 'executerAccueil', $donnees_recherche);
44
		$this->executerAction('Recherche', 'executerAccueil', $donnees);
-
 
45
		$donnees['num_nom'] = $this->num_nom;
29
		$blocs_niveaux = $this->recupererTableauConfig('blocs_fiche_defaut');
46
		$blocs_niveaux = $this->recupererTableauConfig('blocs_fiche_defaut');
30
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
47
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
-
 
48
		$donnees = $this->obtenirDonnees($donnees);
-
 
49
		$donnees['onglet'] = $this->onglet;
31
		$donnees['onglet'] = $this->getVue('fiche_'.$this->onglet, $donnees);
50
		$donnees['contenu_onglet'] = $this->getVue('fiche_'.$this->onglet, $donnees);
32
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil', $donnees), true);
51
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil', $donnees), true);
33
	}
52
	}
34
	
53
	
35
	public function executerOnglet(){
54
	public function executerOnglet(){
36
		$donnees = array();
55
		$donnees = $this->obtenirDonnees();
37
		header('Content-type: text/html'); 
56
		header('Content-type: text/html'); 
38
		echo $this->getVue('fiche_'.$this->onglet, $donnees);
57
		echo $this->getVue('fiche_'.$this->onglet, $donnees);
39
		exit;
58
		exit;
40
	}
59
	}
-
 
60
	
-
 
61
	private function obtenirDonnees($donnees = array()) {
-
 
62
		if ($this->onglet == 'illustrations') {
-
 
63
			$ill = new Illustrations();
-
 
64
			$donnees['img'] = $ill->obtenirDonnees($this->num_nom);
-
 
65
		}
-
 
66
		return $donnees;
-
 
67
	}
41
	
68
	
-
 
69
	private function capturerParametres() {
-
 
70
		if (isset($_GET['num_nom'])) {
-
 
71
			$this->num_nom = $_GET['num_nom'];
42
	private function capturerParametres() {
72
		}
43
		if (isset($_GET['nom'])) {
73
		if (isset($_GET['nom'])) {
44
			$this->nom = $_GET['nom'];
74
			$this->nom = $_GET['nom'];
45
		}
75
		}
46
		if (isset($_GET['type_nom'])) {
76
		if (isset($_GET['type_nom'])) {
47
			$this->type_nom = $_GET['type_nom'];
77
			$this->type_nom = $_GET['type_nom'];
48
		}
78
		}
49
		
79
		
50
		if (isset($_GET['niveau'])) {
80
		if (isset($_GET['niveau'])) {
51
			Registre::set('parametres.niveau', $_GET['niveau']);
81
			Registre::set('parametres.niveau', $_GET['niveau']);
52
		}
82
		}
53
		if (isset($_GET['onglet'])) {
83
		if (isset($_GET['onglet'])) {
54
			$this->onglet = $_GET['onglet'];
84
			$this->onglet = $_GET['onglet'];
55
		}
85
		}
56
	}
86
	}
57
	
87
	
58
	protected function recupererTableauConfig($param) {
88
	protected function recupererTableauConfig($param) {
59
		$tableau = array();
89
		$tableau = array();
60
		$tableauPartiel = explode(',', Config::get($param));
90
		$tableauPartiel = explode(',', Config::get($param));
61
		$tableauPartiel = array_map('trim', $tableauPartiel);
91
		$tableauPartiel = array_map('trim', $tableauPartiel);
62
		foreach ($tableauPartiel as $champ) {
92
		foreach ($tableauPartiel as $champ) {
63
			if (strpos($champ, '=') === false) {
93
			if (strpos($champ, '=') === false) {
64
				$tableau[] = $champ;
94
				$tableau[] = $champ;
65
			} else {
95
			} else {
66
				list($cle, $val) = explode('=', $champ);
96
				list($cle, $val) = explode('=', $champ);
67
				$tableau[$cle] = $val;
97
				$tableau[$cle] = $val;
68
			}
98
			}
69
		}
99
		}
70
		return $tableau;
100
		return $tableau;
71
	}
101
	}
72
}
102
}
73
?>
103
?>