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 $noms = null;
|
19 |
private $referentiel = 'bdtfx';
|
20 |
private $referentiel = 'bdtfx';
|
20 |
private $donnees = array();
|
21 |
private $donnees = array();
|
21 |
private $cartes;
|
22 |
private $cartes;
|
22 |
private $meta;
|
23 |
private $meta;
|
23 |
private $appUrls;
|
24 |
private $appUrls;
|
24 |
|
25 |
|
25 |
public function __construct(Conteneur $conteneur) {
|
26 |
public function __construct(Conteneur $conteneur) {
|
26 |
$this->conteneur = $conteneur;
|
27 |
$this->conteneur = $conteneur;
|
- |
|
28 |
$this->noms = $this->conteneur->getApiNoms();
|
27 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
29 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
28 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
30 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
29 |
$this->cartes = $this->conteneur->getApiCartes();
|
31 |
$this->cartes = $this->conteneur->getApiCartes();
|
30 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
32 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
31 |
$this->appUrls = $this->conteneur->getAppUrls();
|
33 |
$this->appUrls = $this->conteneur->getAppUrls();
|
32 |
}
|
34 |
}
|
33 |
|
35 |
|
34 |
public function obtenirDonnees() {
|
36 |
public function obtenirDonnees() {
|
35 |
$this->getRepartition();
|
37 |
$this->getRepartition();
|
36 |
$this->getMoissonnage();
|
38 |
$this->getMoissonnage();
|
37 |
$this->getFloreProbable();
|
39 |
$this->getFloreProbable();
|
38 |
$this->donnees['widget']['nt'] = $this->nomCourant->getNt();
|
40 |
$this->donnees['widget']['nt'] = $this->nomCourant->getNt();
|
39 |
$this->donnees['widget']['nn'] = $this->nomCourant->getNnr();
|
41 |
$this->donnees['widget']['nn'] = $this->nomCourant->getNnr();
|
40 |
$this->donnees['widget']['referentiel'] = $this->referentiel;
|
42 |
$this->donnees['widget']['referentiel'] = $this->referentiel;
|
41 |
return $this->donnees;
|
43 |
return $this->donnees;
|
42 |
}
|
44 |
}
|
43 |
|
45 |
|
44 |
public function obtenirDonneesExport() {
|
46 |
public function obtenirDonneesExport() {
|
45 |
$this->getRepartition();
|
47 |
$this->getRepartition();
|
46 |
$donnees['chorodep'] = $this->donnees['repartition'];
|
48 |
$donnees['chorodep'] = $this->donnees['repartition'];
|
47 |
$this->getMoissonnageExport();
|
49 |
$this->getMoissonnageExport();
|
48 |
// TODO: renommer l'index "eflore" en moissonnage
|
50 |
// TODO: renommer l'index "eflore" en moissonnage
|
49 |
// et renommer dans pdf_export/squelettes/pdf_repartition.tpl.html
|
51 |
// et renommer dans pdf_export/squelettes/pdf_repartition.tpl.html
|
50 |
$donnees['eflore'] = $this->donnees['moissonnage'];
|
52 |
$donnees['eflore'] = $this->donnees['moissonnage'];
|
51 |
return $donnees;
|
53 |
return $donnees;
|
52 |
}
|
54 |
}
|
53 |
|
55 |
|
54 |
private function getRepartition() {
|
56 |
private function getRepartition() {
|
55 |
$projetRepartition = Config::get("{$this->referentiel}.baseRepartition");
|
57 |
$projetRepartition = Config::get("{$this->referentiel}.baseRepartition");
|
56 |
// eg: eflore ou chorodep
|
58 |
// eg: eflore ou chorodep
|
57 |
// cf: bdtfx.ini, bdtxa.ini
|
59 |
// cf: bdtfx.ini, bdtxa.ini
|
58 |
if ($projetRepartition != '') {
|
60 |
if ($projetRepartition != '') {
|
59 |
$this->cartes->setProjet($projetRepartition);
|
61 |
$this->cartes->setProjet($projetRepartition);
|
60 |
$this->cartes->setLargeur('630');
|
62 |
$this->cartes->setLargeur('630');
|
- |
|
63 |
$synonymes = $this->noms->getSynonymes($this->nomCourant->getNnr());
|
- |
|
64 |
$synonymesNn = implode(array_keys($synonymes['resultat']), ',');
|
61 |
$nt = $this->nomCourant->getNt();
|
65 |
$nn = $this->nomCourant->getNnr();
|
62 |
$this->cartes->setId("{$this->referentiel}.nt:$nt");
|
66 |
$this->cartes->setId("{$this->referentiel}.nn:$synonymesNn");
|
63 |
$repartition['svgUrl'] = $this->cartes->getUrlDataSvg();
|
67 |
$repartition['svgUrl'] = $this->cartes->getUrlDataSvg();
|
64 |
$repartition['pngUrl'] = $this->cartes->getUrlPng();
|
68 |
$repartition['pngUrl'] = $this->cartes->getUrlPng();
|
65 |
$repartition['legende'] = $this->cartes->getLegendeId();
|
69 |
$repartition['legende'] = $this->cartes->getLegendeId();
|
66 |
$this->meta->setProjet($projetRepartition);
|
70 |
$this->meta->setProjet($projetRepartition);
|
67 |
$meta = $this->meta->getMetaDonnees();
|
71 |
$meta = $this->meta->getMetaDonnees();
|
68 |
$repartition['meta'] = $meta[0];
|
72 |
$repartition['meta'] = $meta[0];
|
69 |
$repartition['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetRepartition);
|
73 |
$repartition['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetRepartition);
|
70 |
$this->donnees['repartition'] = $repartition;
|
74 |
$this->donnees['repartition'] = $repartition;
|
71 |
}
|
75 |
}
|
72 |
}
|
76 |
}
|
73 |
|
77 |
|
74 |
private function getMoissonnage() {
|
78 |
private function getMoissonnage() {
|
75 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
79 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
76 |
if (! $projetMoissonnage) return;
|
80 |
if (! $projetMoissonnage) return;
|
77 |
$this->cartes->setProjet('moissonnage');
|
81 |
$this->cartes->setProjet('moissonnage');
|
78 |
$this->cartes->setLargeur('600');
|
82 |
$this->cartes->setLargeur('600');
|
79 |
$this->cartes->setInfoNom($this->nomCourant->getNt());
|
83 |
$this->cartes->setInfoNom($this->nomCourant->getNt());
|
80 |
$this->cartes->setInfoReferentiel($this->referentiel);
|
84 |
$this->cartes->setInfoReferentiel($this->referentiel);
|
81 |
$eflore['mapUrl'] = $this->cartes->getUrlMapSvg();
|
85 |
$eflore['mapUrl'] = $this->cartes->getUrlMapSvg();
|
82 |
$eflore['mapTelechargementUrls'] = array('png' => $this->cartes->getUrlTelechargementMapPng(),
|
86 |
$eflore['mapTelechargementUrls'] = array('png' => $this->cartes->getUrlTelechargementMapPng(),
|
83 |
'html' => $this->cartes->getUrlTelechargementMapHtml());
|
87 |
'html' => $this->cartes->getUrlTelechargementMapHtml());
|
84 |
$eflore['legende'] = $this->cartes->getLegende();
|
88 |
$eflore['legende'] = $this->cartes->getLegende();
|
85 |
$this->donnees['moissonnage'] = $eflore;
|
89 |
$this->donnees['moissonnage'] = $eflore;
|
86 |
}
|
90 |
}
|
87 |
|
91 |
|
88 |
private function getMoissonnageExport() {
|
92 |
private function getMoissonnageExport() {
|
89 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
93 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
90 |
if (! $projetMoissonnage) return;
|
94 |
if (! $projetMoissonnage) return;
|
91 |
$this->cartes->setProjet($projetMoissonnage);
|
95 |
$this->cartes->setProjet($projetMoissonnage);
|
92 |
$this->cartes->setLargeur('min');
|
96 |
$this->cartes->setLargeur('min');
|
93 |
$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
|
97 |
$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
|
94 |
$eflore['min'] = $this->cartes->getUrlEflorePng();
|
98 |
$eflore['min'] = $this->cartes->getUrlEflorePng();
|
95 |
$eflore['legende'] = $this->cartes->getLegende();
|
99 |
$eflore['legende'] = $this->cartes->getLegende();
|
96 |
$this->donnees['moissonnage'] = $eflore;
|
100 |
$this->donnees['moissonnage'] = $eflore;
|
97 |
}
|
101 |
}
|
98 |
|
102 |
|
99 |
private function getFloreProbable() {
|
103 |
private function getFloreProbable() {
|
100 |
$projetFloreProbable = Config::get($this->referentiel.'.baseFloreProbable');
|
104 |
$projetFloreProbable = Config::get($this->referentiel.'.baseFloreProbable');
|
101 |
if (! $projetFloreProbable) return;
|
105 |
if (! $projetFloreProbable) return;
|
102 |
$this->cartes->setProjet($projetFloreProbable);
|
106 |
$this->cartes->setProjet($projetFloreProbable);
|
103 |
$this->meta->setProjet($projetFloreProbable);
|
107 |
$this->meta->setProjet($projetFloreProbable);
|
104 |
$this->cartes->setId($this->referentiel.'.nt:'.$this->nomCourant->getNt());
|
108 |
$this->cartes->setId($this->referentiel.'.nt:'.$this->nomCourant->getNt());
|
105 |
// TODO: url téléchargement de la carte lorsqu'on sera sur que c'est possible
|
109 |
// TODO: url téléchargement de la carte lorsqu'on sera sur que c'est possible
|
106 |
// dans ['carte']['telechargement'] par exemple
|
110 |
// dans ['carte']['telechargement'] par exemple
|
107 |
$this->donnees['flore_probable'] = array('carte' => array(), 'meta' => array());
|
111 |
$this->donnees['flore_probable'] = array('carte' => array(), 'meta' => array());
|
108 |
$this->meta->setProjet($projetFloreProbable);
|
112 |
$this->meta->setProjet($projetFloreProbable);
|
109 |
$meta = $this->meta->getMetaDonnees();
|
113 |
$meta = $this->meta->getMetaDonnees();
|
110 |
$this->donnees['flore_probable']['meta'] = $meta[0];
|
114 |
$this->donnees['flore_probable']['meta'] = $meta[0];
|
111 |
$this->donnees['flore_probable']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetFloreProbable);
|
115 |
$this->donnees['flore_probable']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetFloreProbable);
|
112 |
$this->donnees['flore_probable']['carte']['url'] = $this->cartes->getUrlFloreProbablePng();
|
116 |
$this->donnees['flore_probable']['carte']['url'] = $this->cartes->getUrlFloreProbablePng();
|
113 |
}
|
117 |
}
|
114 |
|
118 |
|
115 |
public function getBloc() {
|
119 |
public function getBloc() {
|
116 |
$donnees['chorodep'] = $this->getChorodepMiniature();
|
120 |
$donnees['chorodep'] = $this->getChorodepMiniature();
|
117 |
$donnees['eflore'] = $this->getMoissonnageMiniature();
|
121 |
$donnees['eflore'] = $this->getMoissonnageMiniature();
|
118 |
|
122 |
|
119 |
// TODO: moche, comment gérer le fait que l'onglet "synthèse", en "bdtxa", doive
|
123 |
// TODO: moche, comment gérer le fait que l'onglet "synthèse", en "bdtxa", doive
|
120 |
// afficher la carte chorologie, et non la carte chorodep.
|
124 |
// afficher la carte chorologie, et non la carte chorodep.
|
121 |
// workaround: écrasement de l'URL dans ['répartition']['chorodep']:
|
125 |
// workaround: écrasement de l'URL dans ['répartition']['chorodep']:
|
122 |
if ($this->referentiel == 'bdtxa') {
|
126 |
if ($this->referentiel == 'bdtxa') {
|
123 |
$nt = $this->nomCourant->getNt();
|
127 |
$nt = $this->nomCourant->getNt();
|
124 |
$idCarte = "{$this->referentiel}.nt:$nt";
|
128 |
$idCarte = "{$this->referentiel}.nt:$nt";
|
125 |
$urlCarte = Config::get("{$this->referentiel}.baseRepartition");
|
129 |
$urlCarte = Config::get("{$this->referentiel}.baseRepartition");
|
126 |
|
130 |
|
127 |
$donnees['chorodep'] = Cartes::getCarteUrlPng($urlCarte, $idCarte, '190x178');
|
131 |
$donnees['chorodep'] = Cartes::getCarteUrlPng($urlCarte, $idCarte, '190x178');
|
128 |
}
|
132 |
}
|
129 |
|
133 |
|
130 |
return $donnees;
|
134 |
return $donnees;
|
131 |
}
|
135 |
}
|
132 |
|
136 |
|
133 |
private function getChorodepMiniature() {
|
137 |
private function getChorodepMiniature() {
|
134 |
$projetRepartition = Config::get("{$this->referentiel}.baseRepartition");
|
138 |
$projetRepartition = Config::get("{$this->referentiel}.baseRepartition");
|
135 |
$url = null;
|
139 |
$url = null;
|
136 |
if ($projetRepartition != '') {
|
140 |
if ($projetRepartition != '') {
|
137 |
$this->cartes->setProjet($projetRepartition);
|
141 |
$this->cartes->setProjet($projetRepartition);
|
138 |
$this->cartes->setProjet('chorodep');
|
142 |
$this->cartes->setProjet('chorodep');
|
139 |
$this->cartes->setLargeur('190x178');
|
143 |
$this->cartes->setLargeur('190x178');
|
140 |
|
144 |
|
141 |
$nt = $this->nomCourant->getNt();
|
145 |
$nt = $this->nomCourant->getNt();
|
142 |
$this->cartes->setId("{$this->referentiel}.nt:$nt");
|
146 |
$this->cartes->setId("{$this->referentiel}.nt:$nt");
|
143 |
|
147 |
|
144 |
$url = $this->cartes->getUrlPng();
|
148 |
$url = $this->cartes->getUrlPng();
|
145 |
}
|
149 |
}
|
146 |
return $url;
|
150 |
return $url;
|
147 |
}
|
151 |
}
|
148 |
|
152 |
|
149 |
private function getMoissonnageMiniature() {
|
153 |
private function getMoissonnageMiniature() {
|
150 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
154 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
151 |
$url = null;
|
155 |
$url = null;
|
152 |
if ($projetMoissonnage != '') {
|
156 |
if ($projetMoissonnage != '') {
|
153 |
$this->cartes->setProjet('moissonnage');
|
157 |
$this->cartes->setProjet('moissonnage');
|
154 |
$this->cartes->setLargeur('190');
|
158 |
$this->cartes->setLargeur('190');
|
155 |
$this->cartes->setInfoReferentiel($this->referentiel);
|
159 |
$this->cartes->setInfoReferentiel($this->referentiel);
|
156 |
$this->cartes->setInfoNom($this->nomCourant->getNt());
|
160 |
$this->cartes->setInfoNom($this->nomCourant->getNt());
|
157 |
$url = $this->cartes->getUrlMapPng();
|
161 |
$url = $this->cartes->getUrlMapPng();
|
158 |
}
|
162 |
}
|
159 |
return $url;
|
163 |
return $url;
|
160 |
}
|
164 |
}
|
161 |
}
|
165 |
}
|
162 |
?>
|
166 |
?>
|