Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 320 Rev 362
1
<?php
1
<?php
2
class GeneralFormateur implements Formateur {
2
class GeneralFormateur implements Formateur {
3
	public $dest_map = array();
3
	public $dest_map = array();
4
	public $img = array();
4
	public $img = array();
5
	public function __construct($info) {
5
	public function __construct($info) {
6
		$this->info = $info;
6
		$this->info = $info;
7
	}
7
	}
8
	public function img() {
8
	public function img() {
9
		$qualite = 9;
9
		$qualite = 9;
10
		imagepng($this->img['general'], Config::get('cache.stockageChemin').$this->dest_map['general'], $qualite);
10
		imagepng($this->img['general'], Config::get('cache.stockageChemin').$this->dest_map['general'], $qualite);
11
	}
11
	}
12
	//+----------------------------------------------------------------------------------------------------------------+
12
	//+----------------------------------------------------------------------------------------------------------------+
13
	// Méthodes d'accès aux objets du Framework
13
	// Méthodes d'accès aux objets du Framework
14
	/**
14
	/**
15
	* Méthode de connection à la base de données sur demande.
15
	* Méthode de connection à la base de données sur demande.
16
	* Tous les services web n'ont pas besoin de s'y connecter.
16
	* Tous les services web n'ont pas besoin de s'y connecter.
17
	*/
17
	*/
18
	protected function getBdd() {
18
	protected function getBdd() {
19
	if (! isset($this->Bdd)) {
19
	if (! isset($this->Bdd)) {
20
	$this->Bdd = new Bdd();
20
	$this->Bdd = new Bdd();
21
	}
21
	}
22
	return $this->Bdd;
22
	return $this->Bdd;
23
	}
23
	}
24
	
24
	
25
	public function definirCouleurs() {
25
	public function definirCouleurs() {
26
		// green
26
		// green
27
		$couleur['green'] = imagecolorallocate($this->img['general'], 0, 255, 0);
27
		$couleur['green'] = imagecolorallocate($this->img['general'], 0, 255, 0);
28
		// red
28
		// red
29
		$couleur['red'] = imagecolorallocate($this->img['general'], 255, 0, 0);
29
		$couleur['red'] = imagecolorallocate($this->img['general'], 255, 0, 0);
30
		// blue
30
		// blue
31
		$couleur['blue'] = imagecolorallocate($this->img['general'], 0, 0, 255);
31
		$couleur['blue'] = imagecolorallocate($this->img['general'], 0, 0, 255);
32
		// purple
32
		// purple
33
		$couleur['purple'] = imagecolorallocate($this->img['general'], 255, 0, 255);
33
		$couleur['purple'] = imagecolorallocate($this->img['general'], 255, 0, 255);
34
		// black
34
		// black
35
		$couleur['black'] = imagecolorallocate($this->img['general'], 0, 0, 0);
35
		$couleur['black'] = imagecolorallocate($this->img['general'], 0, 0, 0);
36
		return $couleur;
36
		return $couleur;
37
	}
37
	}
38
	
38
	
39
	public function initialiserImage() {
39
	public function initialiserImage() {
40
		// Nom du fichier image en sortie
40
		// Nom du fichier image en sortie
41
		$this->cheminCartesBase = Config::get('Cartes.chemin');
41
		$this->cheminCartesBase = Config::get('Cartes.chemin');
42
		$this->dest_map['general'] = 'nt'.$this->info['nt'].'_'.$this->info['src_map'];
42
		$this->dest_map['general'] = 'nt'.$this->info['nt'].'_'.$this->info['src_map'];
43
		$this->img['general'] = imagecreatefrompng($this->cheminCartesBase.$this->info['src_map']);
43
		$this->img['general'] = imagecreatefrompng($this->cheminCartesBase.$this->info['src_map']);
44
	}
44
	}
-
 
45
	
-
 
46
	public function testerParametresProjets() {
-
 
47
		$test = true;
-
 
48
		return $test;
45
	
49
	}
46
	
50
	
47
	public function chargerDonnees() {
51
	public function chargerDonnees() {
48
		// Recherche nom correspondant au numero nomenclatural en cours (pour etablir le lien avec les donnees moissonnes).
52
		// Recherche nom correspondant au numero nomenclatural en cours (pour etablir le lien avec les donnees moissonnes).
49
	
53
	
50
		// Récuperation donnée inventaire
54
		// Récuperation donnée inventaire
51
		/*
55
		/*
52
		* Les donnees issues du carnet en ligne sont recuperes directement, sans passer par le mecanisme de moissonage car :
56
		* Les donnees issues du carnet en ligne sont recuperes directement, sans passer par le mecanisme de moissonage car :
53
		*   - pour l'instant le service de moissonage n'est pas automatise et donc il y a un decalage dans l'affichage des donnees transmises
57
		*   - pour l'instant le service de moissonage n'est pas automatise et donc il y a un decalage dans l'affichage des donnees transmises
54
		*   - 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)
58
		*   - 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)
55
		*
59
		*
56
		* A terme, utilser vraiment le moissonage, y compris pour les donnees issues du CEL, en utilisant ABCD et en modifiant le programme d'harvesting.
60
		* A terme, utilser vraiment le moissonage, y compris pour les donnees issues du CEL, en utilisant ABCD et en modifiant le programme d'harvesting.
57
		*/
61
		*/
-
 
62
		if ($this->info['nt'] == 0) {
-
 
63
			$inventoriesCel = array();
-
 
64
		} else {
58
		$queryCel = "SELECT 'cel' as collection_code,  location, id_location, date_observation,  ".
65
			$queryCel = "SELECT 'cel' as collection_code,  location, id_location, date_observation,  ".
59
		"	coord_y as y_utm, coord_x as x_utm, ref_geo as sector, identifiant FROM tb_cel.cel_inventory ".
66
			"	coord_y as y_utm, coord_x as x_utm, ref_geo as sector, identifiant FROM tb_cel.cel_inventory ".
60
							"WHERE num_taxon = '".$this->info['nt']."' ".
67
								"WHERE num_taxon = '".$this->info['nt']."' ".
61
							"	AND transmission = 1";
68
								"	AND transmission = 1";
62
		$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
69
			$inventoriesCel = $this->getBdd()->recupererTous($queryCel);
-
 
70
		}
63
			
71
			
64
		// Recuperation des donnees de moissonage
72
		// Recuperation des donnees de moissonage
65
		// Collection code = 'flore' (Cenlr)
73
		// Collection code = 'flore' (Cenlr)
-
 
74
		if ($this->info['nom'] == '') {
-
 
75
			$inventoriesCenlr = array();
-
 
76
		} else {
66
		$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
77
			$queryCenlr = "SELECT collection_code, locality as location, county as id_location, ".
67
							"	STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ". 
78
								"	STR_TO_DATE(concat(year, '/',month, '/',day), '%Y/%m/%d') as date_observation, latitude as y_utm , ". 
68
					    	"	longitude as x_utm , max_altitude as sector,  collector_name as identifiant ".
79
						    	"	longitude as x_utm , max_altitude as sector,  collector_name as identifiant ".
69
							"FROM tb_hit_indexation.raw_occurrence_record ".
80
								"FROM tb_hit_indexation.raw_occurrence_record ".
70
							"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
81
								"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
71
							"	AND collection_code = 'flore' ".
82
								"	AND collection_code = 'flore' ".
72
							"	AND (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
83
								"	AND (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
73
		$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
84
			$inventoriesCenlr = $this->getBdd()->recupererTous($queryCenlr);
74
	
85
		}
75
	
86
	
76
		// Collection code = 'FLORE - VAR' (Cbnmed)
87
		// Collection code = 'FLORE - VAR' (Cbnmed)
77
		/*$queryCbnmed = "SELECT collection_code, locality as location, county as id_location, ".
88
		/*$queryCbnmed = "SELECT collection_code, locality as location, county as id_location, ".
78
							"	STR_TO_DATE(concat(ifnull(year,0),'/', ifnull(month,0), '/',ifnull(day,0)), '%Y/%m/%d') as date_observation, ".
89
							"	STR_TO_DATE(concat(ifnull(year,0),'/', ifnull(month,0), '/',ifnull(day,0)), '%Y/%m/%d') as date_observation, ".
79
							"	latitude as y_utm , longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
90
							"	latitude as y_utm , longitude as x_utm , max_altitude as sector, collector_name as identifiant ".
80
							"FROM tb_hit_indexation.raw_occurrence_record ".
91
							"FROM tb_hit_indexation.raw_occurrence_record ".
81
							"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
92
							"WHERE scientific_name = ".$this->getBdd()->proteger($this->info['nom']).
82
							"	AND collection_code='FLORE - VAR' ".
93
							"	AND collection_code='FLORE - VAR' ".
83
							"	AND  (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
94
							"	AND  (deleted IS NULL OR deleted = '0000-00-00 00:00:00')";
84
		$inventoriesCbnmed = $this->getBdd()->recupererTous($queryCbnmed);*/
95
		$inventoriesCbnmed = $this->getBdd()->recupererTous($queryCbnmed);*/
85
	
96
	
86
		// Collection code = 'sophy'
97
		// Collection code = 'sophy'
-
 
98
		if ($this->info['nom_ss_auteur'] == '') {
-
 
99
			$inventoriesSophy = array();
-
 
100
		} else {
87
		$querySophy = "SELECT 'sophy' as collection_code, lieu_station_nom as location, lieu_commune_code_insee as id_location, ".
101
			$querySophy = "SELECT 'sophy' as collection_code, lieu_station_nom as location, lieu_commune_code_insee as id_location, ".
88
								"	observation_date as date_observation, lieu_station_utm_est as x_utm , ". 
102
									"	observation_date as date_observation, lieu_station_utm_est as x_utm , ". 
89
						    	"	lieu_station_utm_nord as y_utm , lieu_station_utm_zone as sector,  observateur_nom_complet as identifiant ".
103
							    	"	lieu_station_utm_nord as y_utm , lieu_station_utm_zone as sector,  observateur_nom_complet as identifiant ".
90
								"FROM sophy_tapir ".
104
									"FROM sophy_tapir ".
91
								"WHERE nom_scientifique_complet = ".$this->getBdd()->proteger($this->info['nom_ss_auteur']);
105
									"WHERE nom_scientifique_complet = ".$this->getBdd()->proteger($this->info['nom_ss_auteur']);
92
		$inventoriesSophy = $this->getBdd()->recupererTous($querySophy);
106
			$inventoriesSophy = $this->getBdd()->recupererTous($querySophy);
-
 
107
		}
93
		
108
		
94
		return array_merge($inventoriesCel, $inventoriesCenlr, $inventoriesSophy); //$inventoriesCbnmed,
109
		return array_merge($inventoriesCel, $inventoriesCenlr, $inventoriesSophy); //$inventoriesCbnmed,
95
	}
110
	}
96
	
111
	
97
 
112
 
98
	public function dessinerPoint($text, $merge, $couleurs) {
113
	public function dessinerPoint($text, $merge, $couleurs) {
99
		$usemap['general'] = '';
114
		$usemap['general'] = '';
100
	
115
	
101
		foreach ($text as $coord => $origines ) {
116
		foreach ($text as $coord => $origines ) {
102
			foreach ($origines as $origine => $maptext ) {
117
			foreach ($origines as $origine => $maptext ) {
103
				$maptext = preg_replace("/\"/", "\'", $maptext);
118
				$maptext = preg_replace("/\"/", "\'", $maptext);
104
					
119
					
105
				list($x,$y) = explode('|', $coord);
120
				list($x,$y) = explode('|', $coord);
106
	
121
	
107
				$tpl_area = '<area shape="%s" alt="" class="tooltip" coords="%s" title="%s"/>';
122
				$tpl_area = '<area shape="%s" alt="" class="tooltip" coords="%s" title="%s"/>';
108
				$rayon = 2;
123
				$rayon = 2;
109
				$type = 'circle';
124
				$type = 'circle';
110
				$coords = "$x,$y,5";
125
				$coords = "$x,$y,5";
111
				$on_mouseover = "this.ttBgColor='#99C242';this.ttFontColor='#000000';this.T_OFFSETX=-200;this.T_OFFSETY=-50;this.T_STICKY=1;return escape('$maptext')";
126
				$on_mouseover = "this.ttBgColor='#99C242';this.ttFontColor='#000000';this.T_OFFSETX=-200;this.T_OFFSETY=-50;this.T_STICKY=1;return escape('$maptext')";
112
	
127
	
113
				if (isset($merge[$coord]) && $merge[$coord]) {
128
				if (isset($merge[$coord]) && $merge[$coord]) {
114
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['black']);
129
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['black']);
115
				} elseif (isset ($text[$coord]['cel']) && ($text[$coord]['cel'])) {
130
				} elseif (isset ($text[$coord]['cel']) && ($text[$coord]['cel'])) {
116
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['green']);
131
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['green']);
117
				} elseif (isset ($text[$coord]['flore']) && ($text[$coord]['flore'])) {
132
				} elseif (isset ($text[$coord]['flore']) && ($text[$coord]['flore'])) {
118
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['red']);
133
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['red']);
119
				}/* elseif (isset ($text[$coord]['FLORE - VAR']) && ($text[$coord]['FLORE - VAR'])) {
134
				}/* elseif (isset ($text[$coord]['FLORE - VAR']) && ($text[$coord]['FLORE - VAR'])) {
120
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['blue']);
135
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['blue']);
121
				}*/ elseif (isset ($text[$coord]['sophy']) && ($text[$coord]['sophy'])) {
136
				}*/ elseif (isset ($text[$coord]['sophy']) && ($text[$coord]['sophy'])) {
122
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['purple']);
137
					imagefilledrectangle($this->img['general'], ($x - $rayon), ($y - $rayon), ($x + $rayon), ($y + $rayon), $couleurs['purple']);
123
				}
138
				}
124
				$usemap['general'] = $usemap['general'].sprintf($tpl_area, $type, $coords, $maptext);
139
				$usemap['general'] = $usemap['general'].sprintf($tpl_area, $type, $coords, $maptext);
125
			}
