Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1757 Rev 1759
Line 6... Line 6...
6
* @author    Raphaël Droz <raphael@tela-botania.org>
6
* @author    Raphaël Droz <raphael@tela-botania.org>
7
* @copyright 2013 Tela-Botanica
7
* @copyright 2013 Tela-Botanica
8
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
8
* @license   http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
9
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
9
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
10
*/
10
*/
11
define('SEPARATEUR_IMAGES', ",");
11
define('SEPARATEUR_IMAGES', " / ");
Line 12... Line 12...
12
 
12
 
Line 13... Line 13...
13
Class FormateurGroupeColonne {
13
Class FormateurGroupeColonne {
14
 
14
 
Line 425... Line 425...
425
		$date_formatee = strftime('%Y/%m/%d', $timestamp);
425
		$date_formatee = strftime('%Y/%m/%d', $timestamp);
426
		if(!$date_formatee) return "00/00/0000";
426
		if(!$date_formatee) return "00/00/0000";
427
		return $date_formatee;
427
		return $date_formatee;
428
	}
428
	}
Line -... Line 429...
-
 
429
 
-
 
430
	static function getImages_preload($cel, $obsids) {
-
 
431
		if(!$obsids) return;
-
 
432
		$rec = $cel->requeter(
-
 
433
			sprintf("SELECT o.id_observation, GROUP_CONCAT(nom_original ORDER BY nom_original ASC SEPARATOR '%s') AS i " .
-
 
434
					"FROM cel_images i LEFT JOIN cel_obs_images oi ON (i.id_image = oi.id_image) LEFT JOIN cel_obs o ON (oi.id_observation = o.id_observation) " .
-
 
435
					"WHERE o.ce_utilisateur = %d AND o.id_observation IN (%s) " .
-
 
436
					"GROUP BY id_observation",
-
 
437
					SEPARATEUR_IMAGES,
-
 
438
					$cel->id_utilisateur,
-
 
439
					implode(',', $obsids)));
-
 
440
		foreach($rec as $v) {
-
 
441
			self::$cache['getImages'][$v['id_observation']] = $v['i'];
-
 
442
		}
-
 
443
		return NULL;
-
 
444
	}
429
 
445
 
430
	static function getImages($obs, $id_utilisateur, $cel) {
446
	static function getImages($obs, $id_utilisateur, $cel) {
-
 
447
		if(! $id_utilisateur) return NULL;
-
 
448
		if(isset(self::$cache['getImages'][$obs['id_observation']]))
-
 
449
			return self::$cache['getImages'][$obs['id_observation']];
431
		if(! $id_utilisateur) return NULL;
450
 
432
		$rec = $cel->requeter(
451
		$rec = $cel->requeter(
433
			sprintf("SELECT GROUP_CONCAT(nom_original SEPARATOR '%s') AS i FROM cel_images i"
452
			sprintf("SELECT GROUP_CONCAT(nom_original ORDER BY nom_original ASC SEPARATOR '%s') AS i FROM cel_images i"
434
					." LEFT JOIN cel_obs_images oi ON (i.id_image = oi.id_image)"
453
					." LEFT JOIN cel_obs_images oi ON (i.id_image = oi.id_image)"
435
					." LEFT JOIN cel_obs o ON (oi.id_observation = o.id_observation)"
454
					." LEFT JOIN cel_obs o ON (oi.id_observation = o.id_observation)"
436
					." WHERE o.ce_utilisateur = %d AND o.id_observation = %d LIMIT 1",
455
					." WHERE o.ce_utilisateur = %d AND o.id_observation = %d LIMIT 1",
437
					SEPARATEUR_IMAGES,
456
					SEPARATEUR_IMAGES,