Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 961 | Rev 1359 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 961 Rev 1058
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe Onglet Synthese.
4
 * Classe Onglet Synthese.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @author		Grégoire DUCHÉ <gregoire@tela-botanica.org>
10
 * @author		Grégoire DUCHÉ <gregoire@tela-botanica.org>
-
 
11
 * @author		Raphaël Droz <raphael@tela-botanica.org>
11
 * @copyright	2011 Tela-Botanica
12
 * @copyright	2011, 2013 Tela-Botanica
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
13
 * @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
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
14
 * @version		$Id$
15
 * @used by		modules/fiche/Fiche.php::obtenirDonnees()
15
 */
16
 */
16
class Synthese extends aControleur {
17
class Synthese /* aControleur inutilisé à ce jour */ {
17
 
18
 
18
	private $conteneur = null;
19
	private $conteneur = null;
19
	private $nomCourant = null;
20
	private $nomCourant = null;
20
 
21
 
21
	public function __construct(Conteneur $conteneur) {
22
	public function __construct(Conteneur $conteneur) {
22
		$this->conteneur = $conteneur;
23
		$this->conteneur = $conteneur;
23
		$this->nomCourant = $this->conteneur->getNomCourant();
24
		$this->nomCourant = $this->conteneur->getNomCourant();
24
		
-
 
25
		parent::__construct();
-
 
26
	}
25
	}
27
 
26
 
28
	public function obtenirDonnees() {
27
	public function obtenirDonnees() {
29
		$donnees = array();
28
		$donnees = array();
30
		$num_nom = $this->nomCourant->getNns();
29
		$num_nom = $this->nomCourant->getNns();
-
 
30
		
31
		
31
		$blocs = array(
-
 
32
			'illustrations', // grep-friendly: new Illustrations()
-
 
33
			'repartition', // grep-friendly: new Repartition()
-
 
34
			'nomenclature', // grep-friendly: new Nomenclature()
32
		$blocs = array('illustrations','repartition','nomenclature','description',
35
			'description', // grep-friendly: new Description()
-
 
36
			'ethnobotanique', // grep-friendly: new Ethnobotanique()
-
 
37
			'bibliographie', // grep-friendly: new Bibliographie()
-
 
38
			'statut', // grep-friendly: new Statut()
-
 
39
			'ecologie' // grep-friendly: new Ecologie()
33
				'ethnobotanique','bibliographie','statut','ecologie');
40
		);
34
		$cache = array();
41
		$cache = array();
35
		
42
		
36
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
43
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
37
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
44
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
38
		$referentiel = $this->conteneur->getParametre('referentiel');
45
		$referentiel = $this->conteneur->getParametre('referentiel');
39
		foreach ($blocs as $bloc) {
46
		foreach ($blocs as $bloc) {
-
 
47
			// TODO: unserialize() pourrait aussi légitimement retourner FALSE
40
			$cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom) : null;
48
			$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom));
41
			if($cache_bloc != null) {
49
			if($cache_bloc) {
42
				$donnees[$bloc] = $cache_bloc;
50
				$donnees[$bloc] = $cache_bloc;
43
			} else {
51
			} else {
44
				$nom_classe = ucfirst($bloc);
52
				$nom_classe = ucfirst($bloc);
45
				$classe = new $nom_classe($this->conteneur);
53
				$classe = new $nom_classe($this->conteneur);
46
				$donnees[$bloc] = $classe->getBloc();
54
				$donnees[$bloc] = $classe->getBloc();
47
				if(!empty($donnees[$bloc])) {
55
				if($donnees[$bloc]) {
-
 
56
					$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]),
48
					$this->mettreEnCache($bloc.'/bloc/'.$referentiel.'_'.$num_nom, $donnees[$bloc]);
57
														 $bloc.'/bloc/'.$referentiel.'_'.$num_nom);
49
				}
58
				}
50
			}
59
			}
51
		}
60
		}
52
		return $donnees;
61
		return $donnees;
53
	}
62
	}
54
}
63
}
55
?>
64
?>