140
			}
126
		}
141
		}
127
		return $usemap;
142
		return $usemap;
128
	}
143
	}
129
	
144
	
130
	public function formaterCartes($usemap) {
145
	public function formaterCartes($usemap) {
131
		$retour = Config::get('Cartes.cel_dst').$this->dest_map['general'];
146
		$retour = Config::get('Cartes.cel_dst').$this->dest_map['general'];
132
		if ($this->info['retour'] == self::MIME_MAP) {
147
		if ($this->info['retour'] == self::MIME_MAP) {
133
			$retour =  "<img src=\"".$retour."\" style=\"border:none; ".
148
			$retour =  "<img src=\"".$retour."\" style=\"border:none; ".
134
				"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
149
				"cursor:crosshair\" alt=\"\" usemap=\"#themap\" /><br />\n".
135
				"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['general'])."</map>";
150
				"<map name=\"themap\" id=\"themap\">".utf8_encode($usemap['general'])."</map>";
136
		}
151
		}
137
		return $retour;
152
		return $retour;
138
	}
153
	}
139
	
154
	
140
	//+----------------------------------------------------------------------------------------------------------------+
155
	//+----------------------------------------------------------------------------------------------------------------+
141
	// sous fonction de calculer répartition
156
	// sous fonction de calculer répartition
