Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
291 jpm 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe Onglet Synthese.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @author		Grégoire DUCHÉ <gregoire@tela-botanica.org>
11
 * @copyright	2011 Tela-Botanica
12
 * @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
 * @version		$Id$
15
 */
16
class Synthese extends aControleur {
17
 
18
	private $conteneur = null;
294 delphine 19
	private $nomCourant = null;
291 jpm 20
 
21
	public function __construct(Conteneur $conteneur) {
22
		$this->conteneur = $conteneur;
294 delphine 23
		$this->nomCourant = $this->conteneur->getNomCourant();
744 aurelien 24
 
25
		parent::__construct();
291 jpm 26
	}
27
 
28
	public function obtenirDonnees() {
29
		$donnees = array();
744 aurelien 30
		$num_nom = $this->nomCourant->getNns();
389 aurelien 31
 
876 aurelien 32
		$blocs = array('illustrations','repartition','nomenclature','description',
33
				'ethnobotanique','bibliographie','statut','ecologie');
34
		$cache = array();
35
 
389 aurelien 36
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
37
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
961 aurelien 38
		$referentiel = $this->conteneur->getParametre('referentiel');
876 aurelien 39
		foreach ($blocs as $bloc) {
961 aurelien 40
			$cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom) : null;
876 aurelien 41
			if($cache_bloc != null) {
42
				$donnees[$bloc] = $cache_bloc;
43
			} else {
44
				$nom_classe = ucfirst($bloc);
45
				$classe = new $nom_classe($this->conteneur);
46
				$donnees[$bloc] = $classe->getBloc();
47
				if(!empty($donnees[$bloc])) {
961 aurelien 48
					$this->mettreEnCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom, $donnees[$bloc]);
876 aurelien 49
				}
744 aurelien 50
			}
51
		}
291 jpm 52
		return $donnees;
53
	}
54
}
55
?>