990 |
isa |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe mère du module Mobile.
|
|
|
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 Mobile extends aControleur {
|
|
|
16 |
|
|
|
17 |
private $theme = 'pyracantha';
|
|
|
18 |
private $parametres = array();
|
|
|
19 |
private $conteneur = null;
|
|
|
20 |
private $num_nom = 0;
|
|
|
21 |
private $nom_courant = null;
|
|
|
22 |
private $nom_retenu = '';
|
|
|
23 |
private $url;
|
|
|
24 |
|
|
|
25 |
public function initialiser() {
|
|
|
26 |
$this->capturerParametres();
|
|
|
27 |
$this->conteneur = new Conteneur($this->parametres);
|
|
|
28 |
$this->url = $this->conteneur->getAppUrls();
|
|
|
29 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
|
|
30 |
$this->nom_retenu = $this->conteneur->getNomCourant()->getNomRetenu();
|
|
|
31 |
spl_autoload_register(array($this, 'chargerClassesSources'));
|
|
|
32 |
}
|
1105 |
jpm |
33 |
|
990 |
isa |
34 |
private function chargerClassesSources($classe) {
|
|
|
35 |
$base = dirname(__FILE__).DS;
|
|
|
36 |
$cheminSources = $base.'sources'.DS;
|
|
|
37 |
$dossiers = array($base, $cheminSources);
|
|
|
38 |
foreach ($dossiers as $chemin) {
|
|
|
39 |
$fichierATester = $chemin.$classe.'.php';
|
|
|
40 |
if (file_exists($fichierATester)) {
|
|
|
41 |
include_once $fichierATester;
|
|
|
42 |
return null;
|
|
|
43 |
}
|
|
|
44 |
}
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
private function capturerParametres() {
|
1105 |
jpm |
48 |
$this->parametres['num_nom'] = isset($_GET['num_nom']) ? $_GET['num_nom'] : '';
|
|
|
49 |
$this->parametres['nom'] = isset($_GET['nom']) ? $_GET['nom'] : '';
|
|
|
50 |
$this->parametres['type_nom'] = isset($_GET['type_nom']) ? $_GET['type_nom'] : 'nom_scientifique';
|
|
|
51 |
$this->theme = isset($_GET['theme']) ? $_GET['theme'] : $this->theme;
|
|
|
52 |
|
|
|
53 |
$referentiel = isset($_GET['referentiel']) ? $_GET['referentiel'] : '';
|
|
|
54 |
Registre::set('parametres.referentiel', $referentiel);
|
|
|
55 |
|
|
|
56 |
$niveau = isset($_GET['niveau']) ? $_GET['niveau'] : '1';
|
|
|
57 |
Registre::set('parametres.niveau', $niveau);
|
990 |
isa |
58 |
}
|
1105 |
jpm |
59 |
|
990 |
isa |
60 |
public function executerActionParDefaut() {
|
|
|
61 |
$this->executerFiche();
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
public function executerFiche(){
|
1105 |
jpm |
65 |
$niveau = Registre::get('parametres.niveau');
|
|
|
66 |
$squelette = "theme_{$this->theme}_niveau{$niveau}";
|
|
|
67 |
|
990 |
isa |
68 |
$donnees = $this->parametres;
|
|
|
69 |
$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci_html').' '.$this->nom_retenu->get('auteur');
|
|
|
70 |
$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
|
|
|
71 |
$donnees = array_merge($this->obtenirDonnees(), $donnees);
|
|
|
72 |
$donnees['css'] = $this->obtenirLienCss();
|
1064 |
aurelien |
73 |
$donnees['url_absolue'] = "http://".$_SERVER['SERVER_NAME'].'/'.$_SERVER['REQUEST_URI'];
|
990 |
isa |
74 |
$donnees['contenu_onglet'] = $this->getVue($squelette, $donnees);
|
1105 |
jpm |
75 |
$donnees['lien'] = $this->url->obtenirUrlMobile($this->parametres['num_nom']);
|
990 |
isa |
76 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche', $donnees), true);
|
|
|
77 |
//print_r($donnees);
|
|
|
78 |
}
|
1105 |
jpm |
79 |
|
990 |
isa |
80 |
public function obtenirDonnees() {
|
|
|
81 |
$donnees = array();
|
|
|
82 |
$num_nom = $this->nomCourant->getNns();
|
|
|
83 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
1105 |
jpm |
84 |
|
992 |
isa |
85 |
$taxons = new Taxons($this->conteneur);
|
|
|
86 |
$donnees['permalien_num_nom'] = $taxons->getUrlPermalienNumNom($referentiel, 1, $num_nom);
|
1105 |
jpm |
87 |
|
990 |
isa |
88 |
$sources = array('illustrations', 'repartition', 'texte', 'floraison', 'nomsCommuns');
|
|
|
89 |
foreach ($sources as $source) {
|
|
|
90 |
$nom_classe = ucfirst($source);
|
|
|
91 |
$classe = new $nom_classe($this->conteneur);
|
|
|
92 |
$donnees[$source] = $classe->getDonnees();
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
return $donnees;
|
|
|
96 |
}
|
1105 |
jpm |
97 |
|
990 |
isa |
98 |
private function obtenirLienCss() {
|
1105 |
jpm |
99 |
$theme = $this->theme;
|
990 |
isa |
100 |
if (strcmp($this->theme, 'pyracantha') >= 0) {
|
1105 |
jpm |
101 |
$theme = 'pyracantha_blanc';
|
990 |
isa |
102 |
}
|
1105 |
jpm |
103 |
$lien = "modules/mobile/presentations/css/$theme.css";
|
990 |
isa |
104 |
return $lien;
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
?>
|