Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1026 Rev 1028
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
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Repartition extends aControleur {
15
class Repartition extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $referentiel = 'bdtfx';
19
	private $referentiel = 'bdtfx';
20
	private $donnees = array();
20
	private $donnees = array();
21
	private $tailleBloc = "190x178";
21
	private $tailleBloc = "190x178";
22
	private $serviceChorodep = null;
22
	private $serviceChorodep = null;
23
	private $cartes;
23
	private $cartes;
24
	private $meta;
24
	private $meta;
25
	private $appUrls;
25
	private $appUrls;
26
	
26
	
27
	public function __construct(Conteneur $conteneur) {
27
	public function __construct(Conteneur $conteneur) {
28
		$this->conteneur = $conteneur;
28
		$this->conteneur = $conteneur;
29
		$this->nomCourant = $this->conteneur->getNomCourant();
29
		$this->nomCourant = $this->conteneur->getNomCourant();
30
		$this->referentiel = $this->conteneur->getParametre('referentiel');
30
		$this->referentiel = $this->conteneur->getParametre('referentiel');
31
		$this->cartes = $this->conteneur->getApiCartes();
31
		$this->cartes = $this->conteneur->getApiCartes();
32
		$this->meta = $this->conteneur->getApiMetaDonnees();
32
		$this->meta = $this->conteneur->getApiMetaDonnees();
33
		$this->appUrls = $this->conteneur->getAppUrls();
33
		$this->appUrls = $this->conteneur->getAppUrls();
34
	}
34
	}
35
 
35
 
36
	public function obtenirDonnees() {
36
	public function obtenirDonnees() {
37
		$this->getRepartition();
37
		$this->getRepartition();
38
		$this->getMoissonnage();
38
		$this->getMoissonnage();
39
		$this->donnees['widget']['nt'] = $this->nomCourant->getNt();
39
		$this->donnees['widget']['nt'] = $this->nomCourant->getNt();
40
		$this->donnees['widget']['nn'] = $this->nomCourant->getNnr();
40
		$this->donnees['widget']['nn'] = $this->nomCourant->getNnr();
41
		$this->donnees['widget']['referentiel'] = $this->referentiel;
41
		$this->donnees['widget']['referentiel'] = $this->referentiel;
42
		return $this->donnees;
42
		return $this->donnees;
43
	}
43
	}
44
 
44
 
45
	public function obtenirDonneesExport() {
45
	public function obtenirDonneesExport() {
-
 
46
		$this->getRepartition();
46
		$donnees['chorodep'] = $this->getRepartition();
47
		$donnees['chorodep'] = $this->donnees['repartition'];
-
 
48
		$this->getMoissonnageExport();
-
 
49
		// TODO: renommer l'index "eflore" en moissonnage
-
 
50
		// et renommer dans pdf_export/squelettes/pdf_repartition.tpl.html 
47
		$donnees['eflore'] = $this->getMoissonnageExport();
51
		$donnees['eflore'] = $this->donnees['moissonnage'];
48
		return $donnees;
52
		return $donnees;
49
	}
53
	}
50
	
54
	
51
	private function getRepartition() {
55
	private function getRepartition() {
52
		$projetRepartition = Config::get($this->referentiel.'.baseRepartition');
56
		$projetRepartition = Config::get($this->referentiel.'.baseRepartition');
-
 
57
		// eg: eflore ou chorodep
-
 
58
		// cf: bdtfx.ini, bdtxa.ini
53
		if ($projetRepartition != "") {
59
		if ($projetRepartition != "") {
54
			$this->cartes->setProjet($projetRepartition);
60
			$this->cartes->setProjet($projetRepartition);
55
			$this->cartes->setLargeur('630');
61
			$this->cartes->setLargeur('630');
56
			
62
			
57
			//TODO: démochir ce code
63
			//TODO: démochir ce code
58
			// Chargement des nn des synonymes pour obtenir une carte plus complète
64
			// Chargement des nn des synonymes pour obtenir une carte plus complète
59
			$noms = $this->conteneur->getApiNoms();
65
			$noms = $this->conteneur->getApiNoms();
60
			$syns = $noms->getSynonymes($this->nomCourant->getNnr());
66
			$syns = $noms->getSynonymes($this->nomCourant->getNnr());
61
			$nns_syns = array_keys($syns['resultat']);
67
			$nns_syns = array_keys($syns['resultat']);
62
			$nns_syns[] = $this->nomCourant->getNnr();
68
			$nns_syns[] = $this->nomCourant->getNnr();
63
			$id = 'nn:'.implode(',', $nns_syns);
69
			$id = 'nn:'.implode(',', $nns_syns);
64
			
70
			
65
			$this->cartes->setId($id);
71
			$this->cartes->setId($id);
66
			$repartition['svgUrl'] = $this->cartes->getUrlDataSvg();
72
			$repartition['svgUrl'] = $this->cartes->getUrlDataSvg();
67
			$repartition['pngUrl'] = $this->cartes->getUrlPng();
73
			$repartition['pngUrl'] = $this->cartes->getUrlPng();
68
			$repartition['legende'] = $this->cartes->getLegendeId();
74
			$repartition['legende'] = $this->cartes->getLegendeId();
69
			$this->meta->setProjet($projetRepartition);
75
			$this->meta->setProjet($projetRepartition);
70
			$meta = $this->meta->getMetaDonnees();
76
			$meta = $this->meta->getMetaDonnees();
71
			$citation = $meta[0]['citation'];
77
			$citation = $meta[0]['citation'];
72
			$repartition['meta']['citation'] = $citation;
78
			$repartition['meta']['citation'] = $citation;
73
			$repartition['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetRepartition);
79
			$repartition['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetRepartition);
74
			$this->donnees['repartition'] = $repartition;
80
			$this->donnees['repartition'] = $repartition;
75
		}
81
		}
76
	}
82
	}
77
	
83
	
78
	private function getMoissonnage() {
84
	private function getMoissonnage() {
79
		$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
85
		$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
80
		if ($projetMoissonnage != "") {
86
		if (! $projetMoissonnage) return;
81
			$this->cartes->setProjet('moissonnage');
87
		$this->cartes->setProjet('moissonnage');
82
			$this->cartes->setLargeur('600');
88
		$this->cartes->setLargeur('600');
83
			$this->cartes->setInfoNom($this->nomCourant->getNt());
89
		$this->cartes->setInfoNom($this->nomCourant->getNt());
84
			$this->cartes->setInfoReferentiel($this->referentiel);
90
		$this->cartes->setInfoReferentiel($this->referentiel);
85
			$eflore['mapUrl'] = $this->cartes->getUrlMapSvg();
91
		$eflore['mapUrl'] = $this->cartes->getUrlMapSvg();
86
			$eflore['legende'] = $this->cartes->getLegende();
92
		$eflore['legende'] = $this->cartes->getLegende();
87
			$this->donnees['moissonnage'] = $eflore;
93
		$this->donnees['moissonnage'] = $eflore;
88
		}
-
 
89
	}
94
	}
90
	
95
	
91
	private function getMoissonnageExport() {
96
	private function getMoissonnageExport() {
-
 
97
		$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
-
 
98
		if (! $projetMoissonnage) return;
92
		$this->cartes->setProjet('eflore');
99
		$this->cartes->setProjet($projetMoissonnage);
93
		$this->cartes->setLargeur('min');
100
		$this->cartes->setLargeur('min');
94
		$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
101
		$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
95
		$eflore['min'] = $this->cartes->getUrlEflorePng();
102
		$eflore['min'] = $this->cartes->getUrlEflorePng();
96
		$eflore['legende'] = $this->cartes->getLegende();
103
		$eflore['legende'] = $this->cartes->getLegende();
97
		return $eflore;
104
		$this->donnees['moissonnage'] = $eflore;
98
	}
105
	}
99
 
106
 
100
	public function getBloc() {
107
	public function getBloc() {
101
		$donnees['chorodep'] = $this->getChorodepMiniature();
108
		$donnees['chorodep'] = $this->getChorodepMiniature();
102
		$donnees['eflore'] = $this->getMoissonnageMiniature();
109
		$donnees['eflore'] = $this->getMoissonnageMiniature();
103
		return $donnees;
110
		return $donnees;
104
	}
111
	}
105
	
112
	
106
	private function getChorodepMiniature() {
113
	private function getChorodepMiniature() {
107
		$this->cartes->setProjet('chorodep');
114
		$this->cartes->setProjet('chorodep');
108
		$this->cartes->setLargeur('190x178');
115
		$this->cartes->setLargeur('190x178');
109
		//TODO: démochir ce code
116
		//TODO: démochir ce code
110
		// Chargement des nn des synonymes pour obtenir une carte plus complète
117
		// Chargement des nn des synonymes pour obtenir une carte plus complète
111
		$noms = $this->conteneur->getApiNoms();
118
		$noms = $this->conteneur->getApiNoms();
112
		$syns = $noms->getSynonymes($this->nomCourant->getNnr());
119
		$syns = $noms->getSynonymes($this->nomCourant->getNnr());
113
		$nns_syns = array_keys($syns['resultat']);
120
		$nns_syns = array_keys($syns['resultat']);
114
		$nns_syns[] = $this->nomCourant->getNnr();
121
		$nns_syns[] = $this->nomCourant->getNnr();
115
		$id = 'nn:'.implode(',', $nns_syns);
122
		$id = 'nn:'.implode(',', $nns_syns);
116
		$this->cartes->setId($id);
123
		$this->cartes->setId($id);
117
		return $this->cartes->getUrlPng();
124
		return $this->cartes->getUrlPng();
118
	}
125
	}
119
	
126
	
120
	private function getMoissonnageMiniature() {
127
	private function getMoissonnageMiniature() {
121
		$this->cartes->setProjet('moissonnage');
128
		$this->cartes->setProjet('moissonnage');
122
		$this->cartes->setLargeur('190');
129
		$this->cartes->setLargeur('190');
123
		$this->cartes->setInfoReferentiel($this->referentiel);
130
		$this->cartes->setInfoReferentiel($this->referentiel);
124
		$this->cartes->setInfoNom($this->nomCourant->getNt());
131
		$this->cartes->setInfoNom($this->nomCourant->getNt());
125
		return $this->cartes->getUrlMapPng();
132
		return $this->cartes->getUrlMapPng();
126
	}
133
	}
127
}
134
}
128
?>
135
?>