Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 844 Rev 957
Line 13... Line 13...
13
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
14
 * @version		$Id$
14
 * @version		$Id$
15
 */
15
 */
16
class Ecologie extends aControleur {
16
class Ecologie extends aControleur {
Line -... Line 17...
-
 
17
	
-
 
18
	private $referentiel = 'bdtfx';
-
 
19
	private $donnees = array();
17
	
20
	
18
	public function __construct(Conteneur $conteneur) {
21
	public function __construct(Conteneur $conteneur) {
19
		$this->conteneur = $conteneur;
22
		$this->conteneur = $conteneur;
-
 
23
		$this->nomCourant = $this->conteneur->getNomCourant();
20
		$this->nomCourant = $this->conteneur->getNomCourant();
24
		$this->referentiel = $this->conteneur->getParametre('referentiel');
21
		$this->informations = $this->conteneur->getApiInformations();
25
		$this->informations = $this->conteneur->getApiInformations();
22
		$this->meta = $this->conteneur->getApiMetaDonnees();
26
		$this->meta = $this->conteneur->getApiMetaDonnees();
23
		$this->wikini = $this->conteneur->getApiWikini();
27
		$this->wikini = $this->conteneur->getApiWikini();
24
		$this->appUrls = $this->conteneur->getAppUrls();
28
		$this->appUrls = $this->conteneur->getAppUrls();
Line 28... Line 32...
28
		parent::__construct();
32
		parent::__construct();
29
	}
33
	}
Line 30... Line 34...
30
	
34
	
31
	public function obtenirDonnees() {
35
	public function obtenirDonnees() {
32
		$donnees = array();
36
		$donnees = array();
33
		$donnees['wikini'] = $this->getWikini();
37
		$this->getWikini();
34
		$donnees['baseflor'] = $this->getBaseflor();
38
		$this->getBaseflor();
35
		$donnees['baseveg'] = $this->getBaseveg();
39
		$this->getBaseveg();
36
		$donnees['urls'] = $this->appUrls;
40
		$this->donnees['urls'] = $this->appUrls;
37
		return $donnees;
41
		return $this->donnees;
Line 38... Line 42...
38
	}
42
	}
39
	
43
	
40
	public function obtenirDonneesExport() {
44
	public function obtenirDonneesExport() {
41
		$donnees = array();
45
		$donnees = array();
42
		$donnees['wikini'] = $this->getWikini();
46
		$this->getWikini();
43
		$donnees['baseflor'] = $this->getBaseflorExport();
47
		$this->getBaseflorExport();
44
		$donnees['baseveg'] = $this->getBaseveg();
48
		$this->getBaseveg();
Line 45... Line 49...
45
		return $donnees;
49
		return $this->donnees;
46
	}
50
	}
47
	
51
	
48
	public function getBaseflorCatminat($depart, $limite) {
52
	public function getBaseflorCatminat($depart, $limite) {
49
		$baseflorCatminat = array();
53
		$baseflorCatminat = array();
50
		$this->informations ->setProjet('baseflor');
54
		$this->informations->setProjet('baseflor');
51
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
55
		$this->informations->setBdnt($this->conteneur->getParametre('referentiel'));
52
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
56
		$this->informations->setNum_nom($this->conteneur->getParametre('num_nom'));
53
		$this->informations ->setDepart($depart);
57
		$this->informations->setDepart($depart);
54
		$this->informations ->setLimite($limite);
58
		$this->informations->setLimite($limite);
55
		$informations = $this->informations->getInformationsRelationCatminat();
59
		$informations = $this->informations->getInformationsRelationCatminat();
56
		if($informations != ""){
60
		if($informations != ""){
Line 61... Line 65...
61
		}
65
		}
62
		return $baseflorCatminat;
66
		return $baseflorCatminat;
63
	}
67
	}
Line 64... Line 68...
64
	
68
	
-
 
69
	private function getBaseveg() {
65
	private function getBaseveg() {
70
		if (Config::get($this->referentiel.'.basePhytosocio') != "") {
66
		$baseveg = array();
71
			$baseveg = array();
67
		$baseflor = $this->getBaseflorCatminat(0,500);
72
			$baseflor = $this->getBaseflorCatminat(0,500);
68
		$baseveg['baseflor'] = $baseflor;
73
			$baseveg['baseflor'] = $baseflor;
69
		if (isset($baseflor['catminat'])) {
74
			if (isset($baseflor['catminat'])) {
70
			$this->syntaxons->setProjet('baseveg');
75
				$this->syntaxons->setProjet('baseveg');
71
			$catminat = str_replace('/','-',$baseflor['catminat']);
76
				$catminat = str_replace('/','-',$baseflor['catminat']);
72
			$this->syntaxons->setCatminat($catminat);
77
				$this->syntaxons->setCatminat($catminat);
73
			$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
78
				$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
74
			$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
79
				$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
75
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
80
				$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
76
			$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
81
				$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
77
			foreach ($baseveg['syntaxons-sup'] as $cle => $valeurs) {
82
				foreach ($baseveg['syntaxons-sup'] as $cle => $valeurs) {
78
				$catminat_sup = str_replace('/','-',$valeurs['code_catminat']);
83
					$catminat_sup = str_replace('/','-',$valeurs['code_catminat']);
79
				$baseveg['synonymes']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
84
					$baseveg['synonymes']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
80
				$baseveg['ref']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
85
					$baseveg['ref']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
-
 
86
					$baseveg['taxons']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons_sup',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
-
 
87
				}
-
 
88
				$baseveg['synonymes']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
-
 
89
				$baseveg['ref']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
-
 
90
				$this->meta->setProjet('baseveg');
-
 
91
				$meta = $this->meta->getMetaDonnees();
-
 
92
				$citation = $meta[0]['citation'];
-
 
93
				$baseveg['meta']['citation'] = $citation;
-
 
94
				$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
-
 
95
			}else {
81
				$baseveg['taxons']['lien-liste-fancy'][$valeurs['code_catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons_sup',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat_sup);
96
				$baseveg['aucune'] = 'Aucunes données';
82
			}
-
 
83
			$baseveg['synonymes']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
-
 
84
			$baseveg['ref']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
97
			}
85
			$this->meta->setProjet('baseveg');
-
 
86
			$meta = $this->meta->getMetaDonnees();
-
 
87
			$citation = $meta[0]['citation'];
-
 
88
			$baseveg['meta']['citation'] = $citation;
-
 
89
			$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
-
 
90
		}else {
-
 
91
			$baseveg['aucune'] = 'Aucunes données';
98
			$this->donnees['baseveg'] = $baseveg;
92
		}
-
 
93
		return $baseveg;
99
		}
Line 94... Line 100...
94
	}
100
	}
95
	
101
	
96
	private function getBasevegSyntaxonCourant() {
102
	private function getBasevegSyntaxonCourant() {
Line 103... Line 109...
103
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
109
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
104
			$baseveg['description'] = $syntaxonsCourant['resultat'];
110
			$baseveg['description'] = $syntaxonsCourant['resultat'];
105
			}
111
			}
106
		return $baseveg;
112
		return $baseveg;
107
	}
113
	}
108
	
-
 
109
	
114
		
110
	
-
 
111
	private function getWikini() {
115
	private function getWikini() {
112
		$wikini = array();
116
		$wikini = array();
113
		$wikini['titre'] = 'Wikini';
117
		$wikini['titre'] = 'Wikini';
114
		$referentiel = $this->conteneur->getParametre('referentiel');
118
		$referentiel = $this->conteneur->getParametre('referentiel');
115
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
119
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
116
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
120
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
117
		$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
121
		$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
118
		return $wikini;
122
		$this->donnees['wikini'] = $wikini;
119
	}
123
	}
Line 120... Line 124...
120
	
124
	
121
	public function getBloc() {
125
	public function getBloc() {
-
 
126
		$donnees = array();
122
		$donnees = array();
127
		$this->getBaseflor(false);
123
		$donnees['graph'] = $this->getBaseflor(false);
128
		$this->donnees['graph'] = $this->donnees['baseflor']; 
124
		$donnees['graph']['titre'] = 'Optimum écologique';
129
		$this->donnees['graph']['titre'] = 'Optimum écologique';
-
 
130
		$this->donnees['phytosocio'] = $this->getBasevegSyntaxonCourant();
125
		$donnees['phytosocio'] = $this->getBasevegSyntaxonCourant();
131
		
126
		return $donnees;
132
		return $this->donnees;
Line 127... Line 133...
127
	}
133
	}
128
	
134
	
129
	private function getBaseflorExport() {
135
	private function getBaseflorExport() {
Line 148... Line 154...
148
		}
154
		}
149
		return $baseflor;
155
		return $baseflor;
150
	}
