Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 303 Rev 308
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 5.1.1                                                                                    |
4
// | PHP version 5.1.1                                                                                    |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2006 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of eFlore-Fiche.                                                                   |
8
// | This file is part of eFlore-Fiche.                                                                   |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: effi_cel.action.php,v 1.9 2007-11-06 10:54:03 jp_milcent Exp $
24
// CVS : $Id: effi_cel.action.php,v 1.9 2007-11-06 10:54:03 jp_milcent Exp $
25
/**
25
/**
26
* Fichier d'action du module eFlore-Fiche : Cel
26
* Fichier d'action du module eFlore-Fiche : Cel
27
*
27
*
28
* Appel Carnet en ligne
28
* Appel Carnet en ligne
29
* 
29
* 
30
*
30
*
31
*@package eFlore
31
*@package eFlore
32
*@subpackage ef_fiche
32
*@subpackage ef_fiche
33
//Auteur original :
33
//Auteur original :
34
*@author        David Delon <dd@clapas.net>
34
*@author        David Delon <dd@clapas.net>
35
//Autres auteurs :
35
//Autres auteurs :
36
*@author        aucun
36
*@author        aucun
37
*@copyright     Tela-Botanica 2000-2006
37
*@copyright     Tela-Botanica 2000-2006
38
*@version       $Revision: 1.9 $ $Date: 2007-11-06 10:54:03 $
38
*@version       $Revision: 1.9 $ $Date: 2007-11-06 10:54:03 $
39
// +------------------------------------------------------------------------------------------------------+
39
// +------------------------------------------------------------------------------------------------------+
40
*/
40
*/
41
 
41
 
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
// |                                            ENTETE du PROGRAMME                                       |
43
// |                                            ENTETE du PROGRAMME                                       |
44
// +------------------------------------------------------------------------------------------------------+
44
// +------------------------------------------------------------------------------------------------------+
45
 
45
 
46
// +------------------------------------------------------------------------------------------------------+
46
// +------------------------------------------------------------------------------------------------------+
47
// |                                            CORPS du PROGRAMME                                        |
47
// |                                            CORPS du PROGRAMME                                        |
48
// +------------------------------------------------------------------------------------------------------+
48
// +------------------------------------------------------------------------------------------------------+
49
 
49
 
50
 
50
 
51
 
51
 
52
// TODO : CSS specifique (id)
52
// TODO : CSS specifique (id)
53
 
53
 
54
class Cartes {
54
class Cartes {
55
	private $tab_code_insee = array();
55
	private $tab_code_insee = array();
56
	private $src_map;
56
	private $src_map;
57
	
57
	
58
	public function consulter($ressources, $param) {
58
	public function consulter($ressources, $param) {
-
 
59
		$this->ressources = $ressources;
-
 
60
		$this->param = $param;
-
 
61
		
-
 
62
		$this->traiterParametres();
59
		// Initialisation des variables
63
		// Initialisation des variables
60
		$tab_retour = array();
64
		$tab_retour = array();
-
 
65
		
-
 
66
		
-
 
67
		$tab_retour['contenu_page'] = $this->calculerRepartition($this->info);
-
 
68
		print_r($this->calculerRepartition($this->info));
-
 
69
	}
-
 
70
	
-
 
71
	private function traiterParametres() {
61
		if ($param['miniature']==true) {
72
		if ($this->param['retour.format'] == 'min') {
62
			$this->src_map = 'france_utm_miniature.jpg';
73
			$this->src_map = 'france_utm_miniature.jpg';
63
		} else {
74
		} else {
64
			$this->src_map = 'france_utm_600x564.jpg';
75
			$this->src_map = 'france_utm_600x564.jpg';
65
		}
76
		}
66
		// +-----------------------------------------------------------------------------------------------------------+
77
		// +-----------------------------------------------------------------------------------------------------------+
67
		// Ajout du code du r�f�rentiel
78
		// Ajout du code du r�f�rentiel
68
		$this->info['referentiel'] = 'bdtfx';
79
		$this->info['referentiel'] = 'bdtfx';
69
		
80
		
70
		// +-----------------------------------------------------------------------------------------------------------+
81
		// +-----------------------------------------------------------------------------------------------------------+
71
		// R�cup�ration d'infos g�n�rales
82
		// R�cup�ration d'infos g�n�rales
72
		$this->info['nn'] = 141;
83
		/*$this->info['nn'] = 141;
73
		$this->info['nt'] = 8522;
84
		$this->info['nt'] = 8522;
74
		$this->info['nom'] = 'Acer campestre L.';
85
		$this->info['nom'] = 'Acer campestre L.';
75
		$this->info['nom_ss_auteur'] = 'Acer campestre';
86
		$this->info['nom_ss_auteur'] = 'Acer campestre';*/
76
		$this->info['miniature'] = false;
87
		$this->info['nn'] = $this->param['masque.nn'];
77
		
-
 
-
 
88
		$this->info['nt'] = $this->param['masque.nt'];
-
 
89
		$this->info['nom'] = $this->param['masque.ns'].' '.$this->param['masque.au'];
78
		$tab_retour['contenu_page'] = $this->calculerRepartition($this->info);
90
		$this->info['nom_ss_auteur'] = $this->param['masque.ns'];
79
		print_r($this->calculerRepartition($this->info));
91
		$this->info['miniature'] = $this->param['retour.format'];
80
	}
92
	}
81
	
93
	
82
	private function calculerRepartition($param) {
94
	private function calculerRepartition($param) {
83
		// Initialisation
-
 
84
		//require_once '../bibliotheque/jpeg/JPEG.php';
-
 
85
		$text = '';
95
		$text = '';
86
		// Lecture commentaires embarqu�s dans la page
96
		// Lecture commentaires embarqu�s dans la page
87
		
-
 
88
		// Si miniature 
-
 
89
		
-
 
90
		
-
 
91
	
-
 
92
		$jpg_txt = file_get_contents(Config::get('Cartes.chemin').str_replace('jpg', 'txt', $this->src_map));
97
		$jpg_txt = file_get_contents(Config::get('Cartes.chemin').str_replace('jpg', 'txt', $this->src_map));
93
		parse_str($jpg_txt);
98
		parse_str($jpg_txt);
94
		// Rappel : Pixel : O,0 en haut gauche
99
		// Rappel : Pixel : O,0 en haut gauche
95
		
100
		
96
		// X Coin inferieur gauche en Pixel
101
		// X Coin inferieur gauche en Pixel
97
		//$Px_echelle_X1['31T'] = 0;
102
		//$Px_echelle_X1['31T'] = 0;
98
		$Px_echelle_X1['31T'] = $X131T;
103
		$Px_echelle_X1['31T'] = $X131T;
99
		// Y Coin inferieur gauche en Pixel
104
		// Y Coin inferieur gauche en Pixel
100
		//$Px_echelle_Y1['31T'] = 539;
105
		//$Px_echelle_Y1['31T'] = 539;
101
		$Px_echelle_Y1['31T'] = $Y131T;
106
		$Px_echelle_Y1['31T'] = $Y131T;
102
		
107
		
103
		// Pour calcul Resolution
108
		// Pour calcul Resolution
104
		// X Coin inferieur droit en Pixel
109
		// X Coin inferieur droit en Pixel
105
		//$Px_echelle_X2['31T'] = 805;
110
		//$Px_echelle_X2['31T'] = 805;
106
		$Px_echelle_X2['31T'] = $X231T;
111
		$Px_echelle_X2['31T'] = $X231T;
107
		// Y Coin inferieur droit en Pixel
112
		// Y Coin inferieur droit en Pixel
108
		//$Px_echelle_Y2['31T'] = 539;
113
		//$Px_echelle_Y2['31T'] = 539;
109
		$Px_echelle_Y2['31T'] = $Y231T;
114
		$Px_echelle_Y2['31T'] = $Y231T;
110
		
115
		
111
		// X Coin inferieur gauche en UTM
116
		// X Coin inferieur gauche en UTM
112
		//$M_UTM_X1['31T'] = 300092;
117
		//$M_UTM_X1['31T'] = 300092;
113
		$M_UTM_X1['31T'] = $X131TUTM;
118
		$M_UTM_X1['31T'] = $X131TUTM;
114
		// Y Coin inferieur gauche en UTM
119
		// Y Coin inferieur gauche en UTM
115
		//$M_UTM_Y1['31T'] = 4536867;
120
		//$M_UTM_Y1['31T'] = 4536867;
116
		$M_UTM_Y1['31T'] = $Y131TUTM;
121
		$M_UTM_Y1['31T'] = $Y131TUTM;
117
		
122
		
118
		// Pour calcul "resolution"
123
		// Pour calcul "resolution"
119
		
124
		
120
		// X Coin inferieur droit en UTM
125
		// X Coin inferieur droit en UTM
121
		//$M_UTM_X2['31T'] = 105371; //
126
		//$M_UTM_X2['31T'] = 105371; //
122
		$M_UTM_X2['31T'] = $X231TUTM;
127
		$M_UTM_X2['31T'] = $X231TUTM;
123
		// Y Coin inferieur droit en UTM
128
		// Y Coin inferieur droit en UTM
124
		//$M_UTM_Y2['31T'] = 5042332;
129
		//$M_UTM_Y2['31T'] = 5042332;
125
		$M_UTM_Y2['31T'] = $Y231TUTM;
130
		$M_UTM_Y2['31T'] = $Y231TUTM;
126
	
131
	
127
		// "Resolution"
132
		// "Resolution"
128
		$p['31T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T']) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
133
		$p['31T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T']) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
129
		
134
		
130
		// Fuseau 32T :
135
		// Fuseau 32T :
131
		
136
		
132
		// Pixel : O,0 en haut gauche
137
		// Pixel : O,0 en haut gauche
133
		
138
		
134
		// X Coin inferieur gauche en Pixel
139
		// X Coin inferieur gauche en Pixel
135
		//$Px_echelle_X1['32T'] = 483;
140
		//$Px_echelle_X1['32T'] = 483;
136
		$Px_echelle_X1['32T'] = $X132T;
141
		$Px_echelle_X1['32T'] = $X132T;
137
		
142
		
138
		// Y Coin inferieur gauche en Pixel
143
		// Y Coin inferieur gauche en Pixel
139
		//$Px_echelle_Y1['32T'] = 536;
144
		//$Px_echelle_Y1['32T'] = 536;
140
		$Px_echelle_Y1['32T'] = $Y132T;
145
		$Px_echelle_Y1['32T'] = $Y132T;
141
		
146
		
142
		// X Coin inferieur droit en Pixel
147
		// X Coin inferieur droit en Pixel
143
		//$Px_echelle_X2['32T'] = 805;
148
		//$Px_echelle_X2['32T'] = 805;
144
		$Px_echelle_X2['32T'] = $X232T;
149
		$Px_echelle_X2['32T'] = $X232T;
145
		// Y Coin inferieur droit en Pixel
150
		// Y Coin inferieur droit en Pixel
146
		//$Px_echelle_Y2['32T'] = 536;
151
		//$Px_echelle_Y2['32T'] = 536;
147
		$Px_echelle_Y2['32T'] = $Y232T;
152
		$Px_echelle_Y2['32T'] = $Y232T;
148
		
153
		
149
		
154
		
150
		// X Coin inferieur gauche en UTM
155
		// X Coin inferieur gauche en UTM
151
		//$M_UTM_X1['32T'] = 247615;
156
		//$M_UTM_X1['32T'] = 247615;
152
		$M_UTM_X1['32T'] = $X132TUTM;
157
		$M_UTM_X1['32T'] = $X132TUTM;
153
		// Y Coin inferieur gauche en UTM
158
		// Y Coin inferieur gauche en UTM
154
		//$M_UTM_Y1['32T'] = 4540000;
159
		//$M_UTM_Y1['32T'] = 4540000;
155
		$M_UTM_Y1['32T'] = $Y132TUTM;
160
		$M_UTM_Y1['32T'] = $Y132TUTM;
156
		
161
		
157
		//$angle3132;
162
		//$angle3132;
158
	
163
	
159
		// "Resolution"
164
		// "Resolution"
160
		$p['32T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T'] ) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
165
		$p['32T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T'] ) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
