8,12 → 8,13 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org> |
* @author Delphine CAUQUIL <delphine@tela-botanica.org> |
* @author Grégoire DUCHÉ <gregoire@tela-botanica.org> |
* @copyright 2011 Tela-Botanica |
* @author Raphaël Droz <raphael@tela-botanica.org> |
* @copyright 2011, 2013 Tela-Botanica |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2 |
* @version $Id$ |
* @used by modules/fiche/Fiche.php::obtenirDonnees() |
*/ |
class Synthese extends aControleur { |
class Synthese /* aControleur inutilisé à ce jour */ { |
|
private $conteneur = null; |
private $nomCourant = null; |
21,8 → 22,6 |
public function __construct(Conteneur $conteneur) { |
$this->conteneur = $conteneur; |
$this->nomCourant = $this->conteneur->getNomCourant(); |
|
parent::__construct(); |
} |
|
public function obtenirDonnees() { |
29,8 → 28,16 |
$donnees = array(); |
$num_nom = $this->nomCourant->getNns(); |
|
$blocs = array('illustrations','repartition','nomenclature','description', |
'ethnobotanique','bibliographie','statut','ecologie'); |
$blocs = array( |
'illustrations', // grep-friendly: new Illustrations() |
'repartition', // grep-friendly: new Repartition() |
'nomenclature', // grep-friendly: new Nomenclature() |
'description', // grep-friendly: new Description() |
'ethnobotanique', // grep-friendly: new Ethnobotanique() |
'bibliographie', // grep-friendly: new Bibliographie() |
'statut', // grep-friendly: new Statut() |
'ecologie' // grep-friendly: new Ecologie() |
); |
$cache = array(); |
|
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique'); |
37,15 → 44,17 |
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt); |
$referentiel = $this->conteneur->getParametre('referentiel'); |
foreach ($blocs as $bloc) { |
$cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom) : null; |
if($cache_bloc != null) { |
// TODO: unserialize() pourrait aussi légitimement retourner FALSE |
$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom)); |
if($cache_bloc) { |
$donnees[$bloc] = $cache_bloc; |
} else { |
$nom_classe = ucfirst($bloc); |
$classe = new $nom_classe($this->conteneur); |
$donnees[$bloc] = $classe->getBloc(); |
if(!empty($donnees[$bloc])) { |
$this->mettreEnCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom, $donnees[$bloc]); |
if($donnees[$bloc]) { |
$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]), |
$bloc.'/bloc/'.$referentiel.'_'.$num_nom); |
} |
} |
} |