Subversion Repositories eFlore/Applications.cel

Rev

Rev 3147 | Rev 3468 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3147 Rev 3467
Line 136... Line 136...
136
		$colonnes = array();
136
		$colonnes = array();
137
		if (isset($groupe_de_champs['standardexport'])) { 
137
		if (isset($groupe_de_champs['standardexport'])) { 
138
			$colonnes += Array(
138
			$colonnes += Array(
139
				'guid'			=> self::GenColInfo(Array('abbrev' => 'guid',
139
				'guid'			=> self::GenColInfo(Array('abbrev' => 'guid',
140
																'nom' => 'Identifiant unique')),
140
																'nom' => 'Identifiant unique')),
-
 
141
			    'id_observation'	=> self::GenColInfo(Array('abbrev' => 'id_observation',
-
 
142
                                            			        'nom' => 'Identifiant',
-
 
143
                                            			        'extra' => 1,
-
 
144
                                            			        'importable' => FALSE)),
141
				'nom_sel'			=> self::GenColInfo(Array('abbrev' => 'nom_sel',
145
				'nom_sel'			=> self::GenColInfo(Array('abbrev' => 'nom_sel',
142
															  'nom' => 'Espèce')),
146
															  'nom' => 'Espèce')),
143
				'nom_sel_nn'		=> self::GenColInfo(Array('abbrev' => 'nom_sel_nn',
147
				'nom_sel_nn'		=> self::GenColInfo(Array('abbrev' => 'nom_sel_nn',
144
															  'nom' => 'Numéro nomenclatural',
148
															  'nom' => 'Numéro nomenclatural',
145
															  'importable' => FALSE)),
149
															  'importable' => FALSE)),
Line 155... Line 159...
155
				'famille'			=> self::GenColInfo(Array('abbrev' => 'famille',
159
				'famille'			=> self::GenColInfo(Array('abbrev' => 'famille',
156
															  'nom' => 'Famille',
160
															  'nom' => 'Famille',
157
															  'importable' => FALSE)),
161
															  'importable' => FALSE)),
158
				'nom_referentiel'	=> self::GenColInfo(Array('abbrev' => 'nom_referentiel',
162
				'nom_referentiel'	=> self::GenColInfo(Array('abbrev' => 'nom_referentiel',
159
															  'nom' => 'Referentiel taxonomique')),
163
															  'nom' => 'Referentiel taxonomique')),
-
 
164
			    'certitude'			=> self::GenColInfo(Array('abbrev' => 'certitude',
-
 
165
			                                                 'nom' => 'Certitude')),
-
 
166
			    'type_donnees'		=> self::GenColInfo(Array('abbrev' => 'type_donnees',
-
 
167
			                                                 'nom' => 'Type d\'observation')),
-
 
168
			    'source'			=> self::GenColInfo(Array('abbrev' => 'source',
-
 
169
			                                                 'nom' => 'Source de la saisie')),
-
 
170
			    'spontaneite'			=> self::GenColInfo(Array('abbrev' => 'spontaneite',
-
 
171
			                                                 'nom' => 'Spontanéité')),
-
 
172
			    'latitude'			=> self::GenColInfo(Array('abbrev' => 'latitude',
-
 
173
			        'nom' => 'Latitude',
-
 
174
			        'extra' => 1)),
-
 
175
			    'longitude'			=> self::GenColInfo(Array('abbrev' => 'longitude',
-
 
176
			        'nom' => 'Longitude',
-
 
177
			        'extra' => 1)),
-
 
178
 
-
 
179
			    'geodatum'			=> self::GenColInfo(Array('abbrev' => 'geodatum',
-
 
180
			        'nom' => 'Référentiel Géographique',
-
 
181
			        'extra' => 1,
-
 
182
			        'importable' => FALSE)),
-
 
183
			    
160
				'pays'				=> self::GenColInfo(Array('abbrev' => 'pays',
184
			    'pays'				=> self::GenColInfo(Array('abbrev' => 'pays',
161
															  'nom' => 'Pays')),
185
															  'nom' => 'Pays')),
162
				'zone_geo'			=> self::GenColInfo(Array('abbrev' => 'zone_geo',
186
				'zone_geo'			=> self::GenColInfo(Array('abbrev' => 'zone_geo',
163
															  'nom' => 'Commune')),
187
															  'nom' => 'Commune')),
164
				'ce_zone_geo'		=> self::GenColInfo(Array('abbrev' => 'ce_zone_geo',
188
				'ce_zone_geo'		=> self::GenColInfo(Array('abbrev' => 'ce_zone_geo',
165
															  'nom' => 'Identifiant Commune',
189
															  'nom' => 'Identifiant Commune')),
166
															  'fonction' => 'convertirCodeZoneGeoVersDepartement')),
190
			    'localisation_floutage'	=> self::GenColInfo(Array('abbrev' => 'localisation_floutage',
-
 
191
			                                                 'nom' => 'Floutage (niveau de localisation diffusé)')),
167
				'date_observation'	=> self::GenColInfo(Array('abbrev' => 'date_observation',
192
			    'altitude'			=> self::GenColInfo(Array('abbrev' => 'altitude',
168
															  'nom' => 'Date',
193
                                        			        'nom' => 'Altitude',
169
															  'fonction' => 'formaterDate')),
194
                                        			        'extra' => 1)), // pas de trim0 car INT(5) en DB
170
				'lieudit'			=> self::GenColInfo(Array('abbrev' => 'lieudit',
195
			    'lieudit'			=> self::GenColInfo(Array('abbrev' => 'lieudit',
171
															  'nom' => 'Lieu-dit')),
196
															  'nom' => 'Lieu-dit')),
172
				'station'			=> self::GenColInfo(Array('abbrev' => 'station',
-
 
173
															  'nom' => 'Station')),
-
 
174
				'milieu'			=> self::GenColInfo(Array('abbrev' => 'milieu',
197
				'milieu'			=> self::GenColInfo(Array('abbrev' => 'milieu',
175
															  'nom' => 'Milieu')),
198
															  'nom' => 'Milieu')),
-
 
199
			    'date_observation'	=> self::GenColInfo(Array('abbrev' => 'date_observation',
-
 
200
			                                                 'nom' => 'Date',
-
 
201
			                                                 'fonction' => 'formaterDate')),
176
				'commentaire'		=> self::GenColInfo(Array('abbrev' => 'commentaire',
202
			    'commentaire'		=> self::GenColInfo(Array('abbrev' => 'commentaire',
177
															  'nom' => 'Notes')),
203
															  'nom' => 'Notes')),
178
				'latitude'			=> self::GenColInfo(Array('abbrev' => 'latitude',
-
 
179
															  'nom' => 'Latitude',
-
 
180
															  'extra' => 1,
-
 
181
															  'fonction' => 'trim0')),
-
 
182
				'longitude'			=> self::GenColInfo(Array('abbrev' => 'longitude',
-
 
183
															  'nom' => 'Longitude',
-
 
184
															  'extra' => 1,
-
 
185
															  'fonction' => 'trim0')),
-
 
186
				'altitude'			=> self::GenColInfo(Array('abbrev' => 'altitude',
-
 
187
															  'nom' => 'Altitude',
-
 
188
															  'extra' => 1)), // pas de trim0 car INT(5) en DB
-
 
189
				'geodatum'			=> self::GenColInfo(Array('abbrev' => 'geodatum',
-
 
190
															  'nom' => 'Référentiel Géographique',
-
 
191
															  'extra' => 1,
-
 
192
															  'importable' => FALSE)),
-
 
193
				'programme'			=> self::GenColInfo(Array('abbrev' => 'programme',
204
				'programme'			=> self::GenColInfo(Array('abbrev' => 'programme',
194
																'nom' => 'Programme de sciences participatives ou observatoire citoyen',
205
																'nom' => 'Programme de sciences participatives ou observatoire citoyen',
195
																'importable' => FALSE)),
206
																'importable' => FALSE)),
196
				'mots_cles_texte'	=> self::GenColInfo(Array('abbrev' => 'mots_cles_texte',
207
				'mots_cles_texte'	=> self::GenColInfo(Array('abbrev' => 'mots_cles_texte',
197
																'nom' => 'Mots Clés',
208
																'nom' => 'Mots Clés',
198
																'importable' => FALSE)),
209
																'importable' => FALSE)),
199
				'certitude'			=> self::GenColInfo(Array('abbrev' => 'certitude',
-
 
200
															'nom' => 'Certitude',
-
 
201
															'extra' => 1)),
-
 
202
				'image'			=> self::GenColInfo(Array('abbrev' => 'image',
-
 
203
															'nom' => 'Image(s)',
-
 
204
															'extra' => 1)),
-
 
205
				'validation_identiplante'			=> self::GenColInfo(Array('abbrev' => 'validation_identiplante',
-
 
206
															'nom' => 'Détermination validée sur IdentiPlante',
-
 
207
															'importable' => FALSE)),
-
 
208
				'url_identiplante'			=> self::GenColInfo(Array('abbrev' => 'url_identiplante',
210
				'url_identiplante'			=> self::GenColInfo(Array('abbrev' => 'url_identiplante',
209
															'nom' => "Lien vers l'observation sur IdentiPlante",
211
															'nom' => "Lien vers l'observation sur IdentiPlante",
210
															'importable' => FALSE)),
212
															'importable' => FALSE)),
-
 
213
			    'image'			=> self::GenColInfo(Array('abbrev' => 'image',
-
 
214
			        'nom' => 'Image(s)',
-
 
215
			        'extra' => 1)),
-
 
216
			    
211
			);
217
			    );
212
		} elseif (isset($groupe_de_champs['standard'])) {
218
		} elseif (isset($groupe_de_champs['standard'])) {
213
			$colonnes += Array(
219
			$colonnes += Array(
-
 
220
			    'guid'			=> self::GenColInfo(Array('abbrev' => 'guid',
-
 
221
			        'nom' => 'Identifiant unique')),
-
 
222
			    'id_observation'	=> self::GenColInfo(Array('abbrev' => 'id_observation',
-
 
223
			        'nom' => 'Identifiant',
-
 
224
			        'extra' => 1,
-
 
225
			        'importable' => FALSE)),
214
					'nom_sel'			=> self::GenColInfo(Array('abbrev' => 'nom_sel',
226
			    'nom_sel'			=> self::GenColInfo(Array('abbrev' => 'nom_sel',
215
							'nom' => 'Espèce')),
227
			        'nom' => 'Espèce')),
216
					'nom_sel_nn'		=> self::GenColInfo(Array('abbrev' => 'nom_sel_nn',
228
			    'nom_sel_nn'		=> self::GenColInfo(Array('abbrev' => 'nom_sel_nn',
217
							'nom' => 'Numéro nomenclatural',
229
			        'nom' => 'Numéro nomenclatural',
218
							'importable' => FALSE)),
230
			        'importable' => FALSE)),
219
					'nom_ret'			=> self::GenColInfo(Array('abbrev' => 'nom_ret',
231
			    'nom_ret'			=> self::GenColInfo(Array('abbrev' => 'nom_ret',
220
							'nom' => 'Nom retenu',
232
			        'nom' => 'Nom retenu',
221
							'importable' => FALSE)),
233
			        'importable' => FALSE)),
222
					'nom_ret_nn'		=> self::GenColInfo(Array('abbrev' => 'nom_ret_nn',
234
			    'nom_ret_nn'		=> self::GenColInfo(Array('abbrev' => 'nom_ret_nn',
223
							'nom' => 'Numéro nomenclatural nom retenu',
235
			        'nom' => 'Numéro nomenclatural nom retenu',
224
							'importable' => FALSE)),
236
			        'importable' => FALSE)),
225
					'nt'				=> self::GenColInfo(Array('abbrev' => 'nt',
237
			    'nt'				=> self::GenColInfo(Array('abbrev' => 'nt',
226
							'nom' => 'Numéro taxonomique',
238
			        'nom' => 'Numéro taxonomique',
227
							'importable' => FALSE)),
239
			        'importable' => FALSE)),
228
					'famille'			=> self::GenColInfo(Array('abbrev' => 'famille',
240
			    'famille'			=> self::GenColInfo(Array('abbrev' => 'famille',
229
							'nom' => 'Famille',
241
			        'nom' => 'Famille',
230
							'importable' => FALSE)),
242
			        'importable' => FALSE)),
231
					'nom_referentiel'	=> self::GenColInfo(Array('abbrev' => 'nom_referentiel',
243
			    'nom_referentiel'	=> self::GenColInfo(Array('abbrev' => 'nom_referentiel',
232
							'nom' => 'Referentiel taxonomique')),
244
			        'nom' => 'Referentiel taxonomique')),
233
					'pays'				=> self::GenColInfo(Array('abbrev' => 'pays',
245
			    'certitude'			=> self::GenColInfo(Array('abbrev' => 'certitude',
234
							'nom' => 'Pays')),
246
			        'nom' => 'Certitude')),
235
					'zone_geo'			=> self::GenColInfo(Array('abbrev' => 'zone_geo',
247
			    'type_donnees'		=> self::GenColInfo(Array('abbrev' => 'type_donnees',
236
							'nom' => 'Commune')),
248
			        'nom' => 'Type d\'observation')),
237
					'ce_zone_geo'		=> self::GenColInfo(Array('abbrev' => 'ce_zone_geo',
249
			    'source'			=> self::GenColInfo(Array('abbrev' => 'source',
238
							'nom' => 'Identifiant Commune',
250
			        'nom' => 'Source de la saisie')),
239
							'fonction' => 'convertirCodeZoneGeoVersDepartement')),
251
			    'spontaneite'			=> self::GenColInfo(Array('abbrev' => 'spontaneite',
-
 
252
			        'nom' => 'Spontanéité')),
240
					'date_observation'	=> self::GenColInfo(Array('abbrev' => 'date_observation',
253
			    'latitude'			=> self::GenColInfo(Array('abbrev' => 'latitude',
241
							'nom' => 'Date',
254
			        'nom' => 'Latitude',
242
							'fonction' => 'formaterDate')),
255
			        'extra' => 1)),
243
					'lieudit'			=> self::GenColInfo(Array('abbrev' => 'lieudit',
256
			    'longitude'			=> self::GenColInfo(Array('abbrev' => 'longitude',
244
							'nom' => 'Lieu-dit')),
257
			        'nom' => 'Longitude',
-
 
258
			        'extra' => 1)),
-
 
259
			    
-
 
260
			    'geodatum'			=> self::GenColInfo(Array('abbrev' => 'geodatum',
-
 
261
			        'nom' => 'Référentiel Géographique',
-
 
262
			        'extra' => 1,
-
 
263
			        'importable' => FALSE)),
-
 
264
			    
245
					'station'			=> self::GenColInfo(Array('abbrev' => 'station',
265
			    'pays'				=> self::GenColInfo(Array('abbrev' => 'pays',
246
							'nom' => 'Station')),
266
			        'nom' => 'Pays')),
247
					'milieu'			=> self::GenColInfo(Array('abbrev' => 'milieu',
267
			    'zone_geo'			=> self::GenColInfo(Array('abbrev' => 'zone_geo',
248
							'nom' => 'Milieu')),
268
			        'nom' => 'Commune')),
249
					'commentaire'		=> self::GenColInfo(Array('abbrev' => 'commentaire',
269
			    'ce_zone_geo'		=> self::GenColInfo(Array('abbrev' => 'ce_zone_geo',
250
							'nom' => 'Notes')),
270
			        'nom' => 'Identifiant Commune')),
-
 
271
			    'localisation_floutage'	=> self::GenColInfo(Array('abbrev' => 'localisation_floutage',
-
 
272
			        'nom' => 'Floutage (niveau de localisation diffusé)')),
251
					'latitude'			=> self::GenColInfo(Array('abbrev' => 'latitude',
273
			    'altitude'			=> self::GenColInfo(Array('abbrev' => 'altitude',
252
							'nom' => 'Latitude',
274
			        'nom' => 'Altitude',
253
							'extra' => 1,
275
			        'extra' => 1)), // pas de trim0 car INT(5) en DB
-
 
276
			    'lieudit'			=> self::GenColInfo(Array('abbrev' => 'lieudit',
254
							'fonction' => 'trim0')),
277
			        'nom' => 'Lieu-dit')),
255
					'longitude'			=> self::GenColInfo(Array('abbrev' => 'longitude',
278
			    'milieu'			=> self::GenColInfo(Array('abbrev' => 'milieu',
256
							'nom' => 'Longitude',
279
			        'nom' => 'Milieu')),
-
 
280
			    'date_observation'	=> self::GenColInfo(Array('abbrev' => 'date_observation',
257
							'extra' => 1,
281
			        'nom' => 'Date',
258
							'fonction' => 'trim0')),
282
			        'fonction' => 'formaterDate')),
259
					'altitude'			=> self::GenColInfo(Array('abbrev' => 'altitude',
283
			    'commentaire'		=> self::GenColInfo(Array('abbrev' => 'commentaire',
260
							'nom' => 'Altitude',
284
			        'nom' => 'Notes')),
261
							'extra' => 1)), // pas de trim0 car INT(5) en DB
285
			    'programme'			=> self::GenColInfo(Array('abbrev' => 'programme',
-
 
286
			        'nom' => 'Programme de sciences participatives ou observatoire citoyen',
-
 
287
			        'importable' => FALSE)),
-
 
288
			    'mots_cles_texte'	=> self::GenColInfo(Array('abbrev' => 'mots_cles_texte',
-
 
289
			        'nom' => 'Mots Clés',
-
 
290
			        'importable' => FALSE)),
-
 
291
			    
262
					'geodatum'			=> self::GenColInfo(Array('abbrev' => 'geodatum',
292
			    'image'			=> self::GenColInfo(Array('abbrev' => 'image',
263
							'nom' => 'Référentiel Géographique',
293
			        'nom' => 'Image(s)',
264
							'extra' => 1,
294
			        'extra' => 1)),
-
 
295
			    'url_identiplante'			=> self::GenColInfo(Array('abbrev' => 'url_identiplante',
-
 
296
			        'nom' => "Lien vers l'observation sur IdentiPlante",
265
							'importable' => FALSE)),
297
			        'importable' => FALSE)),
-
 
298
			    
266
					);
299
					);
267
		}
300
		}
