Line 6... |
Line 6... |
6 |
* @category PHP 5.2
|
6 |
* @category PHP 5.2
|
7 |
* @package eflore-consultation
|
7 |
* @package eflore-consultation
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
9 |
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
|
9 |
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
|
10 |
* @author Grégoire DUCHÉ <gregoire@tela-botanica.org>
|
10 |
* @author Grégoire DUCHÉ <gregoire@tela-botanica.org>
|
- |
|
11 |
* @author Raphaël Droz <raphael@tela-botanica.org>
|
11 |
* @copyright 2011 Tela-Botanica
|
12 |
* @copyright 2011, 2013 Tela-Botanica
|
12 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
|
13 |
* @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 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
|
14 |
* @version $Id$
|
15 |
* @used by modules/fiche/Fiche.php::obtenirDonnees()
|
15 |
*/
|
16 |
*/
|
16 |
class Synthese extends aControleur {
|
17 |
class Synthese /* aControleur inutilisé à ce jour */ {
|
Line 17... |
Line 18... |
17 |
|
18 |
|
18 |
private $conteneur = null;
|
19 |
private $conteneur = null;
|
Line 19... |
Line 20... |
19 |
private $nomCourant = null;
|
20 |
private $nomCourant = null;
|
20 |
|
21 |
|
21 |
public function __construct(Conteneur $conteneur) {
|
22 |
public function __construct(Conteneur $conteneur) {
|
22 |
$this->conteneur = $conteneur;
|
- |
|
23 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
- |
|
24 |
|
23 |
$this->conteneur = $conteneur;
|
Line 25... |
Line 24... |
25 |
parent::__construct();
|
24 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
26 |
}
|
25 |
}
|
27 |
|
26 |
|
Line -... |
Line 27... |
- |
|
27 |
public function obtenirDonnees() {
|
28 |
public function obtenirDonnees() {
|
28 |
$donnees = array();
|
- |
|
29 |
$num_nom = $this->nomCourant->getNns();
|
- |
|
30 |
|
- |
|
31 |
$blocs = array(
|
29 |
$donnees = 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()
|
30 |
$num_nom = $this->nomCourant->getNns();
|
37 |
'bibliographie', // grep-friendly: new Bibliographie()
|
Line 31... |
Line 38... |
31 |
|
38 |
'statut', // grep-friendly: new Statut()
|
32 |
$blocs = array('illustrations','repartition','nomenclature','description',
|
39 |
'ecologie' // grep-friendly: new Ecologie()
|
33 |
'ethnobotanique','bibliographie','statut','ecologie');
|
40 |
);
|
34 |
$cache = array();
|
41 |
$cache = array();
|
- |
|
42 |
|
35 |
|
43 |
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
|
36 |
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
|
44 |
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
|
37 |
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
|
45 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
38 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
46 |
foreach ($blocs as $bloc) {
|
39 |
foreach ($blocs as $bloc) {
|
47 |
// TODO: unserialize() pourrait aussi légitimement retourner FALSE
|
40 |
$cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom) : null;
|
48 |
$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom));
|
41 |
if($cache_bloc != null) {
|
49 |
if($cache_bloc) {
|
42 |
$donnees[$bloc] = $cache_bloc;
|
50 |
$donnees[$bloc] = $cache_bloc;
|
- |
|
51 |
} else {
|
43 |
} else {
|
52 |
$nom_classe = ucfirst($bloc);
|
44 |
$nom_classe = ucfirst($bloc);
|
53 |
$classe = new $nom_classe($this->conteneur);
|
45 |
$classe = new $nom_classe($this->conteneur);
|
54 |
$donnees[$bloc] = $classe->getBloc();
|
46 |
$donnees[$bloc] = $classe->getBloc();
|
55 |
if($donnees[$bloc]) {
|
47 |
if(!empty($donnees[$bloc])) {
|
56 |
$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]),
|
48 |
$this->mettreEnCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom, $donnees[$bloc]);
|
57 |
$bloc.'/bloc/'.$referentiel.'_'.$num_nom);
|