142
	public function chercherVille($inventory, $tab_code_insee = array()) {
157
	public function chercherVille($inventory, $tab_code_insee = array()) {
143
		$location_protege = $this->getBdd()->proteger($inventory['location']);
158
		$location_protege = $this->getBdd()->proteger($inventory['location']);
144
		$id_location_protege = '"'.$inventory['id_location'].'"';
159
		$id_location_protege = '"'.$inventory['id_location'].'"';
145
		$utm = array();
160
		$utm = array();
146
		if ($inventory['collection_code'] == 'FLORE - VAR') {
161
		if ($inventory['collection_code'] == 'FLORE - VAR') {
147
			if (isset($tab_code_insee[$location_protege])) {
162
			if (isset($tab_code_insee[$location_protege])) {
148
				$utm = array(0 => $tab_code_insee[$location_protege]);
163
				$utm = array(0 => $tab_code_insee[$location_protege]);
149
			}
164
			}
150
		} elseif ($inventory['collection_code'] == 'sophy') {
165
		} elseif ($inventory['collection_code'] == 'sophy') {
151
			if (strpos($inventory['id_location'], '20') === 0) {
166
			if (strpos($inventory['id_location'], '20') === 0) {
152
				$a = str_replace('20', '2A', $inventory['id_location']);
167
				$a = str_replace('20', '2A', $inventory['id_location']);
153
				if (isset($tab_code_insee[$a])) {
168
				if (isset($tab_code_insee[$a])) {
154
					$utm = array(0 => $tab_code_insee[$a]);
169
					$utm = array(0 => $tab_code_insee[$a]);
155
				} else {
170
				} else {
156
					$b = str_replace('20', '2B', $inventory['id_location']);
171
					$b = str_replace('20', '2B', $inventory['id_location']);
157
					if (isset($tab_code_insee[$b])) {
172
					if (isset($tab_code_insee[$b])) {
158
						$utm = array(0 => $tab_code_insee[$b]);
173
						$utm = array(0 => $tab_code_insee[$b]);
159
					}
174
					}
160
				}
175
				}
161
			} elseif (isset($tab_code_insee[$inventory['id_location']])) {
176
			} elseif (isset($tab_code_insee[$inventory['id_location']])) {
162
				$utm = array(0 => $tab_code_insee[$inventory['id_location']]);
177
				$utm = array(0 => $tab_code_insee[$inventory['id_location']]);
163
			} elseif (strpos($inventory['id_location'], '000') === 2) {
178
			} elseif (strpos($inventory['id_location'], '000') === 2) {
164
				$code = $this->getBdd()->proteger(str_replace('000', '', $inventory['id_location']));
179
				$code = $this->getBdd()->proteger(str_replace('000', '', $inventory['id_location']));
165
				$requete = "SELECT chef_lieu ".
180
				$requete = "SELECT chef_lieu ".
166
							"FROM tb_eflore.insee_d_v2011 ".
181
							"FROM tb_eflore.insee_d_v2011 ".
167
							"WHERE dep = $code ";
182
							"WHERE dep = $code ";
168
				$resultat = $this->getBdd()->recupererTous($requete);
183
				$resultat = $this->getBdd()->recupererTous($requete);
169
				if ($resultat != array() && isset($tab_code_insee[$resultat[0]['chef_lieu']])) {
184
				if ($resultat != array() && isset($tab_code_insee[$resultat[0]['chef_lieu']])) {
170
					$utm = $tab_code_insee[$resultat[0]['chef_lieu']];
185
					$utm = $tab_code_insee[$resultat[0]['chef_lieu']];
171
				}
186
				}
172
			}
187
			}
173
		} else {
188
		} else {
174
			if ($inventory['id_location'] != 'null') {
189
			if ($inventory['id_location'] != 'null') {
175
				if (isset($tab_code_insee[$id_location_protege])) {
190
				if (isset($tab_code_insee[$id_location_protege])) {
176
					$utm = array(0 => $tab_code_insee[$id_location_protege]);
191
					$utm = array(0 => $tab_code_insee[$id_location_protege]);
177
				} else {
192
				} else {
178
					$requete = "SELECT * ".
193
					$requete = "SELECT * ".
179
										"FROM tb_cel.locations ".
194
										"FROM tb_cel.locations ".
180
										"WHERE name LIKE $location_protege ".
195
										"WHERE name LIKE $location_protege ".
181
										"	AND code = $id_location_protege ";
196
										"	AND code = $id_location_protege ";
182
					$resultat = $this->getBdd()->recupererTous($requete);
197
					$resultat = $this->getBdd()->recupererTous($requete);
183
					$utm = $resultat;
198
					$utm = $resultat;
184
				}
199
				}
185
			} else {
200
			} else {
186
				$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE $location_protege ";
201
				$requete = "SELECT * FROM tb_cel.locations WHERE name LIKE $location_protege ";
187
				$utm = $this->getBdd()->recupererTous($requete);
202
				$utm = $this->getBdd()->recupererTous($requete);
188
			}
203
			}
189
		}
204
		}
190
		return $utm;
205
		return $utm;
191
	}
206
	}
