Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 840 Rev 844
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
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		Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
10
 * @author		Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
11
 * @copyright	2011 Tela-Botanica
11
 * @copyright	2011 Tela-Botanica
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
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
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 {
17
	
17
	
18
	public function __construct(Conteneur $conteneur) {
18
	public function __construct(Conteneur $conteneur) {
19
		$this->conteneur = $conteneur;
19
		$this->conteneur = $conteneur;
20
		$this->nomCourant = $this->conteneur->getNomCourant();
20
		$this->nomCourant = $this->conteneur->getNomCourant();
21
		$this->informations = $this->conteneur->getApiInformations();
21
		$this->informations = $this->conteneur->getApiInformations();
22
		$this->meta = $this->conteneur->getApiMetaDonnees();
22
		$this->meta = $this->conteneur->getApiMetaDonnees();
23
		$this->wikini = $this->conteneur->getApiWikini();
23
		$this->wikini = $this->conteneur->getApiWikini();
24
		$this->appUrls = $this->conteneur->getAppUrls();
24
		$this->appUrls = $this->conteneur->getAppUrls();
25
		$this->graphique = $this->conteneur->getApiGraphiques();
25
		$this->graphique = $this->conteneur->getApiGraphiques();
26
		$this->syntaxons = $this->conteneur->getApiSyntaxons();
26
		$this->syntaxons = $this->conteneur->getApiSyntaxons();
27
		
27
		
28
		parent::__construct();
28
		parent::__construct();
29
	}
29
	}
30
	
30
	
31
	public function obtenirDonnees() {
31
	public function obtenirDonnees() {
32
		$donnees = array();
32
		$donnees = array();
33
		$donnees['wikini'] = $this->getWikini();
33
		$donnees['wikini'] = $this->getWikini();
34
		$donnees['baseflor'] = $this->getBaseflor();
34
		$donnees['baseflor'] = $this->getBaseflor();
35
		$donnees['baseveg'] = $this->getBaseveg();
35
		$donnees['baseveg'] = $this->getBaseveg();
36
		$donnees['urls'] = $this->appUrls;
36
		$donnees['urls'] = $this->appUrls;
37
		return $donnees;
37
		return $donnees;
38
	}
38
	}
39
	
39
	
40
	public function obtenirDonneesExport() {
40
	public function obtenirDonneesExport() {
41
		$donnees = array();
41
		$donnees = array();
42
		$donnees['wikini'] = $this->getWikini();
42
		$donnees['wikini'] = $this->getWikini();
43
		$donnees['baseflor'] = $this->getBaseflorExport();
43
		$donnees['baseflor'] = $this->getBaseflorExport();
44
		$donnees['baseveg'] = $this->getBaseveg();
44
		$donnees['baseveg'] = $this->getBaseveg();
45
		return $donnees;
45
		return $donnees;
46
	}
46
	}
47
	
47
	
48
	public function getBaseflorCatminat($depart, $limite) {
48
	public function getBaseflorCatminat($depart, $limite) {
49
		$baseflorCatminat = array();
49
		$baseflorCatminat = array();
50
		$this->informations ->setProjet('baseflor');
50
		$this->informations ->setProjet('baseflor');
51
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
51
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
52
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
52
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
53
		$this->informations ->setDepart($depart);
53
		$this->informations ->setDepart($depart);
54
		$this->informations ->setLimite($limite);
54
		$this->informations ->setLimite($limite);
55
		$informations = $this->informations->getInformationsRelationCatminat();
55
		$informations = $this->informations->getInformationsRelationCatminat();
56
		if($informations != ""){
56
		if($informations != ""){
57
			$baseflorCatminat['catminat'] = $informations['resultat'][0]['catminat_code'];
57
			$baseflorCatminat['catminat'] = $informations['resultat'][0]['catminat_code'];
58
			$baseflorCatminat['lien-liste-fancy'] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$baseflorCatminat['catminat']);
58
			$baseflorCatminat['lien-liste-fancy'] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_taxons',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$baseflorCatminat['catminat']);
59
		}else {
59
		}else {
60
			$baseflorCatminat['aucune'] = 'Aucunes données';
60
			$baseflorCatminat['aucune'] = 'Aucunes données';
61
		}
61
		}
62
		return $baseflorCatminat;
62
		return $baseflorCatminat;
63
	}
63
	}
64
	
64
	