Line 268... Line 301...
268
 
301
 
269
		if(isset($groupe_de_champs['avance'])) {
302
		if(isset($groupe_de_champs['avance'])) {
-
 
303
			$colonnes += array(
-
 
304
			    'localisation_coherence' => self::GenColInfo(Array('abbrev' => 'localisation_coherence',
-
 
305
			        'nom' => 'Cohérence entre la localité et les coordonnées GPS')),
-
 
306
			    'localisation_precision' => self::GenColInfo(Array('abbrev' => 'localisation_precision',
-
 
307
			        'nom' => 'Précision de la localisation')),
-
 
308
			    'station'			=> self::GenColInfo(Array('abbrev' => 'station',
-
 
309
			        'nom' => 'Station')),
-
 
310
			    'validation_identiplante'			=> self::GenColInfo(Array('abbrev' => 'validation_identiplante',
-
 
311
			        'nom' => 'Détermination validée sur IdentiPlante',
-
 
312
			        'importable' => FALSE)),
-
 
313
			    'score_identiplante'			=> self::GenColInfo(Array('abbrev' => 'score_identiplante',
-
 
314
			        'nom' => 'Détermination validée sur IdentiPlante',
-
 
315
			        'importable' => FALSE)),
-
 
316
			    'abondance'			=> self::GenColInfo(Array('abbrev' => 'abondance',
-
 
317
			        'nom' => 'Abondance',
-
 
318
			        'extra' => 1)),
-
 
319
			    'phenologie'		=> self::GenColInfo(Array('abbrev' => 'phenologie',
-
 
320
			        'nom' => 'Phénologie',
-
 
321
			        'extra' => 1)),
-
 
322
			    'herbier'			=> self::GenColInfo(Array('abbrev' => 'herbier',
-
 
323
			        'nom' => 'Présence d\'un échantillon d\'herbier',
-
 
324
			        'extra' => 1)),
270
			$colonnes += array(
325
				
271
				// TODO: importable = FALSE car pas de merge de données importées
-
 
272
				'ordre'				=> self::GenColInfo(Array('abbrev' => 'ordre',
-
 
273
															  'nom' => 'Ordre',
-
 
274
															  'extra' => 1,
-
 
275
															  'importable' => FALSE)),
-
 
276
				'id_observation'	=> self::GenColInfo(Array('abbrev' => 'id_observation',
-
 
277
															  'nom' => 'Identifiant',
-
 
278
															  'extra' => 1,
-
 
279
															  'importable' => FALSE)),
-
 
280
 
-
 
281
				'mots_cles_texte'	=> self::GenColInfo(Array('abbrev' => 'mots_cles_texte',
-
 
282
															  'nom' => 'Mots Clés',
-
 
283
															  'extra' => 1)),
326
				// TODO: importable = FALSE car pas de merge de données importées
284
				'date_creation'		=> self::GenColInfo(Array('abbrev' => 'date_creation',
327
				'date_creation'		=> self::GenColInfo(Array('abbrev' => 'date_creation',
285
															  'nom' => 'Date Création',
328
															  'nom' => 'Date Création',
286
															  'extra' => 1,
329
															  'extra' => 1,
287
															  'importable' => FALSE)),
330
															  'importable' => FALSE)),
Line 299... Line 342...
299
															  'fonction' => 'boolOuiNon')),
342
															  'fonction' => 'boolOuiNon')),