161
		
166
		
162
		// Fuseau 30T :
167
		// Fuseau 30T :
163
		
168
		
164
		// X Coin inferieur gauche en Pixel
169
		// X Coin inferieur gauche en Pixel
165
		//$Px_echelle_X1['30T'] = 483;
170
		//$Px_echelle_X1['30T'] = 483;
166
		$Px_echelle_X1['30T'] = $X130T;
171
		$Px_echelle_X1['30T'] = $X130T;
167
		
172
		
168
		// Y Coin inferieur gauche en Pixel
173
		// Y Coin inferieur gauche en Pixel
169
		//$Px_echelle_Y1['30T'] = 536;
174
		//$Px_echelle_Y1['30T'] = 536;
170
		$Px_echelle_Y1['30T'] = $Y130T;
175
		$Px_echelle_Y1['30T'] = $Y130T;
171
		
176
		
172
		// X Coin inferieur droit en Pixel
177
		// X Coin inferieur droit en Pixel
173
		//$Px_echelle_X2['30T'] = 805;
178
		//$Px_echelle_X2['30T'] = 805;
174
		$Px_echelle_X2['30T'] = $X230T;
179
		$Px_echelle_X2['30T'] = $X230T;
175
		// Y Coin inferieur droit en Pixel
180
		// Y Coin inferieur droit en Pixel
176
		//$Px_echelle_Y2['30T'] = 536;
181
		//$Px_echelle_Y2['30T'] = 536;
177
		$Px_echelle_Y2['30T'] = $Y230T;
182
		$Px_echelle_Y2['30T'] = $Y230T;
178
		
183
		
179
		// X Coin inferieur gauche en UTM
184
		// X Coin inferieur gauche en UTM
180
		//$M_UTM_X1['30T'] = 247615;
185
		//$M_UTM_X1['30T'] = 247615;
181
		$M_UTM_X1['30T'] = $X130TUTM;
186
		$M_UTM_X1['30T'] = $X130TUTM;
182
		// Y Coin inferieur gauche en UTM
187
		// Y Coin inferieur gauche en UTM
183
		//$M_UTM_Y1['30T'] = 4540000;
188
		//$M_UTM_Y1['30T'] = 4540000;
184
		$M_UTM_Y1['30T'] = $Y130TUTM;
189
		$M_UTM_Y1['30T'] = $Y130TUTM;
185
		
190
		
186
		// angle
191
		// angle
187
		//$a = 356.0; // (-4 degre)
192
		//$a = 356.0; // (-4 degre)
188
		
193
		
189
		// "Resolution"
194
		// "Resolution"
190
		$p['30T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T'] ) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
195
		$p['30T'] = ($Px_echelle_X2['31T'] - $Px_echelle_X1['31T'] ) / ($M_UTM_X2['31T'] - $M_UTM_X1['31T']);
191
	
196
	
192
		// Nom du fichier image en sortie
197
		// Nom du fichier image en sortie