65
	private function getBaseveg() {
65
	private function getBaseveg() {
66
		$baseveg = array();
66
		$baseveg = array();
67
		$baseflor = $this->getBaseflorCatminat(0,500);
67
		$baseflor = $this->getBaseflorCatminat(0,500);
68
		$baseveg['baseflor'] = $baseflor;
68
		$baseveg['baseflor'] = $baseflor;
69
		if (isset($baseflor['catminat'])) {
69
		if (isset($baseflor['catminat'])) {
70
			$this->syntaxons->setProjet('baseveg');
70
			$this->syntaxons->setProjet('baseveg');
71
			$catminat = str_replace('/','-',$baseflor['catminat']);
71
			$catminat = str_replace('/','-',$baseflor['catminat']);
72
			$this->syntaxons->setCatminat($catminat);
72
			$this->syntaxons->setCatminat($catminat);
73
			$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
73
			$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
74
			$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
74
			$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
75
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
75
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
76
			$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
76
			$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
77
			foreach ($baseveg['syntaxons-sup'] as $cle => $valeurs) {
77
			foreach ($baseveg['syntaxons-sup'] as $cle => $valeurs) {
78
				$catminat_sup = str_replace('/','-',$valeurs['code_catminat']);
78
				$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);
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);
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);
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);
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);
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);
82
			}
82
			}
83
			$baseveg['synonymes']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_synonymes',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
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);
84
			$baseveg['ref']['lien-liste-fancy'][$baseflor['catminat']] = $this->appUrls->obtenirUrlListeFancyBoxPhytosocio('catminat_ref',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'),$catminat);
85
			$this->meta->setProjet('baseveg');
85
			$this->meta->setProjet('baseveg');
86
			$meta = $this->meta->getMetaDonnees();
86
			$meta = $this->meta->getMetaDonnees();
87
			$citation = $meta[0]['citation'];
87
			$citation = $meta[0]['citation'];
88
			$baseveg['meta']['citation'] = $citation;
88
			$baseveg['meta']['citation'] = $citation;
89
			$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
89
			$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
90
		}else {
90
		}else {
91
			$baseveg['aucune'] = 'Aucunes données';
91
			$baseveg['aucune'] = 'Aucunes données';
92
		}
92
		}
93
		return $baseveg;
93
		return $baseveg;
94
	}
94
	}
95
	
95
	
96
	private function getBasevegSyntaxonCourant() {
96
	private function getBasevegSyntaxonCourant() {
97
		$baseveg = array();
97
		$baseveg = array();
98
		$baseflor = $this->getBaseflorCatminat(0,500);
98
		$baseflor = $this->getBaseflorCatminat(0,500);
99
		if (isset($baseflor['catminat'])) {
99
		if (isset($baseflor['catminat'])) {
100
			$this->syntaxons->setProjet('baseveg');
100
			$this->syntaxons->setProjet('baseveg');
101
			$catminat = str_replace('/','-',$baseflor['catminat']);
101
			$catminat = str_replace('/','-',$baseflor['catminat']);
102
			$this->syntaxons->setCatminat($catminat);
102
			$this->syntaxons->setCatminat($catminat);
103
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
103
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
104
			$baseveg['description'] = $syntaxonsCourant['resultat'];
104
			$baseveg['description'] = $syntaxonsCourant['resultat'];
105
			}
105
			}
106
		return $baseveg;
106
		return $baseveg;
107
	}
107
	}
108
	
108
	
109
	
109
	
110
	
110
	
111
	private function getWikini() {
111
	private function getWikini() {
112
		$wikini = array();
112
		$wikini = array();
113
		$wikini['titre'] = 'Wikini';
113
		$wikini['titre'] = 'Wikini';
114
		$referentiel = $this->conteneur->getParametre('referentiel');
114
		$referentiel = $this->conteneur->getParametre('referentiel');
115
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
115
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
116
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
116
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
117
		$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
117
		$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
118
		return $wikini;
118
		return $wikini;
119
	}
119
	}
120
	
120
	
121
	public function getBloc() {
121
	public function getBloc() {
122
		$donnees = array();
122
		$donnees = array();
123
		$donnees['graph'] = $this->getBaseflor(false);
123
		$donnees['graph'] = $this->getBaseflor(false);
124
		$donnees['graph']['titre'] = 'Optimum écologique';
124
		$donnees['graph']['titre'] = 'Optimum écologique';
125
		$donnees['phytosocio'] = $this->getBasevegSyntaxonCourant();
125
		$donnees['phytosocio'] = $this->getBasevegSyntaxonCourant();
126
		return $donnees;
126
		return $donnees;
127
	}
127
	}
128
	
128
	