300
				'date_transmission'	=> self::GenColInfo(Array('abbrev' => 'date_transmission',
343
				'date_transmission'	=> self::GenColInfo(Array('abbrev' => 'date_transmission',
301
															  'nom' => 'Date Transmission',
344
															  'nom' => 'Date Transmission',
302
															  'extra' => 1,
345
															  'extra' => 1,
303
															  'importable' => FALSE)),
346
															  'importable' => FALSE)),
304
				'abondance'			=> self::GenColInfo(Array('abbrev' => 'abondance',
-
 
305
															  'nom' => 'Abondance',
-
 
306
															  'extra' => 1)),
-
 
307
				'certitude'			=> self::GenColInfo(Array('abbrev' => 'certitude',
-
 
308
															  'nom' => 'Certitude',
-
 
309
															  'extra' => 1)),
-
 
310
				'phenologie'		=> self::GenColInfo(Array('abbrev' => 'phenologie',
-
 
311
															  'nom' => 'Phénologie',
-
 
312
															  'extra' => 1)),
-
 
313
 
347
 
314
				// XXX: getImages() dépend du contexte de Cel, et doit être appelée comme cas particulier
-
 
315
				// cf ExportXLS::traiterLigneObservation()
-
 
316
				'images'			=> self::GenColInfo(Array('abbrev' => 'images',
-
 
317
															  'nom' => 'Image(s)',
-
 
318
															  'extra' => 1,
-
 
319
															  'fonction_data' => NULL /* cas particulier 'getImages' */,
-
 
320
															  'importable' => TRUE,
-
 
321
															  //'preload' => array(__CLASS__, 'getImages_preload')//TODO
-
 
322
				)),
