Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1095 Rev 1106
Line 28... Line 28...
28
		$this->url = $this->conteneur->getAppUrls();
28
		$this->url = $this->conteneur->getAppUrls();
29
		$this->nomCourant = $this->conteneur->getNomCourant();
29
		$this->nomCourant = $this->conteneur->getNomCourant();
30
		$this->nom_retenu = $this->conteneur->getNomCourant()->getNomRetenu();
30
		$this->nom_retenu = $this->conteneur->getNomCourant()->getNomRetenu();
31
		spl_autoload_register(array($this, 'chargerClassesSources'));
31
		spl_autoload_register(array($this, 'chargerClassesSources'));
32
	}
32
	}
33
	
33
 
34
	private function chargerClassesSources($classe) {
34
	private function chargerClassesSources($classe) {
35
		$base = dirname(__FILE__).DS;
35
		$base = dirname(__FILE__).DS;
36
		$cheminSources = $base.'sources'.DS;
36
		$cheminSources = $base.'sources'.DS;
37
		$dossiers = array($base, $cheminSources);
37
		$dossiers = array($base, $cheminSources);
38
		foreach ($dossiers as $chemin) {
38
		foreach ($dossiers as $chemin) {
Line 43... Line 43...
43
			}
43
			}
44
		}
44
		}
45
	}
45
	}
Line 46... Line 46...
46
 
46
 
47
	private function capturerParametres() {
-
 
48
		if (isset($_GET['num_nom'])) {
47
	private function capturerParametres() {
49
			$this->parametres['num_nom'] = $_GET['num_nom'];
-
 
50
		}
-
 
51
		if (isset($_GET['nom'])) {
48
		$this->parametres['num_nom'] = isset($_GET['num_nom']) ? $_GET['num_nom'] : '';
52
			$this->parametres['nom'] = $_GET['nom'];
-
 
53
		}
49
		$this->parametres['nom'] = isset($_GET['nom']) ? $_GET['nom'] : '';
54
		if (isset($_GET['type_nom'])) {
50
		$this->parametres['type_nom'] = isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique';
55
			$this->parametres['type_nom'] = $_GET['type_nom'];
51
		$this->theme = isset($_GET['theme']) ? $_GET['theme'] : $this->theme;
56
		}
-
 
57
		if (isset($_GET['referentiel'])) {
52
 
58
			$this->parametres['referentiel'] = $_GET['referentiel'];
53
		$referentiel = isset($_GET['referentiel']) ? $_GET['referentiel'] : '';
59
			Registre::set('parametres.referentiel', $_GET['referentiel']);
54
		Registre::set('parametres.referentiel', $referentiel);
60
		}
55
 
61
		if (isset($_GET['niveau'])) {
56
		$niveau = isset($_GET['niveau']) ? $_GET['niveau'] : '1';
62
			Registre::set('parametres.niveau', $_GET['niveau']);
-
 
63
		}
-
 
64
		if (isset($_GET['theme'])) {
-
 
65
			$this->theme = $_GET['theme'];
-
 
66
		}
57
		Registre::set('parametres.niveau', $niveau);
67
	}
58
	}
68
	
59
 
69
	public function executerActionParDefaut() {
60
	public function executerActionParDefaut() {
70
		$this->executerFiche();
61
		$this->executerFiche();
Line 71... Line 62...
71
	}
62
	}
72
 
63
 
73
	public function executerFiche(){
-
 
74
		$niveau = isset($_GET['niveau']) ? $_GET['niveau'] : '1';
64
	public function executerFiche(){
75
		
65
		$niveau = Registre::get('parametres.niveau');
76
		$squelette = 'theme_'.$this->theme.'_niveau'.$niveau;
66
		$squelette = "theme_{$this->theme}_niveau{$niveau}";
77
		
67
 
78
		$donnees = $this->parametres;
68
		$donnees = $this->parametres;
79
		$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci_html').' '.$this->nom_retenu->get('auteur');
69
		$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci_html').' '.$this->nom_retenu->get('auteur');
80
		$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
70
		$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
81
		$donnees = array_merge($this->obtenirDonnees(), $donnees);
71
		$donnees = array_merge($this->obtenirDonnees(), $donnees);
82
		$donnees['css'] = $this->obtenirLienCss();
72
		$donnees['css'] = $this->obtenirLienCss();
83
		$donnees['url_absolue'] = "http://".$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
73
		$donnees['url_absolue'] = "http://".$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
84
		$donnees['contenu_onglet'] = $this->getVue($squelette, $donnees);
74
		$donnees['contenu_onglet'] = $this->getVue($squelette, $donnees);
85
		$donnees['lien'] = $this->url->obtenirUrlMobile($this->parametres['num_nom'], $this->parametres['type_nom'], $this->parametres['nom']);
75
		$donnees['lien'] = $this->url->obtenirUrlMobile($this->parametres['num_nom']);
86
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche', $donnees), true);
76
		$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche', $donnees), true);
87
		//print_r($donnees);
77
		//print_r($donnees);
88
	}
78
	}
89
	
79
 
90
	public function obtenirDonnees() {
80
	public function obtenirDonnees() {
91
		$donnees = array();
81
		$donnees = array();
92
		$num_nom = $this->nomCourant->getNns();
82
		$num_nom = $this->nomCourant->getNns();
93
		$referentiel = $this->conteneur->getParametre('referentiel');
83
		$referentiel = $this->conteneur->getParametre('referentiel');
94
		
84
 
95
		$taxons = new Taxons($this->conteneur);
85
		$taxons = new Taxons($this->conteneur);
96
		$donnees['permalien_num_nom'] = $taxons->getUrlPermalienNumNom($referentiel, 1, $num_nom);
86
		$donnees['permalien_num_nom'] = $taxons->getUrlPermalienNumNom($referentiel, 1, $num_nom);
97
		
87
 
98
		$sources = array('illustrations', 'repartition', 'texte', 'floraison', 'nomsCommuns');
88
		$sources = array('illustrations', 'repartition', 'texte', 'floraison', 'nomsCommuns');
99
		foreach ($sources as $source) {
89
		foreach ($sources as $source) {
100
			$nom_classe = ucfirst($source);
90
			$nom_classe = ucfirst($source);
101
			$classe = new $nom_classe($this->conteneur);
91
			$classe = new $nom_classe($this->conteneur);
Line 102... Line 92...
102
			$donnees[$source] = $classe->getDonnees();
92
			$donnees[$source] = $classe->getDonnees();
103
		}
93
		}
104
 
94
 
105
		return $donnees;
95
		return $donnees;
106
	}
96
	}
107
	
97
 
108
	private function obtenirLienCss() {
98
	private function obtenirLienCss() {
109
		$lien = 'modules/mobile/presentations/css/';
-
 
110
		if (strcmp($this->theme, 'pyracantha') >= 0) {
-
 
111
			$lien .= 'pyracantha_blanc.css';
99
		$theme = $this->theme;
-
 
100
		if (strcmp($this->theme, 'pyracantha') >= 0) {
112
		} else {
101
			$theme = 'pyracantha_blanc';
113
			$lien .= 'gentiana.css';
102
		}
114
		}
103
		$lien = "modules/mobile/presentations/css/$theme.css";
115
		return $lien;
104
		return $lien;
116
	}
105
	}