Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1574 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
476 delphine 1
<?php
501 jpm 2
// declare(encoding='UTF-8');
476 delphine 3
/**
501 jpm 4
 * Affiche un pop-up avec les infos d'une illustration.
5
 *
6
 * @category	php 5.2
7
 * @package		eFlore-consultation
8
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
10
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
11
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
12
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
13
 * @version		$Id$
476 delphine 14
 */
15
 
16
class PopupIllustrations extends aControleur {
17
	private $conteneur = null;
18
	private $id_image = '';
550 jpm 19
	private $images = null;
20
	private $appUrls = null;
501 jpm 21
 
476 delphine 22
	public function initialiser() {
23
		$this->capturerParametres();
24
		$this->conteneur = new Conteneur();
25
		$this->images = $this->conteneur->getApiImages();
550 jpm 26
		$this->appUrls = $this->conteneur->getAppUrls();
476 delphine 27
	}
501 jpm 28
 
476 delphine 29
	private function capturerParametres() {
30
		if (isset($_GET['id'])) {
31
			$this->id_image = $_GET['id'];
32
		}
33
	}
501 jpm 34
 
476 delphine 35
	public function executerActionParDefaut() {
36
		$this->executerFiche();
37
	}
501 jpm 38
 
476 delphine 39
	public function executerFiche(){
501 jpm 40
		$infos = array();
476 delphine 41
		$this->images->setProjet('cel');
1115 mathias 42
		$img = $this->images->setApi(Eflore::API_EFLORE)->getInfosImageParIdImage($this->id_image); // prêt à passer à API_DEL
501 jpm 43
		$infos['id'] = $this->id_image;
904 aurelien 44
		$img['date'] = $this->formaterDateImg($img['date']);
550 jpm 45
		$infos['image'] = $img;
46
		$infos['urlContact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id'], $this->id_image);
1576 delphine 47
		$infos['urlMauvaiseIdentification'] =  $this->appUrls->obtenirUrlMauvaiseIdentification($img['observation.id']);
501 jpm 48
		$this->setSortie(self::RENDU_CORPS, $this->getVue('popup_fiche_illustrations', $infos));
476 delphine 49
	}
904 aurelien 50
 
51
	private function formaterDateImg($date) {
52
		$dateFmt = $date;
53
		if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
1018 raphael 54
			return 'inconnue';
904 aurelien 55
		}
1018 raphael 56
		$time = strtotime($date);
57
		if(!$time) {
58
			/* TODO: php -r "echo strtotime('1891-00-00 00:00:00');"
59
			   si FALSE pour avant 1901: problème php
60
			   On retourne alors simplement l'année. */
61
			$dateFmt = explode('-', $date);
62
			return $dateFmt[0];
63
		}
64
		return strftime('%e %B %Y', strtotime($date));
904 aurelien 65
	}
476 delphine 66
}
67
?>