-
 
Line 323... Line 348...
323
 
348
 
324
				/* 'nom_commun'			=> self::GenColInfo(Array('abbrev' => 'nom_commun',
349
				/* 'nom_commun'			=> self::GenColInfo(Array('abbrev' => 'nom_commun',
325
				   'nom' => 'Nom Commun',
350
				   'nom' => 'Nom Commun',
326
				   'extra' => 1,
351
				   'extra' => 1,
Line 334... Line 359...
334
 
359
 
335
				   'nom-commun'			=> self::GenColInfo(Array('abbrev' => 'nom-commun',
360
				   'nom-commun'			=> self::GenColInfo(Array('abbrev' => 'nom-commun',
336
				   'nom' => 'Nom Commun',
361
				   'nom' => 'Nom Commun',
337
				   'extra' => 1,
362
				   'extra' => 1,
338
				   'fonction_data' => 'getNomCommun_v3'),
363
				   'fonction_data' => 'getNomCommun_v3'),
339
				   'importable' => FALSE), */
364
				   'importable' => FALSE), */ /* cas particu 'getNomCommun_v4' */
340
				'nom-commun' => self::GenColInfo(array(
365
				/*'nom-commun' => self::GenColInfo(array(
341
					'abbrev' => 'nom-commun',
366
					'abbrev' => 'nom-commun',
342
					'nom' => 'Nom Commun',
367
					'nom' => 'Nom Commun',
343
					'extra' => 1,
368
					'extra' => 1,
344
					'fonction_data' => null /* cas particu 'getNomCommun_v4' */,
369
					'fonction_data' => null ,
345
					'preload' => array(__CLASS__, 'getNomCommun_preload')))
