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 = '';
|
651 |
mathilde |
22 |
private $url;
|
291 |
jpm |
23 |
|
|
|
24 |
|
216 |
delphine |
25 |
public function initialiser() {
|
|
|
26 |
$this->capturerParametres();
|
500 |
jpm |
27 |
$this->conteneur = new Conteneur($this->parametres);
|
651 |
mathilde |
28 |
$this->url = $this->conteneur->getAppUrls();
|
376 |
delphine |
29 |
$this->nom_retenu = $this->conteneur->getNomCourant()->getNomRetenu();
|
238 |
delphine |
30 |
spl_autoload_register(array($this, 'chargerClassesOnglets'));
|
216 |
delphine |
31 |
}
|
291 |
jpm |
32 |
|
|
|
33 |
private function capturerParametres() {
|
|
|
34 |
if (isset($_GET['num_nom'])) {
|
|
|
35 |
$this->parametres['num_nom'] = $_GET['num_nom'];
|
|
|
36 |
}
|
|
|
37 |
if (isset($_GET['nom'])) {
|
|
|
38 |
$this->parametres['nom'] = $_GET['nom'];
|
|
|
39 |
}
|
|
|
40 |
if (isset($_GET['type_nom'])) {
|
|
|
41 |
$this->parametres['type_nom'] = $_GET['type_nom'];
|
|
|
42 |
}
|
395 |
aurelien |
43 |
if (isset($_GET['referentiel'])) {
|
|
|
44 |
$this->parametres['referentiel'] = $_GET['referentiel'];
|
|
|
45 |
}
|
291 |
jpm |
46 |
if (isset($_GET['niveau'])) {
|
|
|
47 |
Registre::set('parametres.niveau', $_GET['niveau']);
|
|
|
48 |
}
|
|
|
49 |
if (isset($_GET['onglet'])) {
|
|
|
50 |
$this->onglet = $_GET['onglet'];
|
|
|
51 |
}
|
|
|
52 |
}
|
|
|
53 |
|
238 |
delphine |
54 |
private function chargerClassesOnglets($classe) {
|
|
|
55 |
$base = dirname(__FILE__).DS;
|
|
|
56 |
$cheminFormateurs = $base.'formateurs'.DS;
|
|
|
57 |
$dossiers = array($base, $cheminFormateurs);
|
|
|
58 |
foreach ($dossiers as $chemin) {
|
|
|
59 |
$fichierATester = $chemin.$classe.'.php';
|
|
|
60 |
if (file_exists($fichierATester)) {
|
|
|
61 |
include_once $fichierATester;
|
|
|
62 |
return null;
|
|
|
63 |
}
|
|
|
64 |
}
|
|
|
65 |
}
|
291 |
jpm |
66 |
|
71 |
delphine |
67 |
public function executerActionParDefaut() {
|
|
|
68 |
$this->executerFiche();
|
|
|
69 |
}
|
291 |
jpm |
70 |
|
141 |
delphine |
71 |
public function executerFiche(){
|
525 |
gduche |
72 |
$squelette = 'fiche_'.$this->onglet;
|
|
|
73 |
|
|
|
74 |
//Gestion du niveau
|
545 |
gduche |
75 |
$niveau = isset($_GET['niveau']) ? $_GET['niveau'] : 2;
|
525 |
gduche |
76 |
if ($this->onglet == 'synthese' && $niveau != null) {
|
|
|
77 |
$squelette .= '_niveau'.$niveau;
|
|
|
78 |
}
|
|
|
79 |
|
|
|
80 |
$donnees = $this->parametres;
|
401 |
delphine |
81 |
$donnees['nom_retenu'] = $this->nom_retenu->get('nom_sci_html').' '.$this->nom_retenu->get('auteur');
|
380 |
delphine |
82 |
$donnees['famille'] = $this->nom_retenu->getTaxonSupRang('180');
|
291 |
jpm |
83 |
$this->executerAction('Recherche', 'executerAccueil', $this->parametres);
|
|
|
84 |
$blocs_niveaux = $this->conteneur->getParametreTableau('blocs_fiche_defaut');
|
219 |
delphine |
85 |
$donnees['blocs'] = '"'.str_replace('|', '","', $blocs_niveaux[Registre::get('parametres.niveau')]).'"';
|
291 |
jpm |
86 |
|
|
|
87 |
$donnees = array_merge($this->obtenirDonnees(), $donnees);
|
238 |
delphine |
88 |
$donnees['onglet'] = $this->onglet;
|
525 |
gduche |
89 |
$donnees['contenu_onglet'] = $this->getVue($squelette, $donnees);
|
907 |
aurelien |
90 |
$donnees['base_url_onglets'] = Config::get('base_url_application_onglets');
|
935 |
delphine |
91 |
$donnees['i18n'] = I18n::get('Fiche');
|
651 |
mathilde |
92 |
|
545 |
gduche |
93 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_accueil_niveau'.$niveau, $donnees), true);
|
709 |
aurelien |
94 |
$this->ajouterPiedDePage();
|
71 |
delphine |
95 |
}
|
291 |
jpm |
96 |
|
651 |
mathilde |
97 |
public function ajouterLienModuleExport() {
|
677 |
mathilde |
98 |
$donnees['lien'] = $this->url->obtenirUrlPdfExport($this->parametres['num_nom']);
|
709 |
aurelien |
99 |
$export = $this->getVue('fiche_pdf_lien', $donnees);
|
|
|
100 |
return $export;
|
651 |
mathilde |
101 |
}
|
|
|
102 |
|
709 |
aurelien |
103 |
public function ajouterPiedDePage() {
|
|
|
104 |
$description = new Description($this->conteneur);
|
|
|
105 |
$taxons = new Taxons($this->conteneur);
|
|
|
106 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
|
|
107 |
$donnees = array('wikipedia' => $description->getWikipedia(),
|
|
|
108 |
'export_pdf' => $this->ajouterLienModuleExport(),
|
|
|
109 |
'permalien_num_nom' => $taxons->getUrlPermalienNumNom($referentiel, 1, $this->conteneur->getNomCourant()->getNns()),
|
|
|
110 |
'permalien_taxon' => $taxons->getUrlPermalienTaxon($referentiel, 1, $this->conteneur->getNomCourant()->getNt()),
|
|
|
111 |
'nn' => $this->conteneur->getNomCourant()->getNns(),
|
|
|
112 |
'nt' => $this->conteneur->getNomCourant()->getNt(),
|
|
|
113 |
'wiki' => $description->getLienWikini());
|
|
|
114 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_pied_page', $donnees), true);
|
|
|
115 |
}
|
|
|
116 |
|
230 |
delphine |
117 |
public function executerOnglet(){
|
913 |
aurelien |
118 |
$this->viderSorties();
|
238 |
delphine |
119 |
$donnees = $this->obtenirDonnees();
|
291 |
jpm |
120 |
header('Content-type: text/html');
|
500 |
jpm |
121 |
$this->setSortie(self::RENDU_CORPS, $this->getVue('fiche_'.$this->onglet, $donnees));
|
230 |
delphine |
122 |
}
|
291 |
jpm |
123 |
|
|
|
124 |
private function obtenirDonnees() {
|
|
|
125 |
$donnees = array();
|
|
|
126 |
$classe = ucfirst($this->onglet);
|
|
|
127 |
$onglet = new $classe($this->conteneur);
|
|
|
128 |
$donnees = $onglet->obtenirDonnees();
|
238 |
delphine |
129 |
return $donnees;
|
|
|
130 |
}
|
71 |
delphine |
131 |
}
|
|
|
132 |
?>
|