192
 
207
 
193
	public function formerCommentaire($utm, $inventory) {
208
	public function formerCommentaire($utm, $inventory) {
194
		$comment = '';
209
		$comment = '';
195
			
210
			
196
		if ($inventory['date_observation'] != '0000-00-00 00:00:00') {
211
		if ($inventory['date_observation'] != '0000-00-00 00:00:00') {
197
			$comment .= $this->formerDate($inventory);
212
			$comment .= $this->formerDate($inventory);
198
		}
213
		}
199
			
214
			
200
		if ($inventory['collection_code'] == 'cel') {
215
		if ($inventory['collection_code'] == 'cel') {
201
			list($identifiant) = explode("@", $inventory['identifiant']);
216
			list($identifiant) = explode("@", $inventory['identifiant']);
202
			$comment .= " par ".$identifiant."@...";
217
			$comment .= " par ".$identifiant."@...";
203
		} else {
218
		} else {
204
			$comment .= " par ".utf8_decode($inventory['identifiant']);
219
			$comment .= " par ".utf8_decode($inventory['identifiant']);
205
		}
220
		}
206
		return $comment;
221
		return $comment;
207
	}
222
	}
208
	
223
	
209
	public function formerDate($inventory) {
224
	public function formerDate($inventory) {
210
		if ($inventory['collection_code'] == 'sophy') {
225
		if ($inventory['collection_code'] == 'sophy') {
211
			$date = ', en '.$inventory['date_observation'];
226
			$date = ', en '.$inventory['date_observation'];
212
		} else {
227
		} else {
213
			list($year, $month, $day) = explode ('-',$inventory['date_observation']);
228
			list($year, $month, $day) = explode ('-',$inventory['date_observation']);
214
			list($day) = explode (' ',$day);
229
			list($day) = explode (' ',$day);
215
			if ($month == '00') {
230
			if ($month == '00') {
216
				$date = ', en '.$year;
231
				$date = ', en '.$year;
217
			} else {
232
			} else {
218
				$date = ', le '.$day.'/'.$month.'/'.$year;
233
				$date = ', le '.$day.'/'.$month.'/'.$year;
219
			}
234
			}
220
		}
235
		}
221
		return $date;
236
		return $date;
222
	}
237
	}
