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();
|
1359 |
mathias |
30 |
|
|
|
31 |
$nom = $this->conteneur->getApiNoms()->getNom($num_nom);
|
389 |
aurelien |
32 |
|
1058 |
raphael |
33 |
$blocs = array(
|
|
|
34 |
'illustrations', // grep-friendly: new Illustrations()
|
|
|
35 |
'repartition', // grep-friendly: new Repartition()
|
|
|
36 |
'nomenclature', // grep-friendly: new Nomenclature()
|
|
|
37 |
'description', // grep-friendly: new Description()
|
|
|
38 |
'ethnobotanique', // grep-friendly: new Ethnobotanique()
|
|
|
39 |
'bibliographie', // grep-friendly: new Bibliographie()
|
|
|
40 |
'statut', // grep-friendly: new Statut()
|
|
|
41 |
'ecologie' // grep-friendly: new Ecologie()
|
|
|
42 |
);
|
876 |
aurelien |
43 |
$cache = array();
|
|
|
44 |
|
389 |
aurelien |
45 |
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
|
1359 |
mathias |
46 |
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt, 'nom_sci' => $nom['nom_complet']);
|
961 |
aurelien |
47 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
876 |
aurelien |
48 |
foreach ($blocs as $bloc) {
|
1058 |
raphael |
49 |
// TODO: unserialize() pourrait aussi légitimement retourner FALSE
|
|
|
50 |
$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom));
|
1434 |
delphine |
51 |
// TODO: revoir le systeme de cache par bloc avec des blocs cachés et d'autres non
|
|
|
52 |
if($cache_bloc && $bloc != "illustrations") {
|
876 |
aurelien |
53 |
$donnees[$bloc] = $cache_bloc;
|
|
|
54 |
} else {
|
|
|
55 |
$nom_classe = ucfirst($bloc);
|
|
|
56 |
$classe = new $nom_classe($this->conteneur);
|
|
|
57 |
$donnees[$bloc] = $classe->getBloc();
|
1058 |
raphael |
58 |
if($donnees[$bloc]) {
|
|
|
59 |
$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]),
|
|
|
60 |
$bloc.'/bloc/'.$referentiel.'_'.$num_nom);
|
876 |
aurelien |
61 |
}
|
744 |
aurelien |
62 |
}
|
|
|
63 |
}
|
291 |
jpm |
64 |
return $donnees;
|
|
|
65 |
}
|
|
|
66 |
}
|
|
|
67 |
?>
|