Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1359 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1359 Rev 1434
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
 * @author		Raphaël Droz <raphael@tela-botanica.org>
12
 * @copyright	2011, 2013 Tela-Botanica
12
 * @copyright	2011, 2013 Tela-Botanica
13
 * @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
14
 * @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
15
 * @used by		modules/fiche/Fiche.php::obtenirDonnees()
15
 * @used by		modules/fiche/Fiche.php::obtenirDonnees()
16
 */
16
 */
17
class Synthese /* aControleur inutilisé à ce jour */ {
17
class Synthese /* aControleur inutilisé à ce jour */ {
18
 
18
 
19
	private $conteneur = null;
19
	private $conteneur = null;
20
	private $nomCourant = null;
20
	private $nomCourant = null;
21
 
21
 
22
	public function __construct(Conteneur $conteneur) {
22
	public function __construct(Conteneur $conteneur) {
23
		$this->conteneur = $conteneur;
23
		$this->conteneur = $conteneur;
24
		$this->nomCourant = $this->conteneur->getNomCourant();
24
		$this->nomCourant = $this->conteneur->getNomCourant();
25
	}
25
	}
26
 
26
 
27
	public function obtenirDonnees() {
27
	public function obtenirDonnees() {
28
		$donnees = array();
28
		$donnees = array();
29
		$num_nom = $this->nomCourant->getNns();
29
		$num_nom = $this->nomCourant->getNns();
30
 
30
 
31
		$nom = $this->conteneur->getApiNoms()->getNom($num_nom);
31
		$nom = $this->conteneur->getApiNoms()->getNom($num_nom);
32
		
32
		
33
		$blocs = array(
33
		$blocs = array(
34
			'illustrations', // grep-friendly: new Illustrations()
34
			'illustrations', // grep-friendly: new Illustrations()
35
			'repartition', // grep-friendly: new Repartition()
35
			'repartition', // grep-friendly: new Repartition()
36
			'nomenclature', // grep-friendly: new Nomenclature()
36
			'nomenclature', // grep-friendly: new Nomenclature()
37
			'description', // grep-friendly: new Description()
37
			'description', // grep-friendly: new Description()
38
			'ethnobotanique', // grep-friendly: new Ethnobotanique()
38
			'ethnobotanique', // grep-friendly: new Ethnobotanique()
39
			'bibliographie', // grep-friendly: new Bibliographie()
39
			'bibliographie', // grep-friendly: new Bibliographie()
40
			'statut', // grep-friendly: new Statut()
40
			'statut', // grep-friendly: new Statut()
41
			'ecologie' // grep-friendly: new Ecologie()
41
			'ecologie' // grep-friendly: new Ecologie()
42
		);
42
		);
43
		$cache = array();
43
		$cache = array();
44
		
44
		
45
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
45
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
46
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt, 'nom_sci' => $nom['nom_complet']);
46
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt, 'nom_sci' => $nom['nom_complet']);
47
		$referentiel = $this->conteneur->getParametre('referentiel');
47
		$referentiel = $this->conteneur->getParametre('referentiel');
48
		foreach ($blocs as $bloc) {
48
		foreach ($blocs as $bloc) {
49
			// TODO: unserialize() pourrait aussi légitimement retourner FALSE
49
			// TODO: unserialize() pourrait aussi légitimement retourner FALSE
50
			$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom));
50
			$cache_bloc = unserialize($this->conteneur->getCache()->charger($bloc.'/bloc/'.$referentiel.'_'.$num_nom));
-
 
51
			// TODO: revoir le systeme de cache par bloc avec des blocs cachés et d'autres non
51
			if($cache_bloc) {
52
			if($cache_bloc && $bloc != "illustrations") {
52
				$donnees[$bloc] = $cache_bloc;
53
				$donnees[$bloc] = $cache_bloc;
53
			} else {
54
			} else {
54
				$nom_classe = ucfirst($bloc);
55
				$nom_classe = ucfirst($bloc);
55
				$classe = new $nom_classe($this->conteneur);
56
				$classe = new $nom_classe($this->conteneur);
56
				$donnees[$bloc] = $classe->getBloc();
57
				$donnees[$bloc] = $classe->getBloc();
57
				if($donnees[$bloc]) {
58
				if($donnees[$bloc]) {
58
					$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]),
59
					$this->conteneur->getCache()->sauver(serialize($donnees[$bloc]),
59
														 $bloc.'/bloc/'.$referentiel.'_'.$num_nom);
60
														 $bloc.'/bloc/'.$referentiel.'_'.$num_nom);
60
				}
61
				}
61
			}
62
			}
62
		}
63
		}
63
		return $donnees;
64
		return $donnees;
64
	}
65
	}
65
}
66
}
66
?>
67
?>