Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 276 Rev 291
Line 11... Line 11...
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
 
16
	private $onglet = 'synthese';
17
	private $onglet = 'synthese';
-
 
18
	private $parametres = array();
-
 
19
	private $conteneur = null;
17
	private $num_nom = 0;
20
	private $num_nom = 0;
18
	
21
 
19
	
22
 
20
	public function initialiser() {
23
	public function initialiser() {
21
		$this->capturerParametres();
24
		$this->capturerParametres();
-
 
25
		$this->conteneur = new Conteneur($this->parametres);
22
		spl_autoload_register(array($this, 'chargerClassesOnglets'));
26
		spl_autoload_register(array($this, 'chargerClassesOnglets'));
23
	}
27
	}
24
	
28
 
-
 
29
	private function capturerParametres() {
-
 
30
		if (isset($_GET['num_nom'])) {
-
 
31
			$this->parametres['num_nom'] = $_GET['num_nom'];
-
 
32
		}
-
 
33
 
-
 
34
		if (isset($_GET['nom_retenu'])) {
-
 
35
			$this->parametres['nom_retenu'] = $_GET['nom_retenu'];
-
 
36
		}
-
 
37
 
-
 
38
		if (isset($_GET['nom'])) {
-
 
39
			$this->parametres['nom'] = $_GET['nom'];
-
 
40
		}
-
 
41
		if (isset($_GET['type_nom'])) {
-
 
42
			$this->parametres['type_nom'] = $_GET['type_nom'];
-
 
43
		}
-
 
44
 
-
 
45
		if (isset($_GET['niveau'])) {
-
 
46
			Registre::set('parametres.niveau', $_GET['niveau']);
-
 
47
		}
-
 
48
		if (isset($_GET['onglet'])) {
-
 
49
			$this->onglet = $_GET['onglet'];
-
 
50
		}
-
 
51
	}
-
 
52
 
25
	private function chargerClassesOnglets($classe) {
53
	private function chargerClassesOnglets($classe) {
26
		$base = dirname(__FILE__).DS;
54
		$base = dirname(__FILE__).DS;
27
		$cheminFormateurs = $base.'formateurs'.DS;
55
		$cheminFormateurs = $base.'formateurs'.DS;
28
		$dossiers = array($base, $cheminFormateurs);
56
		$dossiers = array($base, $cheminFormateurs);
29
		foreach ($dossiers as $chemin) {
57
		foreach ($dossiers as $chemin) {
Line 32... Line 60...
32
				include_once $fichierATester;
60
				include_once $fichierATester;
33
				return null;
61
				return null;
34
			}
62
			}
35
		}
63
		}
36
	}
64
	}
37
	
65
 
38
	public function executerActionParDefaut() {
66
	public function executerActionParDefaut() {
39
		$this->executerFiche();
67
		$this->executerFiche();
40
	}
68
	}
41
	
69
 
42
	public function executerFiche(){
70
	public function executerFiche(){
43
		$donnees = array('type_nom' => $this->type_nom, 'nom' => $this->nom);
71
		$donnees = $this->parametres;
44
		$this->executerAction('Recherche', 'executerAccueil', $donnees);
72
		$this->executerAction('Recherche', 'executerAccueil', $this->parametres);
45
		$donnees['num_nom'] = $this->num_nom;
-
 
46
		$blocs_niveaux = $this->recupererTableauConfig('blocs_fiche_defaut');
73
		$blocs_niveaux = $this->conteneur->getParametreTableau('blocs_fiche_defaut');
47
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
74
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
-
 
75
 
48
		$donnees = $this->obtenirDonnees($donnees);
76
		$donnees = array_merge($this->obtenirDonnees(), $donnees);
49
		$donnees['onglet'] = $this->onglet;
77
		$donnees['onglet'] = $this->onglet;
50
		$donnees['contenu_onglet'] = $this->getVue('fiche_'.$this->onglet, $donnees);
78
		$donnees['contenu_onglet'] = $this->getVue('fiche_'.$this->onglet, $donnees);
51
		$donnees['nom_retenu'] = $this->nom_retenu;
-
 
-
 
79
 
52
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil', $donnees), true);
80
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil', $donnees), true);
53
	}
81
	}
54
	
82
 
55
	public function executerOnglet(){
83
	public function executerOnglet(){
56
		$donnees = $this->obtenirDonnees();
84
		$donnees = $this->obtenirDonnees();
57
		header('Content-type: text/html'); 
85
		header('Content-type: text/html');
58
		echo $this->getVue('fiche_'.$this->onglet, $donnees);
86
		echo $this->getVue('fiche_'.$this->onglet, $donnees);
59
		exit;
87
		exit;
60
	}
88
	}
61
	
89
 
62
	private function obtenirDonnees($donnees = array()) {
90
	private function obtenirDonnees() {
63
		if ($this->onglet == 'synthese') {
91
		$donnees = array();
64
			$serviceRepartition = new Repartition($this->num_nom, 'nn', "190x178");
-
 
65
			$donnees['repartition_vignette'] = $serviceRepartition->getUrlPng();
-
 
66
		} else {
-
 
67
			$classe = ucfirst($this->onglet);
92
		$classe = ucfirst($this->onglet);
68
			$metier = new $classe();
93
		$onglet = new $classe($this->conteneur);
69
			$donnees = $metier->obtenirDonnees($this->num_nom);
94
		$donnees = $onglet->obtenirDonnees();
70
		}
-
 
71
		return $donnees;
95
		return $donnees;
72
	}
96
	}
73
	
-
 
74
	private function capturerParametres() {
-
 
75
		if (isset($_GET['num_nom'])) {
-
 
76
			$this->num_nom = $_GET['num_nom'];
-
 
77
		}
-
 
78
		
-
 
79
		if (isset($_GET['nom_retenu'])) {
-
 
80
			$this->nom_retenu = $_GET['nom_retenu'];
-
 
81
		}
-
 
82
		
-
 
83
		if (isset($_GET['nom'])) {
-
 
84
			$this->nom = $_GET['nom'];
-
 
85
		}
-
 
86
		if (isset($_GET['type_nom'])) {
-
 
87
			$this->type_nom = $_GET['type_nom'];
-
 
88
		}
-
 
89
		
-
 
90
		if (isset($_GET['niveau'])) {
-
 
91
			Registre::set('parametres.niveau', $_GET['niveau']);
-
 
92
		}
-
 
93
		if (isset($_GET['onglet'])) {
-
 
94
			$this->onglet = $_GET['onglet'];
-
 
95
		}
-
 
96
	}
-
 
97
	
-
 
98
	protected function recupererTableauConfig($param) {
-
 
99
		$tableau = array();
-
 
100
		$tableauPartiel = explode(',', Config::get($param));
-
 
101
		$tableauPartiel = array_map('trim', $tableauPartiel);
-
 
102
		foreach ($tableauPartiel as $champ) {
-
 
103
			if (strpos($champ, '=') === false) {
-
 
104
				$tableau[] = $champ;
-
 
105
			} else {
-
 
106
				list($cle, $val) = explode('=', $champ);
-
 
107
				$tableau[$cle] = $val;
-
 
108
			}
-
 
109
		}
-
 
110
		return $tableau;
-
 
111
	}
-
 
112
}
97
}
113
?>
98
?>
114
99