193
		$this->cheminCartesBase = Config::get('Cartes.chemin');
198
		$this->cheminCartesBase = Config::get('Cartes.chemin');
194
		$dest_map = 'nt'.$this->info['nt'].'_'.$this->src_map; 
199
		$dest_map = 'nt'.$this->info['nt'].'_'.$this->src_map; 
195
		$dest_map_cel = 'cel_nt'.$this->info['nt'].'_'.$this->src_map; 
200
		$dest_map_cel = 'cel_nt'.$this->info['nt'].'_'.$this->src_map; 
196
		$dest_map_cenlr = 'cenlr_nt'.$this->info['nt'].'_'.$this->src_map; 
201
		$dest_map_cenlr = 'cenlr_nt'.$this->info['nt'].'_'.$this->src_map; 
197
		$dest_map_cbnmed = 'cbnmed_nt'.$this->info['nt'].'_'.$this->src_map;
202
		$dest_map_cbnmed = 'cbnmed_nt'.$this->info['nt'].'_'.$this->src_map;
198
		$dest_map_sophy = 'sophy_nt'.$this->info['nt'].'_'.$this->src_map; 
203
		$dest_map_sophy = 'sophy_nt'.$this->info['nt'].'_'.$this->src_map; 
199
		$img = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
204
		$img = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
200
		$img_cel = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
205
		$img_cel = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
201
		$img_cenlr = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
206
		$img_cenlr = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
202
		$img_cbnmed = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
207
		$img_cbnmed = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
203
		$img_sophy = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
208
		$img_sophy = imagecreatefromjpeg($this->cheminCartesBase.$this->src_map);
204
		
209
		
205
		$retour = '<a name="topmap"></a>';
210
		$retour = '<a name="topmap"></a>';
206
		
211
		
207
		/*
212
		/*
208
		 * Les donnees issues du carnet en ligne sont recuperes directement, sans passer par le mecanisme de moissonage car :
213
		 * Les donnees issues du carnet en ligne sont recuperes directement, sans passer par le mecanisme de moissonage car :
209
		 *   - pour l'instant le service de moissonage n'est pas automatise et donc il y a un decalage dans l'affichage des donnees transmises
214
		 *   - pour l'instant le service de moissonage n'est pas automatise et donc il y a un decalage dans l'affichage des donnees transmises
210
		 *   - la table contenant les donnees moissonees ne reprend pas tous les champs necessaires a l'exploitation par eflore (notamment pas de code localite, pas d'identifiant libre)
215
		 *   - la table contenant les donnees moissonees ne reprend pas tous les champs necessaires a l'exploitation par eflore (notamment pas de code localite, pas d'identifiant libre)
211
		 * 
216
		 * 
212
		 * A terme, utilser vraiment le moissonage, y compris pour les donnees issues du CEL, en utilisant ABCD et en modifiant le programme d'harvesting.
217
		 * A terme, utilser vraiment le moissonage, y compris pour les donnees issues du CEL, en utilisant ABCD et en modifiant le programme d'harvesting.
213
		 */		
218
		 */		
214
		$inventories = $this->recupererDonnees();
219
		$inventories = $this->recupererDonnees();
215
		
220
		
216
		
221
		
217
		
222
		
