Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 916 | Rev 947 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 916 Rev 922
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Affiche un pop-up avec une galerie d'illustrations.
4
 * Affiche un pop-up avec une galerie d'illustrations.
5
 *
5
 *
6
 * @category	php 5.2
6
 * @category	php 5.2
7
 * @package		eFlore-consultation
7
 * @package		eFlore-consultation
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
8
 * @author		Aurélien PERONNET <aurelien@tela-botanica.org>
9
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
9
 * @copyright	Copyright (c) 2012, Tela Botanica (accueil@tela-botanica.org)
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
10
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL
12
 * @version		$Id$
12
 * @version		$Id$
13
 */
13
 */
14
 
14
 
15
class PopupGalerie extends aControleur {
15
class PopupGalerie extends aControleur {
16
	private $conteneur = null;
16
	private $conteneur = null;
17
	private $urlImage = null;
17
	private $urlImage = null;
18
	private $images = null;
18
	private $images = null;
19
	private $appUrls = null;
19
	private $appUrls = null;
-
 
20
	private $titre = '';
20
	private $format = 'CS';
21
	private $format_miniature = 'CS';
-
 
22
	private $format_agrandi = 'L';
21
 
23
 
22
	public function initialiser() {
24
	public function initialiser() {
23
		$this->capturerParametres();
25
		$this->capturerParametres();
24
		$this->conteneur = new Conteneur();
26
		$this->conteneur = new Conteneur();
25
		$this->images = $this->conteneur->getApiImages();
27
		$this->images = $this->conteneur->getApiImages();
26
		$this->appUrls = $this->conteneur->getAppUrls();
28
		$this->appUrls = $this->conteneur->getAppUrls();
27
	}
29
	}
28
 
30
 
29
	private function capturerParametres() {
31
	private function capturerParametres() {
30
		if (isset($_GET['num_nom'])) {
32
		if (isset($_GET['num_nom'])) {
31
			$this->num_nom = $_GET['num_nom'];
33
			$this->num_nom = $_GET['num_nom'];
32
		}
34
		}
33
		if (isset($_GET['url_image'])) {
35
		if (isset($_GET['url_image'])) {
34
			$this->urlImage = urldecode($_GET['url_image']);
36
			$this->urlImage = urldecode($_GET['url_image']);
35
		}
37
		}
36
		if (isset($_GET['format'])) {
38
		if (isset($_GET['format'])) {
37
			$this->format = $_GET['format'];
39
			$this->format = $_GET['format'];
38
		}
40
		}
-
 
41
		if (isset($_GET['titre'])) {
-
 
42
			$this->titre = $_GET['titre'];
-
 
43
		}
39
	}
44
	}
40
 
45
 
41
	public function executerActionParDefaut() {
46
	public function executerActionParDefaut() {
42
		$this->executerFiche();
47
		$this->executerFiche();
43
	}
48
	}
44
 
49
 
45
	public function executerFiche(){
50
	public function executerFiche(){
46
		$infos = array();
51
		$infos = array();
47
		$this->images->setProjet('cel');
52
		$this->images->setProjet('cel');
48
		$urls = $this->images->getUrlsImagesParIdsNoms(array($this->num_nom));
53
		$urls = $this->images->getUrlsImagesParIdsNoms(array($this->num_nom));
49
		$infos['urls'] = $urls['bdtfx.'.$this->num_nom];
54
		$urls = $urls['bdtfx.'.$this->num_nom];
-
 
55
		$ids = array();
-
 
56
		foreach($urls as $index => $url) {
-
 
57
			$urls[$index] = str_replace($this->format_miniature, $this->format_agrandi, $url);
-
 
58
			$ids[$index] = $this->extraireIdDeUrl($url);
-
 
59
		}
-
 
60
		
-
 
61
		$infos['urls'] = $urls;
-
 
62
		$infos['ids'] = $ids;
50
		$infos['num_nom'] = $this->num_nom;
63
		$infos['num_nom'] = $this->num_nom;
-
 
64
		$infos['url_image'] = str_replace($this->format_miniature, $this->format_agrandi, $this->urlImage);
51
		$infos['url_image'] = $this->urlImage;
65
		$infos['titre'] = $this->titre;
-
 
66
		$infos['url_meta'] = Config::get('imagesPopupTpl');
-
 
67
		$infos['url_contact'] = $this->appUrls->obtenirUrlPopUpContact("{id_auteur}", "{id_img}");
-
 
68
		
52
		
69
		$this->setSortie(self::META_TITRE,$this->titre, true);
53
		$this->setSortie(self::RENDU_CORPS, $this->getVue('popup_galerie_illustrations', $infos));
70
		$this->setSortie(self::RENDU_CORPS, $this->getVue('popup_galerie_illustrations', $infos));
-
 
71
	}
-
 
72
	
-
 
73
	private function extraireIdDeUrl($url) {
-
 
74
		$matches = array();
-
 
75
		preg_match('#cel-img:([0-9]*)'.$this->format_miniature.'#', $url, $matches);
-
 
76
		return ltrim($matches[1],'0');
54
	}
77
	}
55
	
78
	
56
	private function formaterDateImg($date) {
79
	private function formaterDateImg($date) {
57
		$dateFmt = $date;
80
		$dateFmt = $date;
58
		if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
81
		if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
59
			$dateFmt = 'inconnue';
82
			$dateFmt = 'inconnue';
60
		} else {
83
		} else {
61
			$dateFmt = strftime('%e %B %Y', strtotime($date));
84
			$dateFmt = strftime('%e %B %Y', strtotime($date));
62
		}
85
		}
63
		return $dateFmt;
86
		return $dateFmt;
64
	}
87
	}
65
 
88
 
66
}
89
}
67
?>
90
?>