370
					'preload' => array(__CLASS__, 'getNomCommun_preload')))*/
346
			);
371
			);
Line 347... Line 372...
347
		}
372
		}
348
 
373
 
Line 373... Line 398...
373
		}
398
		}
Line 374... Line 399...
374
 
399
 
375
		if (isset($groupe_de_champs['auteur'])) {
400
		if (isset($groupe_de_champs['auteur'])) {
376
			$colonnes += array(
401
			$colonnes += array(
377
				'observateur' => self::GenColInfo(array(
402
				'observateur' => self::GenColInfo(array(
378
					'abbrev' => 'observateur',
403
					'abbrev' => 'pseudo_utilisateur',
379
					'nom' => 'Observateur',
404
					'nom' => 'Auteur',
380
					'extra' => 1,
-
 
381
					'fonction_data' => 'formaterUrlUser',
405
					'extra' => 1,
382
					'importable' => false)),
406
					'importable' => false)),
383
			);
407
			);
384
		}
408
		}
385
		return $colonnes;
409
		return $colonnes;
Line 429... Line 453...
429
				$valeur = $colonne['fonction_data']($obs);
453
				$valeur = $colonne['fonction_data']($obs);
430
			} else if(method_exists(__CLASS__, $colonne['fonction_data'])) {
454
			} else if(method_exists(__CLASS__, $colonne['fonction_data'])) {
431
				$valeur = call_user_func(array(__CLASS__, $colonne['fonction_data']), $obs);
455
				$valeur = call_user_func(array(__CLASS__, $colonne['fonction_data']), $obs);
432
			}