218
		if (is_array($inventories)){
223
		if (is_array($inventories)){
219
			// D�finition des couleurs des points
224
			// D�finition des couleurs des points
220
			// green
225
			// green
221
			$green = imagecolorallocate($img, 0, 255, 0);
226
			$green = imagecolorallocate($img, 0, 255, 0);
222
			// red
227
			// red
223
		    $red = imagecolorallocate($img, 255, 0, 0);
228
		    $red = imagecolorallocate($img, 255, 0, 0);
224
		    // blue
229
		    // blue
225
			$blue = imagecolorallocate($img, 0, 0, 255);
230
			$blue = imagecolorallocate($img, 0, 0, 255);
226
			// purple
231
			// purple
227
			$purple = imagecolorallocate($img, 255, 0, 255);
232
			$purple = imagecolorallocate($img, 255, 0, 255);
228
		    // black
233
		    // black
229
		    $black = imagecolorallocate($img, 0, 0, 0);
234
		    $black = imagecolorallocate($img, 0, 0, 0);
230
		    
235
		    
231
			$i = 0;
236
			$i = 0;
232
			$text = array();
237
			$text = array();
233
			$merge = array();
238
			$merge = array();
234
			
239
			
235
			// Connection referentiel communes 
240
			// Connection referentiel communes 
236
			$this->chargerVille();
241
			$this->chargerVille();
237
			
242
			
238
			foreach ($inventories as $inventory){
243
			foreach ($inventories as $inventory){
239
				// On ne tient pas compte des coordonn�es x, y , positionnement en fonction de la commune uniquement
244
				// On ne tient pas compte des coordonn�es x, y , positionnement en fonction de la commune uniquement
240
				$location_protege = $this->getBdd()->proteger($inventory['location']);
245
				$location_protege = $this->getBdd()->proteger($inventory['location']);
241
				$id_location_protege = $this->getBdd()->proteger($inventory['id_location']);
246
				$id_location_protege = $this->getBdd()->proteger($inventory['id_location']);
242
				
247
				
243
				if ($inventory['collection_code'] == 'FLORE - VAR') {
248
				if ($inventory['collection_code'] == 'FLORE - VAR') {
244
					if (isset($this->tab_code_insee[$location_protege])) {
249
					if (isset($this->tab_code_insee[$location_protege])) {
245
						$utm = array(0 => $this->tab_code_insee[$location_protege]);
250
						$utm = array(0 => $this->tab_code_insee[$location_protege]);
246
					}
251
					}
247
				} elseif ($inventory['collection_code'] == 'sophy') {
252
				} elseif ($inventory['collection_code'] == 'sophy') {
248
					if (isset($this->tab_code_insee[$id_location_protege])) {
253
					if (isset($this->tab_code_insee[$id_location_protege])) {
249
						$utm = array(0 => $this->tab_code_insee[$id_location_protege]);
254
						$utm = array(0 => $this->tab_code_insee[$id_location_protege]);
250
					}
255
					}
251
					
256
					
252
				} else {		
257
				} else {		
253
					if ($inventory['id_location'] != 'null') {
258
					if ($inventory['id_location'] != 'null') {
254
						$requete = "SELECT * ".
259
						$requete = "SELECT * ".
255
							"FROM tb_cel.locations ".
260
							"FROM tb_cel.locations ".
256
							"WHERE name LIKE $location_protege ".
261
							"WHERE name LIKE $location_protege ".
257
							"	AND code = $id_location_protege ";
262
							"	AND code = $id_location_protege ";
258
						$utm = $this->getBdd()->recupererTous($requete);
263
						$utm = $this->getBdd()->recupererTous($requete);
259
					} else {
264
					} else {
260
						$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE $location_protege ";
265
						$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE $location_protege ";
261
						$utm = $this->getBdd()->recupererTous($requete);
266
						$utm = $this->getBdd()->recupererTous($requete);
262
					}
267
					}
263
				}
268
				}
264
				// Ultime tentative 
269
				// Ultime tentative 
265
				if (!$utm) {
270
				if (!$utm) {
266
					$requete = "SELECT *  FROM tb_cel.locations WHERE name LIKE $location_protege ";
271
					$requete = "SELECT *  FROM tb_cel.locations WHERE name LIKE $location_protege ";
267
					$utm = $this->getBdd()->recupererTous($requete);
272
					$utm = $this->getBdd()->recupererTous($requete);
268
				}
273
				}
269
 
274
 
270
				// Si des doublons sur la commune : pas d'affichage , il vaut mieux ne rien afficher que d'afficher des erreurs.
275
				// Si des doublons sur la commune : pas d'affichage , il vaut mieux ne rien afficher que d'afficher des erreurs.
271
				if (sizeof($utm) == 1) {
276
				if (sizeof($utm) == 1) {
272
					
277
					
273
				    $utm = $utm[0];
278
				    $utm = $utm[0];
274
					
279
					
275
					// On centre le point au milieu de la maille 10x10 par defaut ...
280
					// On centre le point au milieu de la maille 10x10 par defaut ...
276
					$pad = str_repeat ('0' ,(7 - strlen( $utm['x_utm'])));
281
					$pad = str_repeat ('0' ,(7 - strlen( $utm['x_utm'])));
277
					$utm['x_utm'] = $pad.$utm['x_utm'];
282
					$utm['x_utm'] = $pad.$utm['x_utm'];
278
	
283
	
279
					$pad = str_repeat ('0' ,(7 - strlen( $utm['y_utm'])));
284
					$pad = str_repeat ('0' ,(7 - strlen( $utm['y_utm'])));
280
					$utm['y_utm'] = $pad.$utm['y_utm'];
285
					$utm['y_utm'] = $pad.$utm['y_utm'];
281
	
286
	
282
					$utm['x_utm'] = substr($utm['x_utm'] ,0,3);
287
					$utm['x_utm'] = substr($utm['x_utm'] ,0,3);
283
					$utm['x_utm'] = $utm['x_utm'].'5000';
288
					$utm['x_utm'] = $utm['x_utm'].'5000';
284
	
289
	
285
					$utm['y_utm'] = substr($utm['y_utm'] ,0,3);
290
					$utm['y_utm'] = substr($utm['y_utm'] ,0,3);
286
					$utm['y_utm'] = $utm['y_utm'].'5000';
291
					$utm['y_utm'] = $utm['y_utm'].'5000';
287
	
292
	
288
					
293
					
289
					// Calcul coordonnes x, y sur l'image
294
					// Calcul coordonnes x, y sur l'image
290
					// Fuseau 31 T
295
					// Fuseau 31 T
291
					if ($utm['sector']=='31T') {
296
					if ($utm['sector']=='31T') {
292
						$x = (($utm['x_utm'] - $M_UTM_X1['31T']) * $p['31T'] ) + $Px_echelle_X1['31T'];
297
						$x = (($utm['x_utm'] - $M_UTM_X1['31T']) * $p['31T'] ) + $Px_echelle_X1['31T'];
293
						$y = $Px_echelle_Y2['31T'] - (($utm['y_utm'] - $M_UTM_Y1['31T']) * $p['31T'] );
298
						$y = $Px_echelle_Y2['31T'] - (($utm['y_utm'] - $M_UTM_Y1['31T']) * $p['31T'] );
294
					} elseif ($utm['sector'] == '32T') {// Fuseau 32 T : une rotation + translation est appliqu�e
299
					} elseif ($utm['sector'] == '32T') {// Fuseau 32 T : une rotation + translation est appliqu�e
295
						$cosa = cos(deg2rad($angle3132));
300
						$cosa = cos(deg2rad($angle3132));
296
						$sina = sin(deg2rad($angle3132));
301
						$sina = sin(deg2rad($angle3132));
297
		
302
		
298
						$xp = (($utm['x_utm'] - $M_UTM_X1['32T']) * $cosa) + (($utm['y_utm']- $M_UTM_Y1['32T']) * $sina);
303
						$xp = (($utm['x_utm'] - $M_UTM_X1['32T']) * $cosa) + (($utm['y_utm']- $M_UTM_Y1['32T']) * $sina);
299
						$yp = (-($utm['x_utm'] - $M_UTM_X1['32T'])* $sina) + (($utm['y_utm'] - $M_UTM_Y1['32T']) * $cosa);
304
						$yp = (-($utm['x_utm'] - $M_UTM_X1['32T'])* $sina) + (($utm['y_utm'] - $M_UTM_Y1['32T']) * $cosa);
300
						$x = ($xp * $p['32T'] ) + $Px_echelle_X1['32T'];
305
						$x = ($xp * $p['32T'] ) + $Px_echelle_X1['32T'];
301
						$y = $Px_echelle_Y2['32T']-($yp * $p['32T'] );
306
						$y = $Px_echelle_Y2['32T']-($yp * $p['32T'] );
302
					} elseif ($utm['sector'] == '30T') {// Fuseau 30 T : une rotation + translation est appliqu�e
307
					} elseif ($utm['sector'] == '30T') {// Fuseau 30 T : une rotation + translation est appliqu�e
303
						$cosa = cos(deg2rad($angle3031));
308
						$cosa = cos(deg2rad($angle3031));
304
						$sina = sin(deg2rad($angle3031));
309
						$sina = sin(deg2rad($angle3031));
305
		
310
		
306
						$xp = (($utm['x_utm'] - $M_UTM_X1['30T']) * $cosa) + (($utm['y_utm'] - $M_UTM_Y1['30T']) * $sina);
311
						$xp = (($utm['x_utm'] - $M_UTM_X1['30T']) * $cosa) + (($utm['y_utm'] - $M_UTM_Y1['30T']) * $sina);
307
						$yp = (-($utm['x_utm'] - $M_UTM_X1['30T']) * $sina) + (($utm['y_utm'] - $M_UTM_Y1['30T']) * $cosa);
312
						$yp = (-($utm['x_utm'] - $M_UTM_X1['30T']) * $sina) + (($utm['y_utm'] - $M_UTM_Y1['30T']) * $cosa);
308
						$x = ($xp * $p['30T'] ) + $Px_echelle_X1['30T'];
313
						$x = ($xp * $p['30T'] ) + $Px_echelle_X1['30T'];
309
						$y = $Px_echelle_Y2['30T'] - ($yp * $p['30T'] );
314
						$y = $Px_echelle_Y2['30T'] - ($yp * $p['30T'] );
310
					}
315
					}
311
					$x = round($x);
316
					$x = round($x);
312
					$y = round($y);
317
					$y = round($y);
313
					
318
					
314
					$comment = '';	
319
					$comment = '';	
315
					if ($utm['name'] != null) {
320
					if ($utm['name'] != null) {
316
						$name = utf8_decode($utm['name']);
321
						$name = utf8_decode($utm['name']);
317
					}	
322
					}	
318
					
323
					
319
					if ($inventory['date_observation'] != '0000-00-00 00:00:00') {
324
					if ($inventory['date_observation'] != '0000-00-00 00:00:00') {
320
						if ($inventory['collection_code'] == 'sophy') {
325
						if ($inventory['collection_code'] == 'sophy') {
321
							$comment .= ', en '.$inventory['date_observation'];
326
							$comment .= ', en '.$inventory['date_observation'];
322
						} else {
327
						} else {
323
							list($year, $month, $day) = explode ('-',$inventory['date_observation']);
328
							list($year, $month, $day) = explode ('-',$inventory['date_observation']);
324
			    	        list($day) = explode (' ',$day);
329
			    	        list($day) = explode (' ',$day);
325
			    	        if ($month == '00') {
330
			    	        if ($month == '00') {
326
			    	        	$comment .= ', en '.$year;
331
			    	        	$comment .= ', en '.$year;
327
			    	        } else {
332
			    	        } else {
328
								$comment .= ', le '.$day.'/'.$month.'/'.$year;
333
								$comment .= ', le '.$day.'/'.$month.'/'.$year;
329
			    	        }	
334
			    	        }	
330
						}	
335
						}	
331
					}
336
					}
332
					
337
					
333
					if ($inventory['collection_code'] == 'cel') {
338
					if ($inventory['collection_code'] == 'cel') {
334
						list($identifiant) = explode("@", $inventory['identifiant']);
339
						list($identifiant) = explode("@", $inventory['identifiant']);
335
						$comment .= " par ".$identifiant."@...";
340
						$comment .= " par ".$identifiant."@...";
336
					} else { 
341
					} else { 
337
						$comment .= " par ".utf8_decode($inventory['identifiant']);
342
						$comment .= " par ".utf8_decode($inventory['identifiant']);
338
					}
343
					}
339
					// On stocke les commentaires pour affichage dans les tooltips
344
					// On stocke les commentaires pour affichage dans les tooltips
340
					// Commentaire deja pr�sent ? : on ajoute � la suite
345
					// Commentaire deja pr�sent ? : on ajoute � la suite
341
	
346
	
342
					list($text, $merge) = $this->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y); 
347
					list($text, $merge) = $this->stockerCommentaire($text, $merge, $name, $comment, $inventory['collection_code'],$x,$y); 
343
					
348
					
344
				    
349
				    
345
				}
350
				}
346
				
351
				
347
				$i++;
352
				$i++;
348
			}
353
			}
349
		
354
		
350
			//print_r($text);
355
			//print_r($text);
351
			
356
			
352
	    
357
	    
353
	    	$usemap = '';
358
	    	$usemap = '';
354
			$usemap_cel = '';
359
			$usemap_cel = '';
355
			$usemap_cenlr = '';
360
			$usemap_cenlr = '';
356
			$usemap_cbnmed = '';
361
			$usemap_cbnmed = '';
357
			$usemap_sophy = '';
362
			$usemap_sophy = '';
358
			
363
			
359
			if ($text) {
364
			if ($text) {
360
				foreach ($text as $coord => $origines ) {
365
				foreach ($text as $coord => $origines ) {
361
					foreach ($origines as $origine => $maptext ) {
366
					foreach ($origines as $origine => $maptext ) {
362
						$maptext = preg_replace("/\"/", "\'", $maptext);
367
						$maptext = preg_replace("/\"/", "\'", $maptext);
363
							
368
							
364
						list($x,$y) = explode('|', $coord);			
369
						list($x,$y) = explode('|', $coord);			
365
						
370
						
366
						$tpl_area = '<area shape="%s" alt="" class="tooltip" coords="%s" title="%s"/>';
371
						$tpl_area = '<area shape="%s" alt="" class="tooltip" coords="%s" title="%s"/>';
367
						$rayon = 2;
372
						$rayon = 2;
368
						$type = 'circle';
373
						$type = 'circle';
369
						$coords = "$x,$y,5";
374
						$coords = "$x,$y,5";
370
						$on_mouseover = "this.ttBgColor='#99C242';this.ttFontColor='#000000';this.T_OFFSETX=-200;this.T_OFFSETY=-50;this.T_STICKY=1;return escape('$maptext')";
375
						$on_mouseover = "this.ttBgColor='#99C242';this.ttFontColor='#000000';this.T_OFFSETX=-200;this.T_OFFSETY=-50;this.T_STICKY=1;return escape('$maptext')";
371
 
376
 
372
						switch ($origine) {
377
						switch ($origine) {
373
						    case 'FLORE - VAR': // cbnmed
378
						    case 'FLORE - VAR': // cbnmed
374
								imagefilledellipse($img_cbnmed, $x, $y, 7, 7, $blue);
379
								imagefilledellipse($img_cbnmed, $x, $y, 7, 7, $blue);
375
								$usemap_cbnmed = $usemap_cbnmed.sprintf($tpl_area, $type, $coords, $maptext);
380
								$usemap_cbnmed = $usemap_cbnmed.sprintf($tpl_area, $type, $coords, $maptext);
376
								break;
381
								break;
377
							case 'cel':
382
							case 'cel':
378
								imagefilledrectangle($img_cel, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $green);
383
								imagefilledrectangle($img_cel, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $green);
379
								$coords = ($x - $rayon).','.($y - $rayon).','.($x + $rayon).','.($y + $rayon);
384
								$coords = ($x - $rayon).','.($y - $rayon).','.($x + $rayon).','.($y + $rayon);
380
								$usemap_cel = $usemap_cel.sprintf($tpl_area, 'rect', $coords, $maptext);
385
								$usemap_cel = $usemap_cel.sprintf($tpl_area, 'rect', $coords, $maptext);
381
								break;
386
								break;
382
							case 'flore': // cenlr
387
							case 'flore': // cenlr
383
								imagefilledellipse($img_cenlr, $x, $y, 7, 7, $red);
388
								imagefilledellipse($img_cenlr, $x, $y, 7, 7, $red);
384
								$usemap_cenlr = $usemap_cenlr.sprintf($tpl_area, $type, $coords, $maptext);
389
								$usemap_cenlr = $usemap_cenlr.sprintf($tpl_area, $type, $coords, $maptext);
385
								break;
390
								break;
386
							case 'sophy':
391
							case 'sophy':
387
								imagefilledrectangle($img_sophy, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $purple);
392
								imagefilledrectangle($img_sophy, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $purple);
388
								$coords = ($x - $rayon).','.($y - $rayon).','.($x + $rayon).','.($y + $rayon);
393
								$coords = ($x - $rayon).','.($y - $rayon).','.($x + $rayon).','.($y + $rayon);
389
								$usemap_sophy = $usemap_sophy.sprintf($tpl_area, 'rect', $coords, $maptext);
394
								$usemap_sophy = $usemap_sophy.sprintf($tpl_area, 'rect', $coords, $maptext);
390
								break;	
395
								break;	
391
							case 'tout':
396
							case 'tout':
392
								if (isset($merge[$coord]) && $merge[$coord]) {
397
								if (isset($merge[$coord]) && $merge[$coord]) {
393
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $black);
398
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $black);
394
								} elseif (isset ($text[$coord]['cel']) && ($text[$coord]['cel'])) {
399
								} elseif (isset ($text[$coord]['cel']) && ($text[$coord]['cel'])) {
395
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $green);
400
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $green);
396
								} elseif (isset ($text[$coord]['flore']) && ($text[$coord]['flore'])) {
401
								} elseif (isset ($text[$coord]['flore']) && ($text[$coord]['flore'])) {
397
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $red);
402
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $red);
398
								} elseif (isset ($text[$coord]['FLORE - VAR']) && ($text[$coord]['FLORE - VAR'])) {
403
								} elseif (isset ($text[$coord]['FLORE - VAR']) && ($text[$coord]['FLORE - VAR'])) {
399
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $blue);
404
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $blue);
400
								} elseif (isset ($text[$coord]['sophy']) && ($text[$coord]['sophy'])) {
405
								} elseif (isset ($text[$coord]['sophy']) && ($text[$coord]['sophy'])) {
401
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $purple);
406
									imagefilledrectangle($img, ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $purple);
402
								}
407
								}
