Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1659 Rev 1671
Line 86... Line 86...
86
 
86
 
87
		return $colonnes;
87
		return $colonnes;
Line 88... Line 88...
88
	}
88
	}
89
	
89
	
-
 
90
	public static function getIntitulesColonnes($colonnes) {
-
 
91
		return array_map(array('FormateurGroupeColonne', 'retournerNomItem'), $colonnes);
-
 
92
	}
-
 
93
	
90
	public static function getIntitulesColonnes($colonnes) {
94
	public static function retournerNomItem(&$item) {
Line 91... Line 95...
91
		return array_map(function($item) { return $item['nom']; }, $colonnes);
95
		return $item['nom'];
Line 92... Line 96...
92
	}
96
	}
Line 173... Line 177...
173
					 'importable' => $importable
177
					 'importable' => $importable
174
		);
178
		);
175
	}
179
	}
Line 176... Line 180...
176
	
180
	
-
 
181
	static function formaterDate($date_heure_mysql) {
177
	static function formaterDate($date_heure_mysql) {
182
		//return "";
-
 
183
		if (!$date_heure_mysql || $date_heure_mysql == "0000-00-00 00:00:00") return "00/00/0000";
178
		if (!$date_heure_mysql || $date_heure_mysql == "0000-00-00 00:00:00") return "00/00/0000";
184
		// malheureusement pas disponible en php < 5.3
179
		$date_format = DateTime::createFromFormat("Y-m-d H:i:s", $date_heure_mysql);
185
		//$date_format = DateTime::createFromFormat("Y-m-d H:i:s", $date_heure_mysql);
-
 
186
		$val = explode(' ', $date_heure_mysql);
-
 
187
		$date = explode('-', $val[0]);
-
 
188
		$heure = explode(':', $val[1]);
180
		$timestamp = @$date_format->getTimestamp();
189
		$timestamp = mktime((int) $heure[0], (int) $heure[1], (int) $heure[2], (int) $date[1], (int) $date[2], (int) $date[0]);
181
		if(!$timestamp) return "00/00/0000";
190
		if(!$timestamp) return "00/00/0000";
182
		// TODO: les widgets ne font malheureusement pas usage de l'heure dans le CEL
191
		// TODO: les widgets ne font malheureusement pas usage de l'heure dans le CEL
183
		// TODO: si modification, ne pas oublier de modifier le format d'import correspondant
192
		// TODO: si modification, ne pas oublier de modifier le format d'import correspondant
184
		//	dans ImportXLS (actuellement: "d/m/Y")
193
		//	dans ImportXLS (actuellement: "d/m/Y")
Line 237... Line 246...
237
						   Array($referentiel, $obs['nt'], $langue),
246
						   Array($referentiel, $obs['nt'], $langue),
238
						   self::$config['eflore']['url_service_nom_attribution']) . // TODO !
247
						   self::$config['eflore']['url_service_nom_attribution']) . // TODO !
239
			"&retour.champs=num_statut";
248
			"&retour.champs=num_statut";
240
		$noms = @json_decode(file_get_contents($url));
249
		$noms = @json_decode(file_get_contents($url));
241
		if(! $noms) return '';
250
		if(! $noms) return '';
242
		$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
251
		$noms = array_filter((array)($noms->resultat), array($this, retournerNumStatutUn));
243
		$nom = array_pop($noms)->nom_vernaculaire;
252
		$nom = array_pop($noms)->nom_vernaculaire;
Line 244... Line 253...
244
		
253
		
245
		// cache
254
		// cache
246
		self::$cache['getNomCommun'][$cache_id] = $nom;
255
		self::$cache['getNomCommun'][$cache_id] = $nom;
247
		return $nom;
256
		return $nom;
Line -... Line 257...
-
 
257
	}
-
 
258
	
-
 
259
	private function retournerNumStatutUn(&$item) {
-
 
260
		return ($item->num_statut == 1);
248
	}
261
	}
249
	
262
	
250
	// si getNomCommun_v2 ou getNomCommun_v3 sont utilisés
263
	// si getNomCommun_v2 ou getNomCommun_v3 sont utilisés
251
	/* require_once('/home/raphael/eflore/framework/framework/Framework.php');
264
	/* require_once('/home/raphael/eflore/framework/framework/Framework.php');
252
	Framework::setCheminAppli("/home/raphael/eflore/projets/services/index.php");
265
	Framework::setCheminAppli("/home/raphael/eflore/projets/services/index.php");
Line 276... Line 289...
276
						 'masque.lg' => $langue,
289
						 'masque.lg' => $langue,
277
						 'retour.champs' => 'num_statut');
290
						 'retour.champs' => 'num_statut');
278
		$noms = $service->consulter(Array('nvjfl', 'noms-vernaculaires'), $donnees);
291
		$noms = $service->consulter(Array('nvjfl', 'noms-vernaculaires'), $donnees);
Line 279... Line 292...
279
		
292
		
280
		if(! $noms) return '';
293
		if(! $noms) return '';
281
		$noms = array_filter((array)($noms->resultat), function($item) { return ($item->num_statut == 1); });
294
		$noms = array_filter((array)($noms->resultat), array($this, retournerNumStatutUn));
Line 282... Line 295...
282
		$nom = array_pop($noms)->nom_vernaculaire;
295
		$nom = array_pop($noms)->nom_vernaculaire;
283
		
296
		
284
		// cache
297
		// cache
Line 314... Line 327...
314
			$noms = $this->service->traiterRessources();
327
			$noms = $this->service->traiterRessources();
315
		} catch(Exception $e) { 
328
		} catch(Exception $e) { 
316
			return '';
329
			return '';
317
		}
330
		}
318
		if(! $noms) return '';
331
		if(! $noms) return '';
319
		$noms = array_filter($noms['resultat'], function($item) { return ($item['num_statut'] == 1); });
332
		$noms = array_filter($noms['resultat'], array($this, retournerNumStatutUn));
320
		$premier_nom = array_pop($noms);
333
		$premier_nom = array_pop($noms);
321
		$nom = $premier_nom['nom_vernaculaire'];
334
		$nom = $premier_nom['nom_vernaculaire'];
Line 322... Line 335...
322
		
335
		
323
		// cache
336
		// cache