28,96 → 28,27 |
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) |
); |
} |
|
$blocs = array('illustrations','repartition','nomenclature','description', |
'ethnobotanique','bibliographie','statut','ecologie'); |
$cache = array(); |
|
$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']); |
foreach ($blocs as $bloc) { |
$cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'_bloc_'.$num_nom) : null; |
if($cache_bloc != null) { |
$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_'.$num_nom, $donnees[$bloc]); |
} |
} |
} |
|
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['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; |
} |
|
} |
?> |