Rev 762 | Rev 833 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
// declare(encoding='UTF-8');
/**
* Classe Onglet Synthese.
*
* @category PHP 5.2
* @package eflore-consultation
* @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
* @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$
*/
class Synthese extends aControleur {
private $conteneur = null;
private $nomCourant = null;
public function __construct(Conteneur $conteneur) {
$this->conteneur = $conteneur;
$this->nomCourant = $this->conteneur->getNomCourant();
parent::__construct();
}
public function obtenirDonnees() {
$donnees = array();
$num_nom = $this->nomCourant->getNns();
if(Config::get('cache')) {
$cache = array(
'illustration' => $this->obtenirCache('infos_bloc_'.$num_nom),
'repartition' => $this->obtenirCache('repartition_bloc_'.$num_nom),
'nomenclature' => $this->obtenirCache('nomenclature_bloc_'.$num_nom),
'description' => $this->obtenirCache('description_bloc_'.$num_nom),
'ethnobotanique' => $this->obtenirCache('ethnobotanique_bloc_'.$num_nom),
'classification' => $this->obtenirCache('classification_bloc_'.$num_nom),
'bibliographie' => $this->obtenirCache('bibliographie_bloc_'.$num_nom),
'statut' => $this->obtenirCache('statut_bloc_'.$num_nom),
'ecologie' => $this->obtenirCache('ecologie_bloc_'.$num_nom)
);
}
$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
// TODO: factoriser cette portion de code avec un tableau de classes
// et des boucles
if($cache['illustration'] != null) {
$donnees['illustration'] = $cache['illustration'];
} else {
$illustrations = new Illustrations($this->conteneur);
$donnees['illustration'] = $illustrations->getBloc();
if(!empty($donnees['illustration'])) {
$this->mettreEnCache('infos_bloc_'.$num_nom, $donnees['illustration']);
}
}
if($cache['repartition'] != null) {
$donnees['repartition'] = $cache['repartition'];
} else {
$repartition = new Repartition($this->conteneur);
$donnees['repartition'] = $repartition->getBloc();
$this->mettreEnCache('repartition_bloc_'.$num_nom, $donnees['repartition']);
}
if($cache['nomenclature'] != null) {
$donnees['nomenclature'] = $cache['nomenclature'];
} else {
$nomenclature = new Nomenclature($this->conteneur);
$donnees['nomenclature'] = $nomenclature->getBloc();
$this->mettreEnCache('nomenclature_bloc_'.$num_nom, $donnees['nomenclature']);
}
if($cache['description'] != null) {
$donnees['description'] = $cache['description'];
} else {
$description = new Description($this->conteneur);
$donnees['description'] = $description->getBloc();
// Le contenu des wiki ne doit pas être mis en cache dans la fiche synthèse car il est éditable en live
if($donnees['description']['titre'] != 'Description collaborative') {
$this->mettreEnCache('description_bloc_'.$num_nom, $donnees['description']);
}
}
if($cache['ethnobotanique'] != null) {
$donnees['ethnobotanique'] = $cache['ethnobotanique'];
} else {
$ethnobotanique = new Ethnobotanique($this->conteneur);
$donnees['ethnobotanique'] = $ethnobotanique->getBloc();
$this->mettreEnCache('ethnobotanique_bloc_'.$num_nom, $donnees['ethnobotanique']);
}
if($cache['classification'] != null) {
$donnees['classification'] = $cache['classification'];
} else {
$classification = new Classification($this->conteneur);
$donnees['classification'] = $classification->getBloc();
$this->mettreEnCache('classification_bloc_'.$num_nom, $donnees['classification']);
}
if($cache['bibliographie'] != null) {
$donnees['bibliographie'] = $cache['bibliographie'];
} else {
$bibliographie = new Bibliographie($this->conteneur);
$donnees['bibliographie'] = $bibliographie->getBloc();
$this->mettreEnCache('bibliographie_bloc_'.$num_nom, $donnees['bibliographie']);
}
if($cache['statut'] != null) {
$donnees['statut'] = $cache['statut'];
} else {
$statut = new Statut($this->conteneur);
$donnees['statut'] = $statut->getBloc();
$this->mettreEnCache('statut_bloc_'.$num_nom, $donnees['statut']);
}
if($cache['ecologie'] != null) {
$donnees['ecologie'] = $cache['ecologie'];
} else {
$ecologie = new Ecologie($this->conteneur);
$donnees['ecologie'] = $ecologie->getBloc();
$this->mettreEnCache('ecologie_bloc_'.$num_nom, $donnees['ecologie']);
}
return $donnees;
}
}
?>