Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1574 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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