223
	/*
238
	/*
224
	 * Stockage commentaire associe a un point :
239
	 * Stockage commentaire associe a un point :
225
	 * 
240
	 * 
226
	 * Param : 
241
	 * Param : 
227
	 * @text : texte cumule
242
	 * @text : texte cumule
228
	 * @merge : indicateur de commentaire fusionne
243
	 * @merge : indicateur de commentaire fusionne
229
	 * @name : commune associee
244
	 * @name : commune associee
230
	 * @comment : commentaire
245
	 * @comment : commentaire
231
	 * @origine : origine de la donnee
246
	 * @origine : origine de la donnee
232
	 * 
247
	 * 
233
	 * 
248
	 * 
234
	 * TODO : rendre cette fonction independante des valeurs d'origine passee en parametre
249
	 * TODO : rendre cette fonction independante des valeurs d'origine passee en parametre
235
	 */
250
	 */
236
	public function stockerCommentaire($text, $merge, $name, $comment, $origine, $x, $y) {
251
	public function stockerCommentaire($text, $merge, $name, $comment, $origine, $x, $y) {
237
		if ($origine == 'cel') {
252
		if ($origine == 'cel') {
238
			$prefix = 'CEL : ';
253
			$prefix = 'CEL : ';
239
		} elseif ($origine == 'flore') {
254
		} elseif ($origine == 'flore') {
240
			$prefix = 'CEN LR : ';
255
			$prefix = 'CEN LR : ';
241
		} /*elseif ($origine == 'FLORE - VAR') {
256
		} /*elseif ($origine == 'FLORE - VAR') {
242
			$prefix = 'CBN MED : ';
257
			$prefix = 'CBN MED : ';
243
		}*/ elseif ($origine == 'sophy') {
258
		}*/ elseif ($origine == 'sophy') {
244
			$prefix = 'SOPHY : ';
259
			$prefix = 'SOPHY : ';
245
		}
260
		}
246
		
261
		
247
		// Cumul toute origine :   
262
		// Cumul toute origine :   
248
		if (isset($text[$x.'|'.$y]['tout']) && ($text[$x.'|'.$y])) {
263
		if (isset($text[$x.'|'.$y]['tout']) && ($text[$x.'|'.$y])) {
249
			$text[$x.'|'.$y]['tout'] = $text[$x.'|'.$y]['tout'].'<br>'.$prefix.$name.$comment;
264
			$text[$x.'|'.$y]['tout'] = $text[$x.'|'.$y]['tout'].'<br>'.$prefix.$name.$comment;
250
		} else {
265
		} else {
251
			// Nouveau commentaire
266
			// Nouveau commentaire
252
			$text[$x.'|'.$y]['tout']=$prefix.$name.$comment;
267
			$text[$x.'|'.$y]['tout']=$prefix.$name.$comment;
253
		}
268
		}
254
		 
269
		 
255
		// Deja present  pour cette origine ? on ajoute  
270
		// Deja present  pour cette origine ? on ajoute  
256
		if (isset ($text[$x.'|'.$y][$origine]) && ($text[$x.'|'.$y][$origine])) {
271
		if (isset ($text[$x.'|'.$y][$origine]) && ($text[$x.'|'.$y][$origine])) {
257
			$text[$x.'|'.$y][$origine] = $text[$x.'|'.$y][$origine].'<br>'.$name.$comment;
272
			$text[$x.'|'.$y][$origine] = $text[$x.'|'.$y][$origine].'<br>'.$name.$comment;
258
		} else { // Nouveau commentaire
273
		} else { // Nouveau commentaire
259
			$text[$x.'|'.$y][$origine] = $name.$comment;
274
			$text[$x.'|'.$y][$origine] = $name.$comment;
260
		}
275
		}
261
		
276
		
262
		
277
		
263
		// Detection superposition de donnee 
278
		// Detection superposition de donnee 
264
		if ($origine == 'cel') {
279
		if ($origine == 'cel') {
265
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])) 
280
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])) 
266
			|| (isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
281
			|| (isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
267
				$merge[$x.'|'.$y]=true;
282
				$merge[$x.'|'.$y]=true;
268
			}
283
			}
