Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1673 Rev 1685
Line 75... Line 75...
75
			   'phenologie'			=> self::GenColInfo('phenologie', 'Phénologie', 1),
75
			   'phenologie'			=> self::GenColInfo('phenologie', 'Phénologie', 1),
Line 76... Line 76...
76
 
76
 
77
			   // XXX: getImages() dépend du contexte de Cel, et doit être appelée comme cas particulier
77
			   // XXX: getImages() dépend du contexte de Cel, et doit être appelée comme cas particulier
78
			   // cf ExportXLS::traiterLigneObservation()
78
			   // cf ExportXLS::traiterLigneObservation()
-
 
79
			   'images'				=> self::GenColInfo('images', 'Image(s)', 1, NULL, 'getImages', TRUE),
-
 
80
 
-
 
81
			   /* 'nom_commun'			=> self::GenColInfo('nom_commun', 'Nom Commun', 1, NULL, 'getNomCommun', FALSE),
-
 
82
				  'nom-commun'			=> self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v2'),
-
 
83
				  'nom-commun'			=> self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v3'), */
-
 
84
			   'nom-commun'			=> self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v4'),
79
			   'images'				=> self::GenColInfo('images', 'Image(s)', 1, NULL, 'getImages', TRUE),
85
 
80
			);
86
			);
Line 81... Line -...
81
		}	
-
 
82
 
-
 
83
		/* 'nom_commun'			=> self::GenColInfo('nom_commun', 'Nom Commun', 1, NULL, 'getNomCommun', FALSE),
-
 
84
		   'nom-commun'			=> self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v2'),
-
 
85
		   'nom-commun'			=> self::GenColInfo('nom-commun', 'Nom Commun', 1, NULL, 'getNomCommun_v3'), */
87
		}	
86
 
88
 
Line 87... Line 89...
87
		return $colonnes;
89
		return $colonnes;
88
	}
90
	}
Line 124... Line 126...
124
			// // cette section devrait être vide:
126
			// // cette section devrait être vide:
125
			// // cas particuliers ingérable avec l'architecture actuelle:
127
			// // cas particuliers ingérable avec l'architecture actuelle:
126
			if(false && $abbrev == 'date_observation' && $valeur == "0000-00-00") {
128
			if(false && $abbrev == 'date_observation' && $valeur == "0000-00-00") {
127
				/* blah */
129
				/* blah */
128
			}
130
			}
-
 
131
			// ici à cause du passage de $cel ($this), TODO: DB en Singleton !
129
			if($abbrev == 'images') {
132
			if($abbrev == 'images') {
130
				$valeur = FormateurGroupeColonne::getImages($obs, $cel->id_utilisateur, $cel);
133
				$valeur = FormateurGroupeColonne::getImages($obs, $cel->id_utilisateur, $cel);
131
			}
134
			}
-
 
135
			if($abbrev == 'nom-commun') {
-
 
136
				$valeur = FormateurGroupeColonne::getNomCommun_v4($obs, $cel);
-
 
137
			}
Line 132... Line 138...
132
				
138
				
133
			if($valeur == null) {
139
			if($valeur == null) {
134
				$valeur = "";
140
				$valeur = "";
Line 339... Line 345...
339
		
345
		
340
		// cache
346
		// cache
341
		self::$cache['getNomCommun'][$cache_id] = $nom;
347
		self::$cache['getNomCommun'][$cache_id] = $nom;
342
		return $nom;
348
		return $nom;
-
 
349
	}
-
 
350
 
-
 
351
	static function getNomCommun_v4($obs, $cel) {
-
 
352
		if(! $obs['nt']) return NULL;
-
 
353
		if(! $cel->executerRequete("SHOW TABLES LIKE 'cel_references'", Cel::SQL_RETOUR_LIGNE)) return NULL;
-
 
354
		
-
 
355
		$langue = 'fra';
-
 
356
		list($referentiel) = explode(':', strtolower($obs['nom_referentiel']));
-
 
357
		$cache_id = $referentiel . '-' . $obs['nt'] . '-' . $langue;
-
 
358
 
-
 
359
		if(isset(self::$cache['getNomCommun'][$cache_id])) return self::$cache['getNomCommun'][$cache_id];
-
 
360
 
-
 
361
		// pas de cache:
-
 
362
		$donnees = Array('masque.nt' => $obs['nt'],
-
 
363
						 'masque.lg' => $langue,
-
 
364
						 'retour.champs' => 'conseil_emploi');
-
 
365
 
-
 
366
		$nom = $cel->executerRequete(sprintf("SELECT nom_commun FROM cel_references " .
-
 
367
											 "WHERE referentiel = '%s' AND num_taxon = %d LIMIT 1",
-
 
368
											 $referentiel,
-
 
369
											 $obs['nt']),
-
 
370
									 Cel::SQL_RETOUR_LIGNE);
-
 
371
 
-
 
372
		if(! $nom) return NULL;
-
 
373
		$nom = $nom["nom_commun"];
-
 
374
 
-
 
375
		// cache
-
 
376
		self::$cache['getNomCommun'][$cache_id] = $nom;
-
 
377
		return $nom;
Line -... Line 378...
-
 
378
	}
343
	}
379
	
344
	
380