456
			}
Line 433... Line -...
433
 
-
 
434
			// // cette section devrait être vide:
-
 
435
			// // cas particuliers ingérable avec l'architecture actuelle:
-
 
436
			if (false && $abbrev == 'date_observation' && $valeur == '0000-00-00') {
-
 
437
				/* blah */
457
 
438
			}
458
			
439
			// ici à cause du passage de $cel ($this->utilisateur)
-
 
440
			if ($abbrev == 'images') {
-
 
441
				$valeur = FormateurGroupeColonne::getImages($obs, $cel->id_utilisateur);
459
			// ici à cause du passage de $cel ($this->utilisateur)
442
			}
460
			
443
			if ($abbrev == 'nom-commun') {
461
			if ($abbrev == 'nom-commun') {
444
				$valeur = FormateurGroupeColonne::getNomCommun_v4($obs);
462
				$valeur = FormateurGroupeColonne::getNomCommun_v4($obs);
Line 445... Line 463...
445
			}
463
			}
Line 538... Line 556...
538
			return '00/00/0000';
556
			return '00/00/0000';
539
		}
557
		}
540
		return $date_formatee;
558
		return $date_formatee;
541
	}
559
	}
Line 542... Line -...
542
 
-
 
543
	static function formaterUrlUser($obs) {
-
 
544
		$is_id = is_numeric($obs['ce_utilisateur']);
-
 
545
		return sprintf("%s %s <%s>%s",
-
 
546
			$obs['prenom_utilisateur'],
-
 
547
			$obs['nom_utilisateur'],
-
 
548
			preg_replace(';@.*;', '@...', $obs['courriel_utilisateur']),
-
 
549
			$is_id ? sprintf(' (' . USER_BASEURL . ')', $obs['ce_utilisateur']) : '');
-
 
550
	}
