253 |
gduche |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe gérant les images.
|
|
|
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 Cartes extends Eflore {
|
|
|
16 |
|
291 |
jpm |
17 |
private $id;
|
256 |
gduche |
18 |
private $largeur;
|
291 |
jpm |
19 |
|
|
|
20 |
public function setId($id) {
|
|
|
21 |
$this->id = $id;
|
|
|
22 |
}
|
|
|
23 |
|
|
|
24 |
public function setLargeur($largeur) {
|
256 |
gduche |
25 |
$this->largeur = $largeur;
|
253 |
gduche |
26 |
}
|
361 |
delphine |
27 |
|
|
|
28 |
public function setInfoNom($nom) {
|
|
|
29 |
$this->nom = $nom;
|
1026 |
alex |
30 |
}
|
|
|
31 |
|
|
|
32 |
public function setInfoReferentiel($referentiel) {
|
|
|
33 |
$this->referentiel = $referentiel;
|
|
|
34 |
}
|
291 |
jpm |
35 |
|
263 |
gduche |
36 |
public function getUrlDataSvg() {
|
291 |
jpm |
37 |
$tpl = Config::get('carteTpl');
|
|
|
38 |
$params = array('id' => $this->id, 'largeur' => $this->largeur, 'mime-type' => 'image/svg+xml');
|
253 |
gduche |
39 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
40 |
return $url;
|
|
|
41 |
}
|
291 |
jpm |
42 |
|
263 |
gduche |
43 |
public function getUrlPng() {
|
291 |
jpm |
44 |
$tpl = Config::get('carteTpl');
|
|
|
45 |
$params = array('id' => $this->id, 'largeur' => $this->largeur, 'mime-type' => 'image/png');
|
263 |
gduche |
46 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
47 |
return $url;
|
|
|
48 |
}
|
361 |
delphine |
49 |
|
|
|
50 |
public function getUrlMap() {
|
|
|
51 |
$tpl = Config::get('efloreCarteTpl');
|
|
|
52 |
$params = array('num_nom' => $this->nom->get('id'), 'num_tax' => $this->nom->get('num_taxonomique') ,
|
|
|
53 |
'nom_sci' => $this->nom->get('nom_sci'), 'auteur' => $this->nom->get('auteur') ,
|
366 |
aurelien |
54 |
'largeur' => $this->largeur, 'mime_type' => 'text/html');
|
361 |
delphine |
55 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
56 |
return $url;
|
|
|
57 |
}
|
441 |
delphine |
58 |
|
1026 |
alex |
59 |
public function getUrlMapSvg() {
|
|
|
60 |
$tpl = Config::get('carteMoissonnageTpl');
|
|
|
61 |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel,
|
1112 |
aurelien |
62 |
'largeur' => $this->largeur, 'mime_type' => 'text/html', 'methode' => 'afficher');
|
1026 |
alex |
63 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
64 |
return $url;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
public function getUrlMapPng() {
|
|
|
68 |
$tpl = Config::get('carteMoissonnageTpl');
|
|
|
69 |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel,
|
1112 |
aurelien |
70 |
'largeur' => $this->largeur, 'mime_type' => 'image/png', 'methode' => 'afficher');
|
1026 |
alex |
71 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
72 |
return $url;
|
|
|
73 |
}
|
|
|
74 |
|
1112 |
aurelien |
75 |
public function getUrlTelechargementMapPng() {
|
|
|
76 |
$tpl = Config::get('carteMoissonnageTpl');
|
|
|
77 |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel,
|
|
|
78 |
'largeur' => $this->largeur, 'mime_type' => 'image/png', 'methode' => 'telecharger');
|
|
|
79 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
80 |
return $url;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public function getUrlTelechargementMapHtml() {
|
|
|
84 |
$tpl = Config::get('carteMoissonnageTpl');
|
|
|
85 |
$params = array('num_taxon' => $this->nom, 'referentiel' => $this->referentiel,
|
|
|
86 |
'largeur' => $this->largeur, 'mime_type' => 'text/html', 'methode' => 'telecharger');
|
|
|
87 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
88 |
return $url;
|
|
|
89 |
}
|
|
|
90 |
|
441 |
delphine |
91 |
public function getUrlEflorePng() {
|
|
|
92 |
$tpl = Config::get('efloreCarteTpl');
|
|
|
93 |
$params = array('num_nom' => $this->nom->get('id'), 'num_tax' => $this->nom->get('num_taxonomique') ,
|
|
|
94 |
'nom_sci' => $this->nom->get('nom_sci'), 'auteur' => $this->nom->get('auteur') ,
|
|
|
95 |
'largeur' => $this->largeur, 'mime_type' => 'image/png');
|
|
|
96 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
97 |
return $url;
|
|
|
98 |
}
|
1217 |
aurelien |
99 |
|
|
|
100 |
public function getUrlFloreProbablePng() {
|
|
|
101 |
$tpl = Config::get('carteFloreProbableTpl');
|
|
|
102 |
$params = array('id' => $this->id,
|
1220 |
aurelien |
103 |
'mime_type' => 'text/plain');
|
1217 |
aurelien |
104 |
$url = $this->formaterUrl($tpl, $params);
|
1220 |
aurelien |
105 |
$donnees = $this->chargerDonnees($url);
|
|
|
106 |
$url_carte = null;
|
|
|
107 |
// on demande l'url de la carte au web service
|
|
|
108 |
// car la carte peut ne pas exister
|
|
|
109 |
if(isset($donnees['binaire.href'])) {
|
|
|
110 |
$url_carte = $donnees['binaire.href'];
|
|
|
111 |
}
|
|
|
112 |
return $url_carte;
|
1217 |
aurelien |
113 |
}
|
253 |
gduche |
114 |
|
367 |
delphine |
115 |
public function getLegendeId() {
|
|
|
116 |
$tpl = Config::get('legendeIdCarteTpl');
|
|
|
117 |
$params = array('id' => $this->id);
|
|
|
118 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
119 |
$donnees = $this->chargerDonnees($url);
|
|
|
120 |
return $donnees;
|
|
|
121 |
}
|
|
|
122 |
|
253 |
gduche |
123 |
public function getLegende() {
|
291 |
jpm |
124 |
$tpl = Config::get('legendeCarteTpl');
|
1117 |
delphine |
125 |
$url = $this->formaterUrl($tpl, array());
|
253 |
gduche |
126 |
$donnees = $this->chargerDonnees($url);
|
|
|
127 |
return $donnees;
|
|
|
128 |
}
|
|
|
129 |
|
1048 |
raphael |
130 |
// version statique de getUrlPng() ci-dessus
|
|
|
131 |
static function getCarteUrlPng($projet, $id, $largeur) {
|
|
|
132 |
return Eflore::s_formaterUrl(Config::get('carteTpl'),
|
|
|
133 |
array('projet' => $projet,
|
|
|
134 |
'id' => $id,
|
|
|
135 |
'largeur' => $largeur,
|
|
|
136 |
'mime-type' => 'image/png'));
|
|
|
137 |
}
|
|
|
138 |
|
253 |
gduche |
139 |
}
|
|
|
140 |
?>
|