403
								$usemap = $usemap.sprintf($tpl_area, $type, $coords, $maptext);
408
								$usemap = $usemap.sprintf($tpl_area, $type, $coords, $maptext);
404
								break;
409
								break;
405
								
410
								
406
						}
411
						}
407
						//imagestring($img, 1, $x, $y, 7, 7, "hello", $fill);
412
						//imagestring($img, 1, $x, $y, 7, 7, "hello", $fill);
408
						// pas de double quote dans le texte
413
						// pas de double quote dans le texte
409
					}
414
					}
410
				}
415
				}
411
			}
416
			}
412
			
417
			
413
			//imageinterlace($img,1);
418
			//imageinterlace($img,1);
414
			$qualite = 90;
419
			$qualite = 90;
415
		    imagejpeg($img, Config::get('cache.stockageChemin').$dest_map, $qualite);
420
		    imagejpeg($img, Config::get('cache.stockageChemin').$dest_map, $qualite);
416
		    imagejpeg($img_cel, Config::get('cache.stockageChemin').$dest_map_cel, $qualite);
421
		    imagejpeg($img_cel, Config::get('cache.stockageChemin').$dest_map_cel, $qualite);
417
		    imagejpeg($img_cenlr, Config::get('cache.stockageChemin').$dest_map_cenlr, $qualite);
