Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1217 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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