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>
|
1058 |
raphael |
11 |
* @author Raphaël Droz <raphael@tela-botanica.org>
|
|
|
12 |
* @copyright 2011, 2013 Tela-Botanica
|
291 |
jpm |
13 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
|
|
|
14 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
|
1058 |
raphael |
15 |
* @used by modules/fiche/Fiche.php::obtenirDonnees()
|
291 |
jpm |
16 |
*/
|
1058 |
raphael |
17 |
class Synthese /* aControleur inutilisé à ce jour */ {
|
291 |
jpm |
18 |
|
|
|
19 |
private $conteneur = null;
|
294 |
delphine |
20 |
private $nomCourant = null;
|
291 |
jpm |
21 |
|
|
|
22 |
public function __construct(Conteneur $conteneur) {
|
|
|
23 |
$this->conteneur = $conteneur;
|
294 |
delphine |
24 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
291 |
jpm |
25 |
}
|
|
|
26 |
|
|
|
27 |
public function obtenirDonnees() {
|
|
|
28 |
$donnees = array();
|
744 |
aurelien |
29 |
$num_nom = $this->nomCourant->getNns();
|
389 |
aurelien |
30 |
|
1058 |
raphael |
31 |
$blocs = array(
|
|
|
32 |
'illustrations', // grep-friendly: new Illustrations()
|
|
|
33 |
'repartition', // grep-friendly: new Repartition()
|
|
|
34 |
'nomenclature', // grep-friendly: new Nomenclature()
|
|
|
35 |
'description', // grep-friendly: new Description()
|
|
|
36 |
'ethnobotanique', // grep-friendly: new Ethnobotanique()
|
|
|
37 |
'bibliographie', // grep-friendly: new Bibliographie()
|
|
|
38 |
'statut', // grep-friendly: new Statut()
|
|
|
39 |
'ecologie' // grep-friendly: new Ecologie()
|
|
|
40 |
);
|
876 |
aurelien |
41 |
$cache = array();
|
|
|
42 |
|
389 |
aurelien |
43 |
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
|
|
|
44 |
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
|
961 |
aurelien |
45 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
876 |
aurelien |
46 |
foreach ($blocs as $bloc) {
|
1058 |
raphael |
47 |
// TODO: unserialize() pourrait aussi légitimement retourner FALSE
|
|
|
48 |
$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom));
|
|
|
49 |
if($cache_bloc) {
|
876 |
aurelien |
50 |
$donnees[$bloc] = $cache_bloc;
|
|
|
51 |
} else {
|
|
|
52 |
$nom_classe = ucfirst($bloc);
|
|
|
53 |
$classe = new $nom_classe($this->conteneur);
|
|
|
54 |
$donnees[$bloc] = $classe->getBloc();
|
1058 |
raphael |
55 |
if($donnees[$bloc]) {
|
|
|
56 |
$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]),
|
|
|
57 |
$bloc.'/bloc/'.$referentiel.'_'.$num_nom);
|
876 |
aurelien |
58 |
}
|
744 |
aurelien |
59 |
}
|
|
|
60 |
}
|
291 |
jpm |
61 |
return $donnees;
|
|
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
?>
|