Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1715 Rev 1716
Line 153... Line 153...
153
		}
153
		}
Line 154... Line 154...
154
 
154
 
155
		if(isset($groupe_de_champs['etendu'])) {
155
		if(isset($groupe_de_champs['etendu'])) {
156
			$colonnes += array(
156
			$colonnes += array(
157
				// champ dynamique
157
				// champ dynamique
158
				'etendu'			=> self::GenColInfo('etendu', '', 1, NULL, NULL, FALSE, array(__CLASS__, 'champsEtendus_preload'), NULL),
158
				'etendu'			=> self::GenColInfo('etendu', '', 1, NULL, NULL, FALSE, array(__CLASS__, 'champsEtendus_preload'), array(__CLASS__, 'champsEtendus_ligne')),
159
			);
159
			);
Line 160... Line 160...
160
		}
160
		}
161
 
161
 
Line 534... Line 534...
534
		return NULL;
534
		return NULL;
535
	}
535
	}
Line 536... Line 536...
536
	
536
	
537
 
-
 
538
	static function baseflor_ligne($cel, $obs, &$ligne) {
537
 
539
 
538
	static function baseflor_ligne($cel, $obs, &$ligne) {
540
		if(! $obs['nom_ret_nn']) {
539
		if(! $obs['nom_ret_nn']) {
541
			$ligne = array_merge($ligne, array_fill(0, count(self::$baseflor_col), NULL));
540
			$ligne = array_merge($ligne, array_fill(0, count(self::$baseflor_col), NULL));
Line 584... Line 583...
584
			$v = self::champsEtendus_aplatir($v);
583
			$v = self::champsEtendus_aplatir($v);
585
		}
584
		}
586
		self::$cache['champsEtendus']['data'] = $champs_supp_par_obs;
585
		self::$cache['champsEtendus']['data'] = $champs_supp_par_obs;
587
		// ce return est temporaire,
586
		// ce return est temporaire,
588
		// le temps que toutes les fonctions bougent ici et utilise plutôt le cache statique
587
		// le temps que toutes les fonctions bougent ici et utilise plutôt le cache statique
-
 
588
		// encore utilisé pour les entêtes (self::$cache['champsEtendus']['header'])
589
		return self::$cache['champsEtendus'];
589
		return self::$cache['champsEtendus'];
590
	}
590
	}
Line 591... Line 591...
591
 
591
 
592
	// XXX: PHP-5.3, fonction anonyme + array_map
592
	// XXX: PHP-5.3, fonction anonyme + array_map
Line 596... Line 596...
596
		foreach($ligne_champs_etendus as $champ) {
596
		foreach($ligne_champs_etendus as $champ) {
597
			$champs_etendus_fmt[$champ->cle] = $champ->valeur;
597
			$champs_etendus_fmt[$champ->cle] = $champ->valeur;
598
		}
598
		}
599
		return $champs_etendus_fmt;
599
		return $champs_etendus_fmt;
600
	}
600
	}
-
 
601
 
-
 
602
	static function champsEtendus_ligne($cel, $obs, &$ligne) {
-
 
603
		// si header n'est pas défini, aucune observation ne possède de champ étendu
-
 
604
		// et nous n'ajoutons ni colonnes, ni valeurs.
-
 
605
		if(! isset(self::$cache['champsEtendus']['header'])) return;
-
 
606
 
-
 
607
		$ligne_etendue_aplatie = @self::$cache['champsEtendus']['data'][$ligne['id_observation']];
-
 
608
 
-
 
609
		$ligne_supp = array_fill(0, count(self::$cache['champsEtendus']['header']), '');
-
 
610
		$ligne_etendue_fmt = array();
-
 
611
 
-
 
612
		// si, cependant cette seule observation n'a pas de champs étendus,
-
 
613
		// nous devons rajouter des blancs (notamment dans le cas ou d'autres
-
 
614
		// champs viennent à être ajoutés en aval à l'avenir
-
 
615
		// cf: $fonction_dynamique dans FormateurGroupeColonne::GenColInfo()
-
 
616
		if(! $ligne_etendue_aplatie) {
-
 
617
			$ligne = array_merge($ligne, $ligne_supp);
-
 
618
			return;
-
 
619
		}
-
 
620
 
-
 
621
		foreach(self::$cache['champsEtendus']['header'] as $colonne) {
-
 
622
			if(!isset($ligne_etendue_aplatie[$colonne])) {
-
 
623
				$ligne_etendue_fmt[$colonne] = ''; 
-
 
624
			} else {
-
 
625
				$ligne_etendue_fmt[$colonne] = $ligne_etendue_aplatie[$colonne];
-
 
626
			}
-
 
627
		}
-
 
628
 
-
 
629
		// XXX/ array_merge() ?
-
 
630
		$ligne += $ligne_etendue_fmt;
-
 
631
	}
601
}
632
}