Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 763 | Rev 797 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
272 delphine 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe mère du module Liste.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
558 mathilde 10
 * @author		Mathilde Salthun-lassalle <mathilde@tela-botanica.org>
272 delphine 11
 * @copyright	2011 Tela-Botanica
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
14
 * @version		$Id$
15
 */
422 delphine 16
class Ecologie extends aControleur {
568 mathilde 17
 
422 delphine 18
	public function __construct(Conteneur $conteneur) {
19
		$this->conteneur = $conteneur;
20
		$this->nomCourant = $this->conteneur->getNomCourant();
540 mathilde 21
		$this->informations = $this->conteneur->getApiInformations();
22
		$this->meta = $this->conteneur->getApiMetaDonnees();
422 delphine 23
		$this->wikini = $this->conteneur->getApiWikini();
540 mathilde 24
		$this->appUrls = $this->conteneur->getAppUrls();
568 mathilde 25
		$this->graphique = $this->conteneur->getApiGraphiques();
770 mathilde 26
		$this->syntaxons = $this->conteneur->getApiSyntaxons();
568 mathilde 27
 
763 aurelien 28
		parent::__construct();
422 delphine 29
	}
30
 
31
	public function obtenirDonnees() {
417 aurelien 32
		$donnees = array();
33
		$donnees['wikini'] = $this->getWikini();
540 mathilde 34
		$donnees['baseflor'] = $this->getBaseflor();
770 mathilde 35
		$donnees['baseveg'] = $this->getBaseveg();
36
		$donnees['urls'] = $this->appUrls;
272 delphine 37
		return $donnees;
38
	}
417 aurelien 39
 
770 mathilde 40
	//TO DO : rajouter baseveg  ici et dans le squelette pdf
41
	public function obtenirDonneesExport() {
697 mathilde 42
		$donnees = array();
43
		$donnees['wikini'] = $this->getWikini();
44
		$donnees['baseflor'] = $this->getBaseflorExport();
45
		return $donnees;
46
	}
47
 
770 mathilde 48
	public function getBaseflorCatminat($depart, $limite) {
49
		$baseflorCatminat = array();
50
		$this->informations ->setProjet('baseflor');
51
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
52
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
53
		$this->informations ->setDepart($depart);
54
		$this->informations ->setLimite($limite);
55
		$informations = $this->informations->getInformationsRelationCatminat();
56
		if($informations != ""){
57
			$baseflorCatminat['liste'] = $informations['resultat'];
58
			$baseflorCatminat['catminat'] = $informations['resultat'][0]['catminat_code'];
59
			$baseflorCatminat['lien_liste_fancy'] = $this->appUrls->obtenirUrlListeFancyBox('catminat',$this->conteneur->getParametre('referentiel'),$this->conteneur->getParametre('num_nom'));
60
		}else {
61
			$baseflorCatminat['aucune'] = 'Aucunes données';
62
		}
63
		return $baseflorCatminat;
64
	}
65
 
66
	private function getBaseveg() {
67
		$baseveg = array();
68
		$baseflor = $this->getBaseflorCatminat(0,5);
69
		$baseveg['baseflor'] = $baseflor;
70
		if (isset($baseflor['catminat'])) {
71
			$this->syntaxons->setProjet('baseveg');
72
			$catminat = str_replace('/','-',$baseflor['catminat']);
73
			$this->syntaxons->setCatminat($catminat);
74
			$syntaxonsSup = $this->syntaxons->getSyntaxonsSuperieurs();
75
			$baseveg['syntaxons-sup'] = $syntaxonsSup['resultat'];
76
			$syntaxonsCourant = $this->syntaxons->getSyntaxonsCatminat();
77
			$baseveg['syntaxon-courant'] = $syntaxonsCourant['resultat'];
78
			$this->meta->setProjet('baseveg');
79
			$meta = $this->meta->getMetaDonnees();
80
			$citation = $meta[0]['citation'];
81
			$baseveg['meta']['citation'] = $citation;
82
			$baseveg['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseveg');
83
		}else {
84
			$baseveg['aucune'] = 'Aucunes données';
85
		}
86
		return $baseveg;
87
	}
88
 
89
 
90
 
417 aurelien 91
	private function getWikini() {
92
		$wikini = array();
93
		$wikini['titre'] = 'Wikini';
94
		$referentiel = $this->conteneur->getParametre('referentiel');
95
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
96
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
418 aurelien 97
		$wikini['ecologie'] = $this->wikini->getTexteFormate($page_wiki, 'ecologie');
417 aurelien 98
		return $wikini;
99
	}
540 mathilde 100
 
558 mathilde 101
	public function getBloc() {
606 mathilde 102
		$donnees = array();
752 aurelien 103
		$donnees = $this->getBaseflor(false);
606 mathilde 104
		$donnees['titre'] = 'Optimum écologique';
558 mathilde 105
		return $donnees;
106
	}
107
 
697 mathilde 108
	private function getBaseflorExport() {
109
		$baseflor = array();
110
		$this->informations ->setProjet('baseflor');
111
		$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
112
		$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
113
		$informations = $this->informations->getInformationsEcologie();
114
		if($informations != ""){
115
			$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
116
			$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
117
			$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
118
			$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
119
			$this->graphique -> setProjet('baseflor');
120
			$baseflor['legende_eco'] = Config::get('chemin_images').'legende_formes.png';
121
			$this->meta->setProjet('baseflor');
122
			$meta = $this->meta->getMetaDonnees();
123
			$citation = $meta[0]['citation'];
124
			$baseflor['meta']['citation'] = $citation;
125
		}else {
126
			$baseflor['aucune'] = 'Aucunes données';
127
		}
128
		return $baseflor;
129
	}
130
 
752 aurelien 131
	private function getBaseflor($inclure_legende = true) {
763 aurelien 132
		$num_nom = $this->nomCourant->getNns();
133
		$cache = $this->obtenirCache('baseflor_graphique_'.$num_nom);
134
		if($cache != null) {
135
			$baseflor = $cache;
136
		} else {
137
			$baseflor = array();
138
			$this->informations ->setProjet('baseflor');
139
			$this->informations ->setBdnt($this->conteneur->getParametre('referentiel'));
140
			$this->informations ->setNum_nom($this->conteneur->getParametre('num_nom'));
141
			$informations = $this->informations->getInformationsEcologie();
142
			if($informations != ""){
143
				$baseflor['climat_url'] = $informations['graphique_climat']['href']."?retour.format=500";
144
				$baseflor['sol_url'] = $informations['graphique_sol']['href']."?retour.format=500";
145
				$baseflor['climat_url_png'] = $informations['graphique_climat']['href']."?retour=image/png";
146
				$baseflor['sol_url_png'] = $informations['graphique_sol']['href']."?retour=image/png";
147
				$this->graphique -> setProjet('baseflor');
148
				if($inclure_legende) {
149
					$graphique = $this->graphique->getLegendeGraphique();
150
					$baseflor['legende'] =  $graphique ;
151
				}
152
				$this->meta->setProjet('baseflor');
153
				$meta = $this->meta->getMetaDonnees();
154
				$citation = $meta[0]['citation'];
155
				$baseflor['meta']['citation'] = $citation;
156
				$baseflor['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('baseflor');
157
				$baseflor['description']['climat_url'] = $informations['graphique_climat']['href']."?retour.format=420";
158
				$baseflor['description']['sol_url'] = $informations['graphique_sol']['href']."?retour.format=420";
159
				$baseflor['description']['climat_url_png'] = $informations['graphique_climat']['href']."?retour.format=420&retour=image/png";
160
				$baseflor['description']['sol_url_png'] = $informations['graphique_sol']['href']."?retour.format=420&retour=image/png";
161
				$this->mettreEnCache('baseflor_graphique_'.$num_nom, $baseflor);
162
			}else {
163
				$baseflor['aucune'] = 'Aucunes données';
752 aurelien 164
			}
540 mathilde 165
		}
166
		return $baseflor;
167
	}
272 delphine 168
}
169
?>