253 |
gduche |
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>
|
|
|
10 |
* @copyright 2011 Tela-Botanica
|
|
|
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
|
|
|
13 |
* @version $Id$
|
|
|
14 |
*/
|
|
|
15 |
class Repartition extends aControleur {
|
291 |
jpm |
16 |
|
|
|
17 |
private $conteneur = null;
|
294 |
delphine |
18 |
private $nomCourant = null;
|
952 |
delphine |
19 |
private $referentiel = 'bdtfx';
|
|
|
20 |
private $donnees = array();
|
291 |
jpm |
21 |
private $tailleBloc = "190x178";
|
257 |
delphine |
22 |
private $serviceChorodep = null;
|
346 |
gduche |
23 |
private $cartes;
|
|
|
24 |
private $meta;
|
|
|
25 |
private $appUrls;
|
|
|
26 |
|
291 |
jpm |
27 |
public function __construct(Conteneur $conteneur) {
|
|
|
28 |
$this->conteneur = $conteneur;
|
294 |
delphine |
29 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
952 |
delphine |
30 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
291 |
jpm |
31 |
$this->cartes = $this->conteneur->getApiCartes();
|
|
|
32 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
|
|
33 |
$this->appUrls = $this->conteneur->getAppUrls();
|
276 |
gduche |
34 |
}
|
291 |
jpm |
35 |
|
|
|
36 |
public function obtenirDonnees() {
|
952 |
delphine |
37 |
$this->getRepartition();
|
|
|
38 |
$this->getMoissonnage();
|
|
|
39 |
$this->donnees['widget']['nt'] = $this->nomCourant->getNt();
|
|
|
40 |
$this->donnees['widget']['nn'] = $this->nomCourant->getNnr();
|
|
|
41 |
return $this->donnees;
|
269 |
delphine |
42 |
}
|
291 |
jpm |
43 |
|
697 |
mathilde |
44 |
public function obtenirDonneesExport() {
|
952 |
delphine |
45 |
$donnees['chorodep'] = $this->getRepartition();
|
|
|
46 |
$donnees['eflore'] = $this->getMoissonnageExport();
|
697 |
mathilde |
47 |
return $donnees;
|
|
|
48 |
}
|
|
|
49 |
|
952 |
delphine |
50 |
private function getRepartition() {
|
|
|
51 |
$projetRepartition = Config::get($this->referentiel.'.baseRepartition');
|
|
|
52 |
if ($projetRepartition != "") {
|
|
|
53 |
$this->cartes->setProjet($projetRepartition);
|
|
|
54 |
$this->cartes->setLargeur('630');
|
|
|
55 |
$id = 'nn:'.$this->nomCourant->getNnr();
|
|
|
56 |
$this->cartes->setId($id);
|
|
|
57 |
$repartition['svgUrl'] = $this->cartes->getUrlDataSvg();
|
|
|
58 |
$repartition['pngUrl'] = $this->cartes->getUrlPng();
|
|
|
59 |
$repartition['legende'] = $this->cartes->getLegendeId();
|
|
|
60 |
$this->meta->setProjet($projetRepartition);
|
|
|
61 |
$meta = $this->meta->getMetaDonnees();
|
|
|
62 |
$citation = $meta[0]['citation'];
|
|
|
63 |
$repartition['meta']['citation'] = $citation;
|
|
|
64 |
$repartition['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($projetRepartition);
|
|
|
65 |
$this->donnees['repartition'] = $repartition;
|
|
|
66 |
}
|
253 |
gduche |
67 |
}
|
361 |
delphine |
68 |
|
952 |
delphine |
69 |
private function getMoissonnage() {
|
|
|
70 |
$projetMoissonnage = Config::get($this->referentiel.'.baseMoissonnage');
|
|
|
71 |
if ($projetMoissonnage != "") {
|
|
|
72 |
$this->cartes->setProjet('eflore');
|
|
|
73 |
$this->cartes->setLargeur('max');
|
|
|
74 |
$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
|
|
|
75 |
$eflore['mapUrl'] = $this->cartes->getUrlMap();
|
|
|
76 |
$eflore['legende'] = $this->cartes->getLegende();
|
|
|
77 |
$this->donnees['moissonnage'] = $eflore;
|
|
|
78 |
}
|
361 |
delphine |
79 |
}
|
697 |
mathilde |
80 |
|
952 |
delphine |
81 |
private function getMoissonnageExport() {
|
697 |
mathilde |
82 |
$this->cartes->setProjet('eflore');
|
|
|
83 |
$this->cartes->setLargeur('min');
|
|
|
84 |
$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
|
|
|
85 |
$eflore['min'] = $this->cartes->getUrlEflorePng();
|
|
|
86 |
$eflore['legende'] = $this->cartes->getLegende();
|
|
|
87 |
return $eflore;
|
|
|
88 |
}
|
291 |
jpm |
89 |
|
|
|
90 |
public function getBloc() {
|
422 |
delphine |
91 |
$donnees['chorodep'] = $this->getChorodepMiniature();
|
441 |
delphine |
92 |
$donnees['eflore'] = $this->getEfloreMiniature();
|
422 |
delphine |
93 |
return $donnees;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
private function getChorodepMiniature() {
|
291 |
jpm |
97 |
$this->cartes->setProjet('chorodep');
|
|
|
98 |
$this->cartes->setLargeur('190x178');
|
455 |
delphine |
99 |
$id = 'nn:'.$this->nomCourant->getNnr();
|
291 |
jpm |
100 |
$this->cartes->setId($id);
|
422 |
delphine |
101 |
return $this->cartes->getUrlPng();
|
263 |
gduche |
102 |
}
|
422 |
delphine |
103 |
|
|
|
104 |
private function getEfloreMiniature() {
|
|
|
105 |
$this->cartes->setProjet('eflore');
|
|
|
106 |
$this->cartes->setLargeur('min');
|
|
|
107 |
$this->cartes->setInfoNom($this->nomCourant->getNomRetenu());
|
441 |
delphine |
108 |
return $this->cartes->getUrlEflorePng();
|
422 |
delphine |
109 |
}
|
253 |
gduche |
110 |
}
|
|
|
111 |
?>
|