269
		} elseif ($origine == 'flore') {
284
		} elseif ($origine == 'flore') {
270
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) ||(isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
285
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) ||(isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
271
			(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
286
			(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR']))) {
272
				$merge[$x.'|'.$y]=true;
287
				$merge[$x.'|'.$y]=true;
273
			}
288
			}
274
		} elseif ($origine == 'FLORE - VAR') {
289
		} elseif ($origine == 'FLORE - VAR') {
275
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
290
			if ((isset ($text[$x.'|'.$y]['sophy']) && ($text[$x.'|'.$y]['sophy'])) || (isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || 
276
			(isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore']))) {
291
			(isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore']))) {
277
				$merge[$x.'|'.$y]=true;
292
				$merge[$x.'|'.$y]=true;
278
			}					
293
			}					
279
		} elseif ($origine == 'sophy') {
294
		} elseif ($origine == 'sophy') {
280
			if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])|| 
295
			if ((isset ($text[$x.'|'.$y]['cel']) && ($text[$x.'|'.$y]['cel'])) || (isset ($text[$x.'|'.$y]['flore']) && ($text[$x.'|'.$y]['flore'])|| 
281
				(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
296
				(isset ($text[$x.'|'.$y]['FLORE - VAR']) && ($text[$x.'|'.$y]['FLORE - VAR'])))) {
282
				$merge[$x.'|'.$y]=true;
297
				$merge[$x.'|'.$y]=true;
283
			}					
298
			}					
284
		}
299
		}
285
		
300
		
286
		return array($text, $merge);
301
		return array($text, $merge);
287
	}
302
	}
288
}
303
}
289
?>
304
?>