-
 
551
 
-
 
552
	static function getImages_preload($cel, $obsids) {
-
 
553
		if (!$obsids) return;
-
 
554
		$rec = Cel::db()->requeter(
-
 
555
			sprintf("SELECT o.id_observation, GROUP_CONCAT(nom_original ORDER BY nom_original ASC SEPARATOR '%s') AS i " .
-
 
556
					"FROM cel_images i LEFT JOIN cel_obs o ON (i.ce_observation = o.id_observation) " .
-
 
557
					"WHERE o.ce_utilisateur = %d AND o.id_observation IN (%s) " .
-
 
558
					"GROUP BY id_observation",
-
 
559
					SEPARATEUR_IMAGES,
-
 
560
					$cel->id_utilisateur,
-
 
561
					implode(',', $obsids)));
-
 
562
		foreach ($rec as $v) {
-
 
563
			self::$cache['getImages'][$v['id_observation']] = $v['i'];
-
 
564
		}
-
 
565
		return null;
-
 
566
	}
-
 
567
 
-
 
568
	static function getImages($obs, $id_utilisateur) {
-
 
569
		if(! $id_utilisateur) return NULL;
-
 
570
		if(isset(self::$cache['getImages'][$obs['id_observation']]))
-
 
571
			return self::$cache['getImages'][$obs['id_observation']];
-
 
572
 
-
 
573
		$rec = Cel::db()->requeter(
-
 
574
			sprintf("SELECT GROUP_CONCAT(nom_original ORDER BY nom_original ASC SEPARATOR '%s') AS i ".
-
 
575
					"FROM cel_images i ".
-
 
576
					"	LEFT JOIN cel_obs o ON (i.ce_observation = o.id_observation) ".
-
 
577
					"WHERE o.ce_utilisateur = %d ".
-
 
578
					"	AND o.id_observation = %d ".
-
 
579
					'LIMIT 1',
-
 
580
					SEPARATEUR_IMAGES,
-
 
581
					$id_utilisateur,
-
 
582
					$obs['id_observation']));
-
 
583
		return $rec ? $rec[0]['i'] : NULL;
-
 
584
	}
