Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 1057 → Rev 1058

/trunk/modules/fiche/Fiche.php
157,7 → 157,7
private function obtenirDonnees() {
$donnees = array();
$classe = ucfirst($this->onglet);
$onglet = new $classe($this->conteneur);
$onglet = new $classe($this->conteneur); // grep-friendly: new Synthese()
$donnees = $onglet->obtenirDonnees();
return $donnees;
}
/trunk/modules/fiche/formateurs/Synthese.php
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);
}
}
}
/trunk/modules/fiche/formateurs/Ecologie.php
8,10 → 8,12
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
* @author Mathilde Salthun-lassalle <mathilde@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/pdf_export/PdfExport.php::initialiser()
* @used by modules/fiche/formateurs/Synthese.php::obtenirDonnees()
*/
class Ecologie extends aControleur {
155,11 → 157,13
}
private function getBaseflor($inclure_legende = true) {
if (Config::get($this->referentiel.'.baseEcologie') != "") {
if (Config::get($this->referentiel.'.baseEcologie')) {
$referentiel = $this->conteneur->getParametre('referentiel');
$num_nom = $this->nomCourant->getNnr();
$referentiel = $this->conteneur->getParametre('referentiel');
$cache = $this->obtenirCache('baseflor/graphique/'.$referentiel.'_'.$num_nom);
if($cache != null) {
 
// TODO: unserialize() pourrait aussi légitimement retourner FALSE
$cache = unserialize($this->conteneur->getCache()->charger('baseflor/graphique/'.$referentiel.'_'.$num_nom));
if($cache) {
$baseflor = $cache;
$this->graphique ->setProjet('baseflor');
$graphique = $this->graphique->getLegendeGraphique();
196,7 → 200,8
$baseflor['meta']['citation'] = $citation;
$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
$this->mettreEnCache('baseflor/graphique/'.$referentiel.'_'.$num_nom, $baseflor);
$this->conteneur->getCache()->sauver(serialize($baseflor),
'baseflor/graphique/'.$referentiel.'_'.$num_nom);
} else {
$baseflor['aucune'] = 'Aucune donnée';
}
/trunk/controleurs/aControleur.php
295,17 → 295,5
$url = $this->urlBase->getURL();
return $url;
}
 
public function obtenirCache($id) {
$retour = unserialize($this->cache->charger($id));
if ($retour == false) {
$retour = null;
}
return $retour;
}
public function mettreEnCache($id, $donnees) {
$this->cache->sauver(serialize($donnees), $id);
}
}
?>