Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 833 | Rev 961 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 833 Rev 876
Line 26... Line 26...
26
	}
26
	}
Line 27... Line 27...
27
 
27
 
28
	public function obtenirDonnees() {
28
	public function obtenirDonnees() {
29
		$donnees = array();
29
		$donnees = array();
30
		$num_nom = $this->nomCourant->getNns();
-
 
31
		if(Config::get('cache')) {
-
 
32
			$cache = array(
-
 
33
				'illustration' => $this->obtenirCache('infos_bloc_'.$num_nom),
-
 
-
 
30
		$num_nom = $this->nomCourant->getNns();
34
				'repartition' => $this->obtenirCache('repartition_bloc_'.$num_nom),
31
		
35
				'nomenclature' => $this->obtenirCache('nomenclature_bloc_'.$num_nom),
-
 
36
				'description' => $this->obtenirCache('description_bloc_'.$num_nom),
32
		$blocs = array('illustrations','repartition','nomenclature','description',
37
				'ethnobotanique' => $this->obtenirCache('ethnobotanique_bloc_'.$num_nom),
-
 
38
				'classification' => $this->obtenirCache('classification_bloc_'.$num_nom),
-
 
39
				'bibliographie' => $this->obtenirCache('bibliographie_bloc_'.$num_nom),
-
 
40
				'statut' => $this->obtenirCache('statut_bloc_'.$num_nom),
-
 
41
				'ecologie' => $this->obtenirCache('ecologie_bloc_'.$num_nom)
33
				'ethnobotanique','bibliographie','statut','ecologie');
42
			);
-
 
Line 43... Line 34...
43
		}
34
		$cache = array();
44
		
35
		
45
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
-
 
46
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
-
 
47
		
-
 
48
		// TODO: factoriser cette portion de code avec un tableau de classes 
36
		$nt = $this->conteneur->getNomCourant()->getNomRetenu()->get('num_taxonomique');
49
		// et des boucles
-
 
50
		if($cache['illustration'] != null) {
-
 
51
			$donnees['illustration'] = $cache['illustration'];
-
 
52
		} else {
-
 
53
			$illustrations = new Illustrations($this->conteneur);
-
 
54
			$donnees['illustration'] = $illustrations->getBloc();
37
		$donnees['infos'] = array('referentiel' => $this->conteneur->getParametre('referentiel'), 'num_tax' => $nt);
55
			if(!empty($donnees['illustration'])) {
-
 
56
				$this->mettreEnCache('infos_bloc_'.$num_nom, $donnees['illustration']);
-
 
57
			}
-
 
58
		}
38
		foreach ($blocs as $bloc) {
59
		
39
			$cache_bloc = Config::get('cache') ? $this->obtenirCache($bloc.'_bloc_'.$num_nom) : null;
60
		if($cache['repartition'] != null) {
40
			if($cache_bloc != null) {
61
			$donnees['repartition'] = $cache['repartition'];
-
 
62
		} else {
-
 
63
			$repartition = new Repartition($this->conteneur);
-
 
64
			$donnees['repartition'] = $repartition->getBloc();
-
 
65
			$this->mettreEnCache('repartition_bloc_'.$num_nom, $donnees['repartition']);
-
 
66
		}
-
 
67
		
41
				$donnees[$bloc] = $cache_bloc;
68
		if($cache['nomenclature'] != null) {
-
 
69
			$donnees['nomenclature'] = $cache['nomenclature'];
42
			} else {
70
		} else {
43
				$nom_classe = ucfirst($bloc);
-
 
44
				$classe = new $nom_classe($this->conteneur);
71
			$nomenclature = new Nomenclature($this->conteneur);
45
				$donnees[$bloc] = $classe->getBloc();
72
			$donnees['nomenclature'] = $nomenclature->getBloc();
46
				if(!empty($donnees[$bloc])) {
73
			$this->mettreEnCache('nomenclature_bloc_'.$num_nom, $donnees['nomenclature']);
-
 
74
		}
-
 
75
		
-
 
76
		if($cache['description'] != null) {
-
 
77
			$donnees['description'] = $cache['description'];
-
 
78
		} else {
-
 
79
			$description = new Description($this->conteneur);
-
 
80
			$donnees['description'] = $description->getBloc();
-
 
81
			// Le contenu des wiki ne doit pas être mis en cache dans la fiche synthèse car il est éditable en live
-
 
82
			if($donnees['description']['titre'] != 'Description collaborative') {
47
					$this->mettreEnCache($bloc.'_bloc_'.$num_nom, $donnees[$bloc]);
83
				$this->mettreEnCache('description_bloc_'.$num_nom, $donnees['description']);
48
				}
84
			}
-
 
85
		}
-
 
86
		
-
 
87
		if($cache['ethnobotanique'] != null) {
-
 
88
			$donnees['ethnobotanique'] = $cache['ethnobotanique'];
-
 
89
		} else {
-
 
90
			$ethnobotanique = new Ethnobotanique($this->conteneur);
-
 
91
			$donnees['ethnobotanique'] = $ethnobotanique->getBloc();
-
 
92
			$this->mettreEnCache('ethnobotanique_bloc_'.$num_nom, $donnees['ethnobotanique']);
-
 
93
		}
-
 
94
		
-
 
95
	
-
 
96
		if($cache['bibliographie'] != null) {
-
 
97
			$donnees['bibliographie'] = $cache['bibliographie'];
-
 
98
		} else {
-
 
99
			$bibliographie = new Bibliographie($this->conteneur);
-
 
100
			$donnees['bibliographie'] = $bibliographie->getBloc();
-
 
101
			$this->mettreEnCache('bibliographie_bloc_'.$num_nom, $donnees['bibliographie']);
-
 
102
		}
-
 
103
		
-
 
104
		if($cache['statut'] != null) {
-
 
105
			$donnees['statut'] = $cache['statut'];
-
 
106
		} else {
-
 
107
			$statut = new Statut($this->conteneur);
-
 
108
		$donnees['statut'] = $statut->getBloc();
-
 
109
			$this->mettreEnCache('statut_bloc_'.$num_nom, $donnees['statut']);
-
 
110
		}
-
 
111
		
-
 
112
		if($cache['ecologie'] != null) {
-
 
113
			$donnees['ecologie'] = $cache['ecologie'];
-
 
114
		} else {
-
 
115
			$ecologie = new Ecologie($this->conteneur);
-
 
116
			$donnees['ecologie'] = $ecologie->getBloc();
-
 
117
			$this->mettreEnCache('ecologie_bloc_'.$num_nom, $donnees['ecologie']);
49
			}
118
		}
50
		}
119
		return $donnees;
-
 
120
	}
51
		return $donnees;
121
 
52
	}
122
}
53
}