422
		    imagejpeg($img_cenlr, Config::get('cache.stockageChemin').$dest_map_cenlr, $qualite);
418
	    	imagejpeg($img_cbnmed, Config::get('cache.stockageChemin').$dest_map_cbnmed, $qualite);
423
	    	imagejpeg($img_cbnmed, Config::get('cache.stockageChemin').$dest_map_cbnmed, $qualite);
419
	    	imagejpeg($img_sophy, Config::get('cache.stockageChemin').$dest_map_sophy, $qualite);
424
	    	imagejpeg($img_sophy, Config::get('cache.stockageChemin').$dest_map_sophy, $qualite);
420
		    
425
		    
421
		    //imagedestroy($img);
426
		    //imagedestroy($img);
422
	
427
	
423
		    $retour = '';
428
		    $retour = '';
424
		    if ($param['miniature'] != true)  {
429
		    if ($this->info['miniature'] !== 'min')  {
425
		    	$retour.="<div id=\"descriptions\">";
430
		    	$retour.="<div id=\"descriptions\">";
426
				$retour.="<h2 id=\"titre_description_general\">Donn&eacute;es disponibles : </h2>";
431
				$retour.="<h2 id=\"titre_description_general\">Donn&eacute;es disponibles : </h2>";
427
		    	$retour.= "<div id=\"description_defaut\" class=\"description\">";
432
		    	$retour.= "<div id=\"description_defaut\" class=\"description\">";
428
		    	$retour.= "<h3 style='display:none'><span class=\"affichage\">Toutes observations</span></h3>";
433
		    	$retour.= "<h3 style='display:none'><span class=\"affichage\">Toutes observations</span></h3>";
429
				$retour.=  "<div id =\"cartowikimap\" style=\"position:relative;\">";
434
				$retour.=  "<div id =\"cartowikimap\" style=\"position:relative;\">";
430
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n";
435
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n";
431
				$retour.=  "<map name=\"themap\" id=\"themap\">";
436
				$retour.=  "<map name=\"themap\" id=\"themap\">";
432
				$retour.=  $usemap;
437
				$retour.=  $usemap;
433
				$retour.=  "</map>";
438
				$retour.=  "</map>";
434
				$retour.=  "</map>";
439
				$retour.=  "</map>";
435
				
440
				
436
				$retour.=  "</div>";
441
				$retour.=  "</div>";
437
				$retour.=  "</div>";
442
				$retour.=  "</div>";
438
		
443
		
439
				
444
				
440
		    	$retour.= "<div id=\"description_1\" class=\"description\">";
445
		    	$retour.= "<div id=\"description_1\" class=\"description\">";
441
				$retour.= "<h3 style='display:none;background-color:rgb(0,255,0);color:black;'><span class=\"affichage\">Observations issues du Carnet en ligne</span></h3>";
446
				$retour.= "<h3 style='display:none;background-color:rgb(0,255,0);color:black;'><span class=\"affichage\">Observations issues du Carnet en ligne</span></h3>";
442
				$retour.=  "<div id =\"cartowikimap\" style=\"position:relative;\">";
447
				$retour.=  "<div id =\"cartowikimap\" style=\"position:relative;\">";
443
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cel)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcel\"></img><br />\n";
448
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cel)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcel\"></img><br />\n";
444
				$retour.=  "<map name=\"themapcel\" id=\"themapcel\">";
449
				$retour.=  "<map name=\"themapcel\" id=\"themapcel\">";
445
				$retour.=  $usemap_cel;
450
				$retour.=  $usemap_cel;
446
				$retour.=  "</map>";
451
				$retour.=  "</map>";
447
				$retour.=  "</div>";
452
				$retour.=  "</div>";
448
				$retour.=  "</div>";
453
				$retour.=  "</div>";
449
				
454
				
450
				
455
				
451
			
456
			
452
				
457
				
453
				$retour.= "<div id=\"description_2\" class=\"description\">";
458
				$retour.= "<div id=\"description_2\" class=\"description\">";
454
				
459
				
455
				$retour.= "<h3 style='display:none;background-color:rgb(255,0,0);color:white;'><span class=\"affichage\">Prospection flore du CEN LR</span></h3>";
460
				$retour.= "<h3 style='display:none;background-color:rgb(255,0,0);color:white;'><span class=\"affichage\">Prospection flore du CEN LR</span></h3>";
456
				$retour.=  "<div id =\"cartowikimapcenlr\" style=\"position:relative;\">";
461
				$retour.=  "<div id =\"cartowikimapcenlr\" style=\"position:relative;\">";
457
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cenlr)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcenlr\"></img><br />\n";
462
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cenlr)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcenlr\"></img><br />\n";
458
				$retour.=  "<map name=\"themapcenlr\" id=\"themapcenlr\">";
463
				$retour.=  "<map name=\"themapcenlr\" id=\"themapcenlr\">";
459
				$retour.=  $usemap_cenlr;
464
				$retour.=  $usemap_cenlr;
460
				$retour.=  "</map>";
465
				$retour.=  "</map>";
461
				$retour.=  "</div>";
466
				$retour.=  "</div>";
462
				$retour.=  "</div>";
467
				$retour.=  "</div>";
463
				
468
				
464
	
469
	
465
				
470
				
466
				$retour.= "<div id=\"description_3\" class=\"description\">";
471
				$retour.= "<div id=\"description_3\" class=\"description\">";
467
				
472
				
468
				$retour.= "<h3 style='display:none;background-color:rgb(0,0,255);color:white;'><span class=\"affichage\">Flore Silene</span></h3>";
473
				$retour.= "<h3 style='display:none;background-color:rgb(0,0,255);color:white;'><span class=\"affichage\">Flore Silene</span></h3>";
469
				$retour.=  "<div id =\"cartowikimapcbnmed\" style=\"position:relative;\">";
474
				$retour.=  "<div id =\"cartowikimapcbnmed\" style=\"position:relative;\">";
470
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cbnmed)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcbnmed\"></img><br />\n";
475
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_cbnmed)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapcbnmed\"></img><br />\n";
471
				$retour.=  "<map name=\"themapcbnmed\" id=\"themapcbnmed\">";
476
				$retour.=  "<map name=\"themapcbnmed\" id=\"themapcbnmed\">";
472
				$retour.=  $usemap_cbnmed;
477
				$retour.=  $usemap_cbnmed;
473
				$retour.=  "</map>";
478
				$retour.=  "</map>";
474
				$retour.=  "</div>";
479
				$retour.=  "</div>";
475
				$retour.=  "</div>";
480
				$retour.=  "</div>";
476
				
481
				
477
				
482
				
478
				$retour.= "<div id=\"description_4\" class=\"description\">";
483
				$retour.= "<div id=\"description_4\" class=\"description\">";
479
				
484
				
480
				$retour.= "<h3 style='display:none;background-color:rgb(255,0,255);color:white;'><span class=\"affichage\">Observations issues de la base SOPHY</span></h3>";
