Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 2254 Rev 2281
Line 649... Line 649...
649
		}
649
		}
650
		return TRUE;
650
		return TRUE;
651
	}
651
	}
Line 652... Line 652...
652
 
652
 
-
 
653
	static function getNomCommun_v4($obs) {
-
 
654
		// Attention la fonction suppose que l'on ait fait appel à getNomCommun_preload avant
653
	static function getNomCommun_v4($obs) {
655
		// d'être appelée
654
		if(! $obs['nt']) return NULL;
656
		if(! $obs['nt']) return NULL;
Line 655... Line 657...
655
		if(! self::referenceTableExiste()) return NULL;
657
		if(! self::referenceTableExiste()) return NULL;
656
 
658
 
657
		$langue = 'fra';
659
		$langue = 'fra';
Line -... Line 660...
-
 
660
		list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
658
		list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
661
		$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
659
		$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
662
 
660
 
663
		$nom = null;
661
		// cache:
664
		// cache:
662
		if(isset($cache['getNomCommun'])) {
665
		if(isset(self::$cache['getNomCommun'])) {
-
 
666
			if(isset(self::$cache['getNomCommun'][$cache_id])) return self::$cache['getNomCommun'][$cache_id];
-
 
667
			// XXX: problème de valeurs NULL ?
663
			if(isset(self::$cache['getNomCommun'][$cache_id])) return self::$cache['getNomCommun'][$cache_id];
668
			if(array_key_exists($cache_id, self::$cache['getNomCommun'])) {
Line 664... Line -...
664
			// XXX: problème de valeurs NULL ?
-
 
665
			if(array_key_exists($cache_id, self::$cache['getNomCommun'])) return self::$cache['getNomCommun'][$cache_id];
-
 
666
		}
-
 
667
 
-
 
668
		// pas de cache:
-
 
669
		$nom = Cel::db()->requeterLigne(sprintf("SELECT nom_commun FROM cel_references " .
-
 
670
												  "WHERE referentiel = '%s' AND num_taxon = %d LIMIT 1",
-
 
671
												  $referentiel,
-
 
672
												  $obs['nt']));
-
 
673
 
-
 
674
		if(! $nom) return NULL;
-
 
675
		$nom = $nom["nom_commun"];
669
				$nom = self::$cache['getNomCommun'][$cache_id];
676
 
670
			}
Line 677... Line 671...
677
		// cache
671
		}