Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 495 | Rev 624 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
130 jpm 1
<?php
2
// declare(encoding='UTF-8');
3
/**
4
 * Classe gérant les images.
5
 *
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
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
13
 * @version		$Id$
14
 */
15
class Images extends Eflore {
495 jpm 16
 
339 aurelien 17
	//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
130 jpm 18
	public function getUrlsImagesParIdsNoms(Array $idsNoms) {
19
		$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
20
		$urls = array();
509 jpm 21
		if (count($infosImages) > 0) {
22
			foreach ($infosImages as $img) {
23
				$id = $img['determination.nom_sci.code'];
24
				$urls[$id][] = $img['binaire.href'];
25
			}
130 jpm 26
		}
27
		return $urls;
28
	}
29
 
30
	public function getInfosImagesParIdsNoms(Array $idsNoms) {
31
		$url = $this->getUrlImagesParIdsNoms($idsNoms);
495 jpm 32
		$donnees = $this->chargerDonnees($url);
33
		$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
34
		return $images;
130 jpm 35
	}
495 jpm 36
 
475 delphine 37
	public function getInfosImageParIdImage($id_image) {
38
		$tpl = Config::get('imagesPopupTpl');
495 jpm 39
		$url = $this->formaterUrl($tpl, array('id' => $id_image));
475 delphine 40
		return $this->chargerDonnees($url);
41
	}
130 jpm 42
 
43
	private function getUrlImagesParIdsNoms($idsNoms) {
44
		$tpl = Config::get('imagesResultatsDeterminationTpl');
45
		$params = array('idsNoms' => implode(',', $idsNoms));
46
		$url = $this->formaterUrl($tpl, $params);
47
		return $url;
48
	}
495 jpm 49
 
414 delphine 50
	public function getUrlPremiereImageParIdsNoms($idsNoms) {
51
		$tpl = Config::get('imagesFicheBlocTpl');
52
		$params = array('idsNoms' => implode(',', $idsNoms));
53
		$url = $this->formaterUrl($tpl, $params);
433 delphine 54
		return $this->chargerDonnees($url);
414 delphine 55
	}
130 jpm 56
}
57
?>