291 |
jpm |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe Onglet Synthese.
|
|
|
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 |
* @author Grégoire DUCHÉ <gregoire@tela-botanica.org>
|
|
|
11 |
* @copyright 2011 Tela-Botanica
|
|
|
12 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
|
|
|
13 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
|
|
|
14 |
* @version $Id$
|
|
|
15 |
*/
|
|
|
16 |
class Synthese extends aControleur {
|
|
|
17 |
|
|
|
18 |
private $conteneur = null;
|
294 |
delphine |
19 |
private $nomCourant = null;
|
291 |
jpm |
20 |
|
|
|
21 |
public function __construct(Conteneur $conteneur) {
|
|
|
22 |
$this->conteneur = $conteneur;
|
294 |
delphine |
23 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
744 |
aurelien |
24 |
|
|
|
25 |
parent::__construct();
|
291 |
jpm |
26 |
}
|
|
|
27 |
|
|
|
28 |
public function obtenirDonnees() {
|
|
|
29 |
$donnees = array();
|
744 |
aurelien |
30 |
$num_nom = $this->nomCourant->getNns();
|
762 |
aurelien |
31 |
if(Config::get('cache')) {
|
|
|
32 |
$cache = array(
|
|
|
33 |
'illustration' => $this->obtenirCache('infos_bloc_'.$num_nom),
|
|
|
34 |
'repartition' => $this->obtenirCache('repartition_bloc_'.$num_nom),
|
|
|
35 |
'nomenclature' => $this->obtenirCache('nomenclature_bloc_'.$num_nom),
|
|
|
36 |
'description' => $this->obtenirCache('description_bloc_'.$num_nom),
|
|
|
37 |
'ethnobotanique' => $this->obtenirCache('ethnobotanique_bloc_'.$num_nom),
|
|
|
38 |
'classification' => $this->obtenirCache('classification_bloc_'.$num_nom),
|
|
|
39 |
'bibliographie' => $this->obtenirCache('bibliographie_bloc_'.$num_nom),
|
|
|
40 |
'statut' => $this->obtenirCache('statut_bloc_'.$num_nom),
|
|
|
41 |
'ecologie' => $this->obtenirCache('ecologie_bloc_'.$num_nom)
|
|
|
42 |
);
|
|
|
43 |
}
|
389 |
aurelien |
44 |
|
|
|
45 |
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
|
|
|
46 |
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
|
744 |
aurelien |
47 |
|
|
|
48 |
// TODO: factoriser cette portion de code avec un tableau de classes
|
|
|
49 |
// et des boucles
|
|
|
50 |
if($cache['illustration'] != null) {
|
|
|
51 |
$donnees['illustration'] = $cache['illustration'];
|
|
|
52 |
} else {
|
|
|
53 |
$illustrations = new Illustrations($this->conteneur);
|
|
|
54 |
$donnees['illustration'] = $illustrations->getBloc();
|
|
|
55 |
if(!empty($donnees['illustration'])) {
|
|
|
56 |
$this->mettreEnCache('infos_bloc_'.$num_nom, $donnees['illustration']);
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
if($cache['repartition'] != null) {
|
|
|
61 |
$donnees['repartition'] = $cache['repartition'];
|
|
|
62 |
} else {
|
|
|
63 |
$repartition = new Repartition($this->conteneur);
|
|
|
64 |
$donnees['repartition'] = $repartition->getBloc();
|
|
|
65 |
$this->mettreEnCache('repartition_bloc_'.$num_nom, $donnees['repartition']);
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
if($cache['nomenclature'] != null) {
|
|
|
69 |
$donnees['nomenclature'] = $cache['nomenclature'];
|
|
|
70 |
} else {
|
|
|
71 |
$nomenclature = new Nomenclature($this->conteneur);
|
|
|
72 |
$donnees['nomenclature'] = $nomenclature->getBloc();
|
|
|
73 |
$this->mettreEnCache('nomenclature_bloc_'.$num_nom, $donnees['nomenclature']);
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
if($cache['description'] != null) {
|
|
|
77 |
$donnees['description'] = $cache['description'];
|
|
|
78 |
} else {
|
|
|
79 |
$description = new Description($this->conteneur);
|
|
|
80 |
$donnees['description'] = $description->getBloc();
|
|
|
81 |
// Le contenu des wiki ne doit pas être mis en cache dans la fiche synthèse car il est éditable en live
|
|
|
82 |
if($donnees['description']['titre'] != 'Description collaborative') {
|
|
|
83 |
$this->mettreEnCache('description_bloc_'.$num_nom, $donnees['description']);
|
|
|
84 |
}
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
if($cache['ethnobotanique'] != null) {
|
|
|
88 |
$donnees['ethnobotanique'] = $cache['ethnobotanique'];
|
|
|
89 |
} else {
|
|
|
90 |
$ethnobotanique = new Ethnobotanique($this->conteneur);
|
|
|
91 |
$donnees['ethnobotanique'] = $ethnobotanique->getBloc();
|
|
|
92 |
$this->mettreEnCache('ethnobotanique_bloc_'.$num_nom, $donnees['ethnobotanique']);
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
if($cache['classification'] != null) {
|
|
|
96 |
$donnees['classification'] = $cache['classification'];
|
|
|
97 |
} else {
|
|
|
98 |
$classification = new Classification($this->conteneur);
|
|
|
99 |
$donnees['classification'] = $classification->getBloc();
|
|
|
100 |
$this->mettreEnCache('classification_bloc_'.$num_nom, $donnees['classification']);
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
if($cache['bibliographie'] != null) {
|
|
|
104 |
$donnees['bibliographie'] = $cache['bibliographie'];
|
|
|
105 |
} else {
|
|
|
106 |
$bibliographie = new Bibliographie($this->conteneur);
|
|
|
107 |
$donnees['bibliographie'] = $bibliographie->getBloc();
|
|
|
108 |
$this->mettreEnCache('bibliographie_bloc_'.$num_nom, $donnees['bibliographie']);
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
if($cache['statut'] != null) {
|
|
|
112 |
$donnees['statut'] = $cache['statut'];
|
|
|
113 |
} else {
|
|
|
114 |
$statut = new Statut($this->conteneur);
|
422 |
delphine |
115 |
$donnees['statut'] = $statut->obtenirDonnees();
|
744 |
aurelien |
116 |
$this->mettreEnCache('statut_bloc_'.$num_nom, $donnees['statut']);
|
|
|
117 |
}
|
|
|
118 |
|
|
|
119 |
if($cache['ecologie'] != null) {
|
|
|
120 |
$donnees['ecologie'] = $cache['ecologie'];
|
|
|
121 |
} else {
|
|
|
122 |
$ecologie = new Ecologie($this->conteneur);
|
|
|
123 |
$donnees['ecologie'] = $ecologie->getBloc();
|
|
|
124 |
$this->mettreEnCache('ecologie_bloc_'.$num_nom, $donnees['ecologie']);
|
|
|
125 |
}
|
291 |
jpm |
126 |
return $donnees;
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
}
|
|
|
130 |
?>
|