Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1715 Rev 1716
Line 255... Line 255...
255
 
255
 
256
		// header
256
		// header
257
		fputcsv($outstream, $intitule_champs, ',', '"');			
257
		fputcsv($outstream, $intitule_champs, ',', '"');			
258
		// lignes
258
		// lignes
259
		foreach($data as &$ligne) {
-
 
260
			$id_obs = $ligne['id_observation'];
259
		foreach($data as &$ligne) {
261
			$ligne = self::filtrerDonneesSensibles($ligne);
260
			$ligne = self::filtrerDonneesSensibles($ligne);
262
			$ligne = FormateurGroupeColonne::getLigneObservation($ligne, $colonnes, $this);
-
 
263
			self::traiterLigneEtendue($ligne, @self::$cache['etendu']['data'][$id_obs]);
261
			$ligne = FormateurGroupeColonne::getLigneObservation($ligne, $colonnes, $this);
264
			fputcsv($outstream, $ligne, ',', '"');
262
			fputcsv($outstream, $ligne, ',', '"');
265
		}
263
		}
266
		rewind($outstream);
264
		rewind($outstream);
267
		$csv = stream_get_contents($outstream);
265
		$csv = stream_get_contents($outstream);
Line 298... Line 296...
298
		foreach ($intitule_champs as &$intitule) {	
296
		foreach ($intitule_champs as &$intitule) {	
299
			$worksheet->write(0,$indice++,$intitule);
297
			$worksheet->write(0,$indice++,$intitule);
300
		}
298
		}
Line 301... Line 299...
301
 
299
 
302
		foreach($data as &$ligne) {
-
 
303
			$id_obs = $ligne['id_observation'];
300
		foreach($data as &$ligne) {
304
			$ligne = self::filtrerDonneesSensibles($ligne);
301
			$ligne = self::filtrerDonneesSensibles($ligne);
305
			$ligne = FormateurGroupeColonne::getLigneObservation($ligne, $colonnes, $this);
-
 
306
			self::traiterLigneEtendue($ligne, @self::$cache['etendu']['data'][$id_obs]);
302
			$ligne = FormateurGroupeColonne::getLigneObservation($ligne, $colonnes, $this);
307
			$indice = 0;
303
			$indice = 0;
308
			foreach($ligne as &$champ) {
304
			foreach($ligne as &$champ) {
309
				$worksheet->write($nb_lignes,$indice++,$champ);
305
				$worksheet->write($nb_lignes,$indice++,$champ);
310
			}
306
			}
Line 319... Line 315...
319
		$pdf = new GenerateurPDF();
315
		$pdf = new GenerateurPDF();
320
		$pdf->export($observations);
316
		$pdf->export($observations);
321
		return $pdf;
317
		return $pdf;
322
	}
318
	}
Line 323... Line -...
323
	
-
 
324
	static function traiterLigneEtendue(&$ligne, $ligne_etendue_aplatie) {
-
 
325
		// si header n'est pas défini, aucune observation ne possède de champ étendu
-
 
326
		// et nous n'ajoutons ni colonnes, ni valeurs.
-
 
327
		if(! isset(self::$cache['etendu']['header'])) return;
-
 
328
 
-
 
329
		$ligne_supp = array_fill(0, count(self::$cache['etendu']['header']), '');
-
 
330
		$ligne_etendue_fmt = array();
-
 
331
 
-
 
332
		// si, cependant cette seule observation n'a pas de champs étendus,
-
 
333
		// nous devons rajouter des blancs (notamment dans le cas ou d'autres
-
 
334
		// champs viennent à être ajoutés en aval à l'avenir
-
 
335
		// cf: $fonction_dynamique dans FormateurGroupeColonne::GenColInfo()
-
 
336
		if(! $ligne_etendue_aplatie) {
-
 
337
			$ligne = array_merge($ligne, $ligne_supp);
-
 
338
			return;
-
 
339
		}
-
 
340
 
-
 
341
		foreach(self::$cache['etendu']['header'] as $colonne) {
-
 
342
			if(!isset($ligne_etendue_aplatie[$colonne])) {
-
 
343
				$ligne_etendue_fmt[$colonne] = ''; 
-
 
344
			} else {
-
 
345
				$ligne_etendue_fmt[$colonne] = $ligne_etendue_aplatie[$colonne];
-
 
346
			}
-
 
347
		}
-
 
348
 
-
 
349
		// XXX/ array_merge() ?
-
 
350
		$ligne += $ligne_etendue_fmt;
-
 
351
	}
-
 
352
 
319
	
353
	static function filtrerDonneesSensibles($ligne) {
320
	static function filtrerDonneesSensibles($ligne) {
354
		if(stripos($ligne['mots_cles_texte'], 'sensible') !== false) {
321
		if(stripos($ligne['mots_cles_texte'], 'sensible') !== false) {
355
			$ligne['latitude'] = '';
322
			$ligne['latitude'] = '';
356
			$ligne['longitude'] = '';
323
			$ligne['longitude'] = '';