Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2245 Rev 2249
Line 713... Line 713...
713
 
713
 
714
		return NULL;
714
		return NULL;
Line 715... Line 715...
715
	}
715
	}
-
 
716
 
-
 
717
	static function baseflor_ligne($obs, &$ligne) {
716
 
718
		// Attention la fonction suppose que l'on ait fait appel à baseflor_preload avant 
717
	static function baseflor_ligne($obs, &$ligne) {
719
		// d'être appelée
718
		if(! $obs['nom_ret_nn']) {
720
		if(! $obs['nom_ret_nn']) {
719
			$ligne = array_merge($ligne, array_fill(0, count(self::$baseflor_col), NULL));
721
			$ligne = array_merge($ligne, array_fill(0, count(self::$baseflor_col), NULL));
Line 725... Line 727...
725
			return;
727
			return;
726
		}
728
		}
Line 727... Line 729...
727
 
729
 
728
		list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
730
		list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
-
 
731
		$cache_id = $referentiel . '-' . $obs['nom_ret_nn'];
-
 
732
		
-
 
733
		//echo $cache_id;
-
 
734
		//echo '<pre>'.print_r(self::$cache['getBaseflor'], true).'</pre>';
Line 729... Line 735...
729
		$cache_id = $referentiel . '-' . $obs['nom_ret_nn'];
735
		//exit;
730
 
736
 
731
		// XXX: problème de valeurs NULL pour utiliser simplement isset() ?
737
		// XXX: problème de valeurs NULL pour utiliser simplement isset() ?
732
		// @ car getBaseflor[] n'est peut-être pas encore initialisé
738
		// @ car getBaseflor[] n'est peut-être pas encore initialisé
733
		if(@array_key_exists($cache_id, self::$cache['getBaseflor'])) {
739
		if(@array_key_exists($cache_id, self::$cache['getBaseflor'])) {
734
			$ligne = array_merge($ligne, self::$cache['getBaseflor'][$cache_id]);
-
 
735
			return;
-
 
736
		}
-
 
737
 
-
 
738
		// pas de cache:
-
 
739
		$data = Cel::db()->requeterLigne(sprintf("SELECT %s FROM cel_references " .
-
 
740
											 "WHERE referentiel = '%s' AND num_nom_retenu = %d LIMIT 1",
-
 
741
											 implode(', ', array_keys(self::$baseflor_col)),
-
 
742
											 $referentiel,
-
 
743
											 $obs['nom_ret_nn']));
740
			$ligne = array_merge($ligne, self::$cache['getBaseflor'][$cache_id]);
744
 
741
			return;
745
		if(! $data) {
742
		} else {
746
			$ligne = array_merge($ligne, array_fill(0, count(self::$baseflor_col), NULL));
743
			$ligne = array_merge($ligne, array_fill(0, count(self::$baseflor_col), NULL));
747
			return;
-
 
748
		}
-
 
749
 
-
 
750
		// cache
-
 
751
		self::$cache['getBaseflor'][$cache_id] = $data;
744
			return;
Line 752... Line 745...
752
		$ligne = array_merge($ligne, $data);
745
		}
753
	}
746
	}
754
 
747