-
 
585
 
-
 
586
	public static function convertirCodeZoneGeoVersDepartement($code_zone_geo) {
-
 
587
		$code_departement = '';
-
 
588
		if(self::estUnCodeInseeDepartement($code_zone_geo)) {
-
 
589
			$code_departement = substr(ltrim($code_zone_geo,'INSEE-C:'),0,2);
-
 
Line 590... Line -...
590
		}
-
 
-
 
560
 
591
 
561
 
Line 592... Line 562...
592
		return $code_departement;
562
 
593
	}
563
 
594
 
564
 
595
	/**
565
	/**
Line 607... Line 577...
607
 
577
 
608
	public static function boolOuiNon($transmission) {
578
	public static function boolOuiNon($transmission) {
609
		return $transmission ? 'oui' : '';
579
		return $transmission ? 'oui' : '';
Line 610... Line -...
610
	}
-
 
611
 
-
 
612
	public static function estUnCodeInseeDepartement($code_a_tester) {
580
	}
Line 613... Line 581...
613
		return preg_match('/^INSEE-C:[0-9]{5}/',$code_a_tester);
581
 
614
	}
582
 
615
 
583
 
616
	// TODO: référentiel ne devrait pas être généré au moment d'un Config::get,
584
	// TODO: référentiel ne devrait pas être généré au moment d'un Config::get,
Line 731... Line 699...
731
		// cache
699
		// cache
732
		self::$cache['getNomCommun'][$cache_id] = $nom;
700
		self::$cache['getNomCommun'][$cache_id] = $nom;
733
		return $nom;
701
		return $nom;
734
	}
702
	}
Line 735... Line -...
735
 
-
 
736
	/* Cette fonction initialise le cache des noms communs en 1 fois, sur la liste des observations à exporter.
-
 
737
	   Ainsi, les appels successifs à getNomCommun_v4() ne sont pas couteux (pas de requête SQL) */
-
 
738
	static function getNomCommun_preload($cel, $obsids) {
-
 
739
		if(!$obsids) return;
-
 
740
		if(!self::referenceTableExiste()) return NULL;
703
 
741
 
-
 
742
		// CREATE INDEX i_nom_referentiel ON cel_obs (nom_referentiel(5));
-
 
743
		$req = sprintf("SELECT r.referentiel, r.num_taxon, r.nom_commun FROM cel_references r" .
-
 
744
					   " INNER JOIN cel_obs c ON (r.referentiel = substring_index(c.nom_referentiel, ':', 1) and r.num_taxon = c.nt)" .
-
 
745
					   " WHERE c.id_observation IN (%s)",
-
 
746
					   implode(',', $obsids));
-
 
747
		$res = Cel::db()->requeter($req);
-
 
748
		foreach($res as $v) {
-
 
749
			self::$cache['getNomCommun'][$v['referentiel'] . '-' . $v['num_taxon'] . '-' . 'fra'] = $v['nom_commun'];
-
 
750
		}
-
 
751
		return NULL;
-
 
752
	}
704
 
753
 
-
 
754
	static function referenceTableExiste() {
-
 
755
		if (!self::$is_table) {
-
 
756
			// une seule fois
-
 
757
			if (! Cel::db()->requeterLigne("SHOW TABLES LIKE 'cel_references'")) return FALSE;
-
 
758
			self::$is_table = TRUE;
-
 
759
		}
-
 
760
		return TRUE;
705
 
Line 761... Line 706...
761
	}
706
 
762
 
707
 
763
	static function getNomCommun_v4($obs) {
708
	static function getNomCommun_v4($obs) {
764
		// Attention la fonction suppose que l'on ait fait appel à getNomCommun_preload avant
709
		// Attention la fonction suppose que l'on ait fait appel à getNomCommun_preload avant