129
	private function getBaseflorExport() {
129
	private function getBaseflorExport() {
130
		$baseflor = array();
130
		$baseflor = array();
131
		$this->informations ->setProjet('baseflor');
131
		$this->informations ->setProjet('baseflor');
132
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
132
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
133
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
133
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
134
		$informations = $this->informations->getInformationsEcologie();
134
		$informations = $this->informations->getInformationsEcologie();
135
		if($informations != ""){
135
		if(is_array($informations)){
136
			$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
136
			$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
137
			$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
137
			$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
138
			$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
138
			$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
139
			$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
139
			$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
140
			$this->graphique -> setProjet('baseflor');
140
			$this->graphique -> setProjet('baseflor');
141
			$baseflor['legende_eco'] = Config::get('chemin_images').'legende_formes.png';
141
			$baseflor['legende_eco'] = Config::get('chemin_images').'legende_formes.png';
142
			$this->meta->setProjet('baseflor');
142
			$this->meta->setProjet('baseflor');
143
			$meta = $this->meta->getMetaDonnees();
143
			$meta = $this->meta->getMetaDonnees();
144
			$citation = $meta[0]['citation'];
144
			$citation = $meta[0]['citation'];
145
			$baseflor['meta']['citation'] = $citation;
145
			$baseflor['meta']['citation'] = $citation;
146
		}else {
146
		}else {
147
			$baseflor['aucune'] = 'Aucunes données';
147
			$baseflor['aucune'] = 'Aucunes données';
148
		}
148
		}
149
		return $baseflor;
149
		return $baseflor;
150
	}
150
	}
151
	
151
	
152
	private function getBaseflor($inclure_legende = true) {
152
	private function getBaseflor($inclure_legende = true) {
153
		$num_nom = $this->nomCourant->getNns();
153
		$num_nom = $this->nomCourant->getNns();
154
		$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
154
		$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
155
		if($cache != null) {
155
		if($cache != null) {
156
			$baseflor = $cache;
156
			$baseflor = $cache;
157
			$this->graphique ->setProjet('baseflor');
157
			$this->graphique ->setProjet('baseflor');
158
			$graphique = $this->graphique->getLegendeGraphique();
158
			$graphique = $this->graphique->getLegendeGraphique();
159
			$baseflor['legende'] =  $graphique ;
159
			$baseflor['legende'] =  $graphique ;
160
		} else {
160
		} else {
161
			$baseflor = array();
161
			$baseflor = array();
162
			$this->informations ->setProjet('baseflor');
162
			$this->informations ->setProjet('baseflor');
163
			$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
163
			$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
164
			$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
164
			$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
165
			$informations = $this->informations->getInformationsEcologie();
165
			$informations = $this->informations->getInformationsEcologie();
166
			if($informations != ""){
166
			if(is_array($informations)){
167
				if ($informations['graphique_climat']) {
167
				if (isset($informations['graphique_climat'])) {
168
					$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
168
					$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
169
					$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
169
					$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
170
					$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
170
					$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";
171
					$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
172
					
172
					
173
				}
173
				}
174
				if ($informations['graphique_sol']) {
174
				if (isset($informations['graphique_sol'])) {
175
					$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
175
					$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
176
					$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
176
					$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
177
					$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
177
					$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
178
					$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
178
					$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
179
					
179
					
180
				}
180
				}
181
				if($inclure_legende) {
181
				if($inclure_legende) {
182
					$this->graphique ->setProjet('baseflor');
182
					$this->graphique ->setProjet('baseflor');
183
					$graphique = $this->graphique->getLegendeGraphique();
183
					$graphique = $this->graphique->getLegendeGraphique();
184
					$baseflor['legende'] =  $graphique ;
184
					$baseflor['legende'] =  $graphique ;
185
				}
185
				}
186
				$this->meta->setProjet('baseflor');
186
				$this->meta->setProjet('baseflor');
187
				$meta = $this->meta->getMetaDonnees();
187
				$meta = $this->meta->getMetaDonnees();
188
				$citation = $meta[0]['citation'];
188
				$citation = $meta[0]['citation'];
189
				$baseflor['meta']['citation'] = $citation;
189
				$baseflor['meta']['citation'] = $citation;
190
				$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
190
				$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
191
				
191
				
192
				$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
192
				$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
193
			} else {
193
			} else {
194
				$baseflor['aucune'] = 'Aucunes données';
194
				$baseflor['aucune'] = 'Aucunes données';
195
			}
195
			}
196
		}
196
		}
197
		return $baseflor;
197
		return $baseflor;
198
	}
198
	}
199
}
199
}
200
?>
200
?>