Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 401 | Rev 525 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
71 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe mère du module Liste.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
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
13
 * @version		$Id$
14
 */
15
class Fiche extends aControleur {
291 jpm 16
 
230 delphine 17
	private $onglet = 'synthese';
291 jpm 18
	private $parametres = array();
19
	private $conteneur = null;
238 delphine 20
	private $num_nom = 0;
376 delphine 21
	private $nom_retenu = '';
291 jpm 22
 
23
 
216 delphine 24
	public function initialiser() {
25
		$this->capturerParametres();
500 jpm 26
		$this->conteneur = new Conteneur($this->parametres);
376 delphine 27
		$this->nom_retenu = $this->conteneur->getNomCourant()->getNomRetenu();
238 delphine 28
		spl_autoload_register(array($this, 'chargerClassesOnglets'));
216 delphine 29
	}
291 jpm 30
 
31
	private function capturerParametres() {
32
		if (isset($_GET['num_nom'])) {
33
			$this->parametres['num_nom'] = $_GET['num_nom'];
34
		}
35
		if (isset($_GET['nom'])) {
36
			$this->parametres['nom'] = $_GET['nom'];
37
		}
38
		if (isset($_GET['type_nom'])) {
39
			$this->parametres['type_nom'] = $_GET['type_nom'];
40
		}
395 aurelien 41
		if (isset($_GET['referentiel'])) {
42
			$this->parametres['referentiel'] = $_GET['referentiel'];
43
		}
291 jpm 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
 
238 delphine 53
	private function chargerClassesOnglets($classe) {
54
		$base = dirname(__FILE__).DS;
55
		$cheminFormateurs = $base.'formateurs'.DS;
56
		$dossiers = array($base, $cheminFormateurs);
57
		foreach ($dossiers as $chemin) {
58
			$fichierATester = $chemin.$classe.'.php';
59
			if (file_exists($fichierATester)) {
60
				include_once $fichierATester;
61
				return null;
62
			}
63
		}
64
	}
291 jpm 65
 
71 delphine 66
	public function executerActionParDefaut() {
67
		$this->executerFiche();
68
	}
291 jpm 69
 
141 delphine 70
	public function executerFiche(){
376 delphine 71
		$donnees= $this->parametres;
401 delphine 72
		$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci_html').' '.$this->nom_retenu->get('auteur');
380 delphine 73
		$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
291 jpm 74
		$this->executerAction('Recherche', 'executerAccueil', $this->parametres);
75
		$blocs_niveaux = $this->conteneur->getParametreTableau('blocs_fiche_defaut');
219 delphine 76
		$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
291 jpm 77
 
78
		$donnees = array_merge($this->obtenirDonnees(), $donnees);
238 delphine 79
		$donnees['onglet'] = $this->onglet;
80
		$donnees['contenu_onglet'] = $this->getVue('fiche_'.$this->onglet, $donnees);
291 jpm 81
 
231 aurelien 82
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil', $donnees), true);
71 delphine 83
	}
291 jpm 84
 
230 delphine 85
	public function executerOnglet(){
238 delphine 86
		$donnees = $this->obtenirDonnees();
291 jpm 87
		header('Content-type: text/html');
500 jpm 88
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_'.$this->onglet, $donnees));
230 delphine 89
	}
291 jpm 90
 
91
	private function obtenirDonnees() {
92
		$donnees = array();
93
		$classe = ucfirst($this->onglet);
94
		$onglet = new $classe($this->conteneur);
95
		$donnees = $onglet->obtenirDonnees();
238 delphine 96
		return $donnees;
97
	}
71 delphine 98
}
99
?>