Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 495 Rev 509
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
 
16
 
17
	//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
17
	//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
18
	public function getUrlsImagesParIdsNoms(Array $idsNoms) {
18
	public function getUrlsImagesParIdsNoms(Array $idsNoms) {
19
		$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
19
		$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
20
		$urls = array();
20
		$urls = array();
-
 
21
		if (count($infosImages) > 0) {
21
		foreach ($infosImages['resultats'] as $img) {
22
			foreach ($infosImages as $img) {
22
			$id = $img['determination.nom_sci.code'];
23
				$id = $img['determination.nom_sci.code'];
23
			$urls[$id][] = $img['binaire.href'];
24
				$urls[$id][] = $img['binaire.href'];
-
 
25
			}
24
		}
26
		}
25
		return $urls;
27
		return $urls;
26
	}
28
	}
27
 
29
 
28
	public function getInfosImagesParIdsNoms(Array $idsNoms) {
30
	public function getInfosImagesParIdsNoms(Array $idsNoms) {
29
		$url = $this->getUrlImagesParIdsNoms($idsNoms);
31
		$url = $this->getUrlImagesParIdsNoms($idsNoms);
30
		$donnees = $this->chargerDonnees($url);
32
		$donnees = $this->chargerDonnees($url);
31
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
33
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
32
		return $images;
34
		return $images;
33
	}
35
	}
34
 
36
 
35
	public function getInfosImageParIdImage($id_image) {
37
	public function getInfosImageParIdImage($id_image) {
36
		$tpl = Config::get('imagesPopupTpl');
38
		$tpl = Config::get('imagesPopupTpl');
37
		$url = $this->formaterUrl($tpl, array('id' => $id_image));
39
		$url = $this->formaterUrl($tpl, array('id' => $id_image));
38
		return $this->chargerDonnees($url);
40
		return $this->chargerDonnees($url);
39
	}
41
	}
40
 
42
 
41
	private function getUrlImagesParIdsNoms($idsNoms) {
43
	private function getUrlImagesParIdsNoms($idsNoms) {
42
		$tpl = Config::get('imagesResultatsDeterminationTpl');
44
		$tpl = Config::get('imagesResultatsDeterminationTpl');
43
		$params = array('idsNoms' => implode(',', $idsNoms));
45
		$params = array('idsNoms' => implode(',', $idsNoms));
44
		$url = $this->formaterUrl($tpl, $params);
46
		$url = $this->formaterUrl($tpl, $params);
45
		return $url;
47
		return $url;
46
	}
48
	}
47
 
49
 
48
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
50
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
49
		$tpl = Config::get('imagesFicheBlocTpl');
51
		$tpl = Config::get('imagesFicheBlocTpl');
50
		$params = array('idsNoms' => implode(',', $idsNoms));
52
		$params = array('idsNoms' => implode(',', $idsNoms));
51
		$url = $this->formaterUrl($tpl, $params);
53
		$url = $this->formaterUrl($tpl, $params);
52
		return $this->chargerDonnees($url);
54
		return $this->chargerDonnees($url);
53
	}
55
	}
54
}
56
}
55
?>
57
?>