485
				$retour.= "<h3 style='display:none;background-color:rgb(255,0,255);color:white;'><span class=\"affichage\">Observations issues de la base SOPHY</span></h3>";
481
				$retour.=  "<div id =\"cartowikimapsophy\" style=\"position:relative;\">";
486
				$retour.=  "<div id =\"cartowikimapsophy\" style=\"position:relative;\">";
482
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_sophy)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapsophy\"></img><br />\n";
487
				$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map_sophy)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themapsophy\"></img><br />\n";
483
				$retour.=  "<map name=\"themapsophy\" id=\"themapsophy\">";
488
				$retour.=  "<map name=\"themapsophy\" id=\"themapsophy\">";
484
				$retour.=  $usemap_sophy;
489
				$retour.=  $usemap_sophy;
485
				$retour.=  "</map>";
490
				$retour.=  "</map>";
486
				$retour.=  "</div>";
491
				$retour.=  "</div>";
487
				$retour.=  "</div>";
492
				$retour.=  "</div>";
488
 
493
 
489
				$retour.=  "</div>";
494
				$retour.=  "</div>";
490
		    } else { // miniature
495
		    } else { // miniature
491
		    	$retour.=  "<div id =\"cartowikimap\" style=\"position:relative;\">";
496
		    	$retour.=  "<div id =\"cartowikimap\" style=\"position:relative;\">";
492
		    	//$retour.=  "<a href=".$param['url_onglet_cel'].">"; //lien vers grande image
497
		    	//$retour.=  "<a href=".$param['url_onglet_cel'].">"; //lien vers grande image
493
		    	$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\"></img><br />\n";
498
		    	$retour.=  "<img src=\"".(Config::get('Cartes.cel_dst').$dest_map)."\" style=\"border:none; cursor:crosshair\" alt=\"\" usemap=\"#themap\"></img><br />\n";
494
		    	//$retour.=  "</a>";
499
		    	//$retour.=  "</a>";
495
				$retour.=  "<map name=\"themap\" id=\"themap\">";
500
				$retour.=  "<map name=\"themap\" id=\"themap\">";
496
				$retour.=  $usemap;
501
				$retour.=  $usemap;
497
				$retour.=  "</map>";
502
				$retour.=  "</map>";
498
				$retour.=  "</div>";
503
				$retour.=  "</div>";
499
		    }
504
		    }
500
		} else {
505
		} else {
501
			$retour.=  "<map name=\"themap\" id=\"themap\">";
506
			$retour.=  "<map name=\"themap\" id=\"themap\">";
502
			$retour.=  "<img src=\"".Config.get('cartes.chemin').$this->src_map."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
507
			$retour.=  "<img src=\"".Config.get('cartes.chemin').$this->src_map."\" style=\"border:none; cursor:crosshair\" alt=\"\" />\n";
503
			$retour.=  "</map>";
508
			$retour.=  "</map>";
504
		}
509
		}
505
		return $retour;
510
		return $retour;
506
	}
511
	}
507
	
512
	
508
 
513
 
509
 
514
 
510
	/*
515
	/*
511
	 * Stockage commentaire associe a un point :
516
	 * Stockage commentaire associe a un point :
512
	 * 
517
	 * 
513
	 * Param : 
518
	 * Param : 
514
	 * @text : texte cumule
519
	 * @text : texte cumule
515
	 * @merge : indicateur de commentaire fusionne
520
	 * @merge : indicateur de commentaire fusionne
516
	 * @name : commune associee
521
	 * @name : commune associee
517
	 * @comment : commentaire
522
	 * @comment : commentaire
518
	 * @origine : origine de la donnee
523
	 * @origine : origine de la donnee
519
	 * 
524
	 * 
520
	 * 
525
	 * 
521
	 * TODO : rendre cette fonction independante des valeurs d'origine passee en parametre
526
	 * TODO : rendre cette fonction independante des valeurs d'origine passee en parametre
522
	 */
527
	 */
523
	private function stockerCommentaire($text, $merge, $name, $comment, $origine, $x, $y) {
528
	private function stockerCommentaire($text, $merge, $name, $comment, $origine, $x, $y) {
524
		if ($origine == 'cel') {
529
		if ($origine == 'cel') {
525
			$prefix = 'CEL : ';
530
			$prefix = 'CEL : ';
526
		} elseif ($origine == 'flore') {
531
		} elseif ($origine == 'flore') {
527
			$prefix = 'CEN LR : ';
532
			$prefix = 'CEN LR : ';
528
		} elseif ($origine == 'FLORE - VAR') {
533
		} elseif ($origine == 'FLORE - VAR') {
529
			$prefix = 'CBN MED : ';
534
			$prefix = 'CBN MED : ';
530
		} elseif ($origine == 'sophy') {
535
		} elseif ($origine == 'sophy') {
531
			$prefix = 'SOPHY : ';
536
			$prefix = 'SOPHY : ';
532
		}
537
		}
533
		
538
		
534
		// Cumul toute origine :   
539
		// Cumul toute origine :   
535
		if (isset($text[$x.'|'.$y]['tout']) && ($text[$x.'|'.$y])) {
540
		if (isset($text[$x.'|'.$y]['tout']) && ($text[$x.'|'.$y])) {
536
			$text[$x.'|'.$y]['tout'] = $text[$x.'|'.$y]['tout'].'<br>'.$prefix.$name.$comment;
541
			$text[$x.'|'.$y]['tout'] = $text[$x.'|'.$y]['tout'].'<br>'.$prefix.$name.$comment;
537
		} else {
542
		} else {
538
			// Nouveau commentaire
543
			// Nouveau commentaire
539
			$text[$x.'|'.$y]['tout']=$prefix.$name.$comment;
544
			$text[$x.'|'.$y]['tout']=$prefix.$name.$comment;
540
		}
545
		}
541
		 
546
		 
542
		// Deja present  pour cette origine ? on ajoute  
547
		// Deja present  pour cette origine ? on ajoute  
543
		if (isset ($text[$x.'|'.$y][$origine]) && ($text[$x.'|'.$y][$origine])) {
548
		if (isset ($text[$x.'|'.$y][$origine]) && ($text[$x.'|'.$y][$origine])) {
544
			$text[$x.'|'.$y][$origine] = $text[$x.'|'.$y][$origine].'<br>'.$name.$comment;
549
			$text[$x.'|'.$y][$origine] = $text[$x.'|'.$y][$origine].'<br>'.$name.$comment;
545
		} else { // Nouveau commentaire
550
		} else { // Nouveau commentaire
546
			$text[$x.'|'.$y][$origine] = $name.$comment;
551
			$text[$x.'|'.$y][$origine] = $name.$comment;
547
		}
552
		}
548
		
553
		
549
		
554
		
550
		// Detection superposition de donnee 
555
		// Detection superposition de donnee 
551
		if ($origine == 'cel') {
556
		if ($origine == 'cel') {
552
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])) 
557
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])) 
553
			|| (isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
558
			|| (isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
554
				$merge[$x.'|'.$y]=true;
559
				$merge[$x.'|'.$y]=true;
555
			}
560
			}
556
		} elseif ($origine == 'flore') {
561
		} elseif ($origine == 'flore') {
557
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) ||(isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
562
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) ||(isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
558
			(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
563
			(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
559
				$merge[$x.'|'.$y]=true;
564
				$merge[$x.'|'.$y]=true;
560
			}
565
			}
561
		} elseif ($origine == 'FLORE - VAR') {
566
		} elseif ($origine == 'FLORE - VAR') {
562
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
567
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
563
			(isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore']))) {
568
			(isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore']))) {
564
				$merge[$x.'|'.$y]=true;
569
				$merge[$x.'|'.$y]=true;
565
			}					
570
			}					
566
		} elseif ($origine == 'sophy') {
571
		} elseif ($origine == 'sophy') {
567
			if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])|| 
