Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 509 Rev 624
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe gérant les images.
4
 * Classe gérant les images.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Images extends Eflore {
15
class Images extends Eflore {
-
 
16
	
-
 
17
	private $nntaxon;
-
 
18
	private $limite;
-
 
19
	private $depart;
-
 
20
 
-
 
21
	public function setNnTaxon($nntax) {
-
 
22
		$this->nntaxon = $nntax;
-
 
23
	}
-
 
24
	
-
 
25
	public function setLimite($limite) {
-
 
26
		$this->limite = $limite;
-
 
27
	}
-
 
28
	
-
 
29
	public function setDepart($depart) {
-
 
30
		$this->depart = $depart;
-
 
31
	}
16
 
32
	
17
	//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
33
	//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
18
	public function getUrlsImagesParIdsNoms(Array $idsNoms) {
34
	public function getUrlsImagesParIdsNoms(Array $idsNoms) {
19
		$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
35
		$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
20
		$urls = array();
36
		$urls = array();
21
		if (count($infosImages) > 0) {
37
		if (count($infosImages) > 0) {
22
			foreach ($infosImages as $img) {
38
			foreach ($infosImages as $img) {
23
				$id = $img['determination.nom_sci.code'];
39
				$id = $img['determination.nom_sci.code'];
24
				$urls[$id][] = $img['binaire.href'];
40
				$urls[$id][] = $img['binaire.href'];
25
			}
41
			}
26
		}
42
		}
27
		return $urls;
43
		return $urls;
28
	}
44
	}
29
 
45
 
30
	public function getInfosImagesParIdsNoms(Array $idsNoms) {
46
	public function getInfosImagesParIdsNoms(Array $idsNoms) {
31
		$url = $this->getUrlImagesParIdsNoms($idsNoms);
47
		$url = $this->getUrlImagesParIdsNoms($idsNoms);
32
		$donnees = $this->chargerDonnees($url);
48
		$donnees = $this->chargerDonnees($url);
33
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
49
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
34
		return $images;
50
		return $images;
35
	}
51
	}
36
 
52
 
37
	public function getInfosImageParIdImage($id_image) {
53
	public function getInfosImageParIdImage($id_image) {
38
		$tpl = Config::get('imagesPopupTpl');
54
		$tpl = Config::get('imagesPopupTpl');
39
		$url = $this->formaterUrl($tpl, array('id' => $id_image));
55
		$url = $this->formaterUrl($tpl, array('id' => $id_image));
40
		return $this->chargerDonnees($url);
56
		return $this->chargerDonnees($url);
41
	}
57
	}
-
 
58
	
-
 
59
	public function getInfosImages() {
-
 
60
		$url = $this->getUrlImages();
-
 
61
		$donnees = $this->chargerDonnees($url); 
-
 
62
		$images = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
-
 
63
		return $images;
-
 
64
	}
-
 
65
	
-
 
66
	public function getInfosImagesTaxons() {
-
 
67
		$url = $this->getUrlImagesTaxons();
-
 
68
		$donnees = $this->chargerDonnees($url);
-
 
69
		$images = (empty($donnees['resultats']) == false) ? $donnees['resultats'] : array();
-
 
70
		return $images;
-
 
71
	}
-
 
72
 
42
 
73
 
43
	private function getUrlImagesParIdsNoms($idsNoms) {
74
	private function getUrlImagesParIdsNoms($idsNoms) {
44
		$tpl = Config::get('imagesResultatsDeterminationTpl');
75
		$tpl = Config::get('imagesResultatsDeterminationTpl');
45
		$params = array('idsNoms' => implode(',', $idsNoms));
76
		$params = array('idsNoms' => implode(',', $idsNoms));
46
		$url = $this->formaterUrl($tpl, $params);
77
		$url = $this->formaterUrl($tpl, $params);
47
		return $url;
78
		return $url;
48
	}
79
	}
49
 
80
 
50
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
81
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
51
		$tpl = Config::get('imagesFicheBlocTpl');
82
		$tpl = Config::get('imagesFicheBlocTpl');
52
		$params = array('idsNoms' => implode(',', $idsNoms));
83
		$params = array('idsNoms' => implode(',', $idsNoms));
53
		$url = $this->formaterUrl($tpl, $params);
84
		$url = $this->formaterUrl($tpl, $params);
54
		return $this->chargerDonnees($url);
85
		return $this->chargerDonnees($url);
55
	}
86
	}
-
 
87
	
-
 
88
	private function getUrlImages() {
-
 
89
		$tpl = Config::get('imagesTpl');
-
 
90
		$params = array('projet' => $this->getProjet(), 'limite' => $this->limite, 'depart' => $this->depart);
-
 
91
		$url = $this->formaterUrl($tpl, $params);
-
 
92
		return $url;
-
 
93
	}
-
 
94
	
-
 
95
	private function getUrlImagesTaxons() {
-
 
96
		$tpl = Config::get('imagesTaxonsTpl');
-
 
97
		$params = array('projet' => $this->getProjet(),'nntaxon'=> $this->nntaxon);
-
 
98
		$url = $this->formaterUrl($tpl, $params);
-
 
99
		return $url;
-
 
100
	}
56
}
101
}
57
?>
102
?>