156
	}
Line 151... Line 157...
151
	
157
	
-
 
158
	private function getBaseflor($inclure_legende = true) {
152
	private function getBaseflor($inclure_legende = true) {
159
		if (Config::get($this->referentiel.'.baseEcologie') != "") {
153
		$num_nom = $this->nomCourant->getNns();
160
			$num_nom = $this->nomCourant->getNns();
154
		$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
161
			$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
155
		if($cache != null) {
162
			if($cache != null) {
156
			$baseflor = $cache;
163
				$baseflor = $cache;
157
			$this->graphique ->setProjet('baseflor');
164
				$this->graphique ->setProjet('baseflor');
158
			$graphique = $this->graphique->getLegendeGraphique();
165
				$graphique = $this->graphique->getLegendeGraphique();
159
			$baseflor['legende'] =  $graphique ;
166
				$baseflor['legende'] =  $graphique ;
160
		} else {
167
			} else {
161
			$baseflor = array();
168
				$baseflor = array();
162
			$this->informations ->setProjet('baseflor');
169
				$this->informations ->setProjet('baseflor');
163
			$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
170
				$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
164
			$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
171
				$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
165
			$informations = $this->informations->getInformationsEcologie();
172
				$informations = $this->informations->getInformationsEcologie();
166
			if(is_array($informations)){
173
				if(is_array($informations)){
167
				if (isset($informations['graphique_climat'])) {
174
					if (isset($informations['graphique_climat'])) {
168
					$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
175
						$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
169
					$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
176
						$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
170
					$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
177
						$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
171
					$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
178
						$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
172
					
179
						
173
				}
180
					}
174
				if (isset($informations['graphique_sol'])) {
181
					if (isset($informations['graphique_sol'])) {
175
					$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
182
						$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
176
					$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
183
						$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
177
					$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
184
						$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
-
 
185
						$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
-
 
186
						
-
 
187
					}
-
 
188
					if($inclure_legende) {
-
 
189
						$this->graphique ->setProjet('baseflor');
-
 
190
						$graphique = $this->graphique->getLegendeGraphique();
-
 
191
						$baseflor['legende'] =  $graphique ;
-
 
192
					}
-
 
193
					$this->meta->setProjet('baseflor');
-
 
194
					$meta = $this->meta->getMetaDonnees();
-
 
195
					$citation = $meta[0]['citation'];
-
 
196
					$baseflor['meta']['citation'] = $citation;
Line -... Line 197...
-
 
197
					$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
-
 
198
					
-
 
199
					$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
178
					$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
200
				} else {
179
					
-
 
180
				}
-
 
181
				if($inclure_legende) {
-
 
182
					$this->graphique ->setProjet('baseflor');
-
 
183
					$graphique = $this->graphique->getLegendeGraphique();
-
 
184
					$baseflor['legende'] =  $graphique ;
-
 
185
				}
-
 
186
				$this->meta->setProjet('baseflor');
-
 
187
				$meta = $this->meta->getMetaDonnees();
-
 
188
				$citation = $meta[0]['citation'];
-
 
189
				$baseflor['meta']['citation'] = $citation;
-
 
190
				$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
-
 
191
				
-
 
192
				$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
-
 
193
			} else {
201
					$baseflor['aucune'] = 'Aucunes données';
-
 
202
				}
194
				$baseflor['aucune'] = 'Aucunes données';
203
			}
195
			}
-
 
196
		}
204
			$this->donnees['baseflor'] = $baseflor;
197
		return $baseflor;
205
		}
198
	}
206
	}
199
}
207
}