572
			if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])|| 
568
				(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
573
				(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
569
				$merge[$x.'|'.$y]=true;
574
				$merge[$x.'|'.$y]=true;
570
			}					
575
			}					
571
		}
576
		}
572
		
577
		
573
		return array($text, $merge);
578
		return array($text, $merge);
574
	}
579
	}
575
	
580
	
576
 
581
 
577
	
582
	
578
	//+------------------------------------------------------------------------------------------------------+
583
	//+------------------------------------------------------------------------------------------------------+
579
	// Méthodes d'accès aux objets du Framework
584
	// Méthodes d'accès aux objets du Framework
580
	/**
585
	/**
581
	* Méthode de connection à la base de données sur demande.
586
	* Méthode de connection à la base de données sur demande.
582
	* Tous les services web n'ont pas besoin de s'y connecter.
587
	* Tous les services web n'ont pas besoin de s'y connecter.
583
	*/
588
	*/
584
	protected function getBdd() {
589
	protected function getBdd() {
585
	if (! isset($this->Bdd)) {
590
	if (! isset($this->Bdd)) {
586
	$this->Bdd = new Bdd();
591
	$this->Bdd = new Bdd();
587
	}
592
	}
588
	return $this->Bdd;
593
	return $this->Bdd;
589
	}
594
	}
590
		
595
		
591
	private function chargerVille() {
596
	private function chargerVille() {
592
		$requete = "SELECT * FROM tb_cel.locations";
597
		$requete = "SELECT * FROM tb_cel.locations";
593
		$villes = $this->getBdd()->recupererTous($requete);
598
		$villes = $this->getBdd()->recupererTous($requete);
594
		foreach ($villes as $ville) {
599
		foreach ($villes as $ville) {
595
			$this->tab_code_insee[$ville['insee_code']] = $ville;
600
			$this->tab_code_insee[$ville['insee_code']] = $ville;
596
		}
601
		}
597
	}
602
	}
598
	
603
	
599
	public function recupererDonnees() {
604
	public function recupererDonnees() {
600
		// Recherche nom correspondant au numero nomenclatural en cours (pour etablir le lien avec les donnees moissonnes).
605
		// Recherche nom correspondant au numero nomenclatural en cours (pour etablir le lien avec les donnees moissonnes).
601
		$nom = 'Acer campestre L.';//$this->formaterNom($rawNom);
-
 
602
		$nom_ss_auteur = 'Acer campestre';//$this->formaterNomSansAuteur($rawNom);
-
 
603
	
606
	
604
		// R�cuperation donn�e inventaire
607
		// R�cuperation donn�e inventaire
605
		$queryCel = "SELECT 'cel' as collection_code,  location, id_location, date_observation,  ".
608
		$queryCel = "SELECT 'cel' as collection_code,  location, id_location, date_observation,  ".
606
						"	coord_y as y_utm, coord_x as x_utm, ref_geo as sector, identifiant FROM tb_cel.cel_inventory ".
609
						"	coord_y as y_utm, coord_x as x_utm, ref_geo as sector, identifiant FROM tb_cel.cel_inventory ".
607
						"WHERE num_taxon = '".$this->info['nt']."' ".
610
						"WHERE num_taxon = '".$this->info['nt']."' ".
608
						"	AND transmission = 1";
611
						"	AND transmission = 1";
609
		$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
612
		$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
610
			
613
			
611
		// Recuperation des donnees de moissonage
614
		// Recuperation des donnees de moissonage
612
		// Collection code = 'flore' (Cenlr)
615
		// Collection code = 'flore' (Cenlr)
613
		$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
616
		$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
614
						"	STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ". 
617
						"	STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ". 
615
				    	"	longitude as x_utm , max_altitude as sector,  collector_name as identifiant ".
618
				    	"	longitude as x_utm , max_altitude as sector,  collector_name as identifiant ".
616
						"FROM tb_hit_indexation.raw_occurrence_record ".
619
						"FROM tb_hit_indexation.raw_occurrence_record ".
617
						"WHERE scientific_name = ".$this->getBdd()->proteger($nom).
620
						"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
618
						"	AND collection_code = 'flore' ".
621
						"	AND collection_code = 'flore' ".
619
						"	AND  deleted IS NULL";
622
						"	AND  deleted IS NULL";
620
		$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
623
		$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
621
	
624
	
622
	
625
	
623
		// Collection code = 'FLORE - VAR' (Cbnmed)
626
		// Collection code = 'FLORE - VAR' (Cbnmed)
624
		$queryCbnmed = "SELECT collection_code, locality as location, county as id_location, ".
627
		$queryCbnmed = "SELECT collection_code, locality as location, county as id_location, ".
625
						"	STR_TO_DATE(concat(ifnull(year,0),'/', ifnull(month,0), '/',ifnull(day,0)), '%Y/%m/%d') as date_observation, ".
628
						"	STR_TO_DATE(concat(ifnull(year,0),'/', ifnull(month,0), '/',ifnull(day,0)), '%Y/%m/%d') as date_observation, ".
626
						"	latitude as y_utm , longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
629
						"	latitude as y_utm , longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
627
						"FROM tb_hit_indexation.raw_occurrence_record ".
630
						"FROM tb_hit_indexation.raw_occurrence_record ".
628
						"WHERE scientific_name = ".$this->getBdd()->proteger($nom).
631
						"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
629
						"	AND collection_code='FLORE - VAR' ".
632
						"	AND collection_code='FLORE - VAR' ".
630
						"	AND  (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
633
						"	AND  (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
631
		$inventoriesCbnmed = $this->getBdd()->recupererTous($queryCbnmed);
634
		$inventoriesCbnmed = $this->getBdd()->recupererTous($queryCbnmed);
632
	
635
	
633
		// Collection code = 'sophy'
636
		// Collection code = 'sophy'
634
		$querySophy = "SELECT 'sophy' as collection_code, lieu_station_nom as location, lieu_commune_code_insee as id_location, ".
637
		$querySophy = "SELECT 'sophy' as collection_code, lieu_station_nom as location, lieu_commune_code_insee as id_location, ".
635
						"	observation_date as date_observation, lieu_station_utm_est as x_utm , ". 
638
						"	observation_date as date_observation, lieu_station_utm_est as x_utm , ". 
636
				    	"	lieu_station_utm_nord as y_utm , lieu_station_utm_zone as sector,  observateur_nom_complet as identifiant ".
639
				    	"	lieu_station_utm_nord as y_utm , lieu_station_utm_zone as sector,  observateur_nom_complet as identifiant ".
637
						"FROM sophy_tapir ".
640
						"FROM sophy_tapir ".
638
						"WHERE nom_scientifique_complet = ".$this->getBdd()->proteger($nom_ss_auteur);
641
						"WHERE nom_scientifique_complet = ".$this->getBdd()->proteger($this->info['nom_ss_auteur']);
639
		$inventoriesSophy = $this->getBdd()->recupererTous($querySophy);
642
		$inventoriesSophy = $this->getBdd()->recupererTous($querySophy);
640
	
643
	
641
		return array_merge($inventoriesCel, $inventoriesCenlr, $inventoriesCbnmed, $inventoriesSophy);
644
		return array_merge($inventoriesCel, $inventoriesCenlr, $inventoriesCbnmed, $inventoriesSophy);
642
	}
645
	}
643
	
646
	
644
}
647
}
645
?>
648
?>