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 {
|
624 |
mathilde |
16 |
|
|
|
17 |
private $nntaxon;
|
|
|
18 |
private $limite;
|
|
|
19 |
private $depart;
|
495 |
jpm |
20 |
|
624 |
mathilde |
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 |
}
|
|
|
32 |
|
339 |
aurelien |
33 |
//TODO: créer des fonctions spécifiques cel et photoflora pour plus de clarté ?
|
130 |
jpm |
34 |
public function getUrlsImagesParIdsNoms(Array $idsNoms) {
|
|
|
35 |
$infosImages = $this->getInfosImagesParIdsNoms($idsNoms);
|
|
|
36 |
$urls = array();
|
509 |
jpm |
37 |
if (count($infosImages) > 0) {
|
|
|
38 |
foreach ($infosImages as $img) {
|
|
|
39 |
$id = $img['determination.nom_sci.code'];
|
|
|
40 |
$urls[$id][] = $img['binaire.href'];
|
|
|
41 |
}
|
130 |
jpm |
42 |
}
|
|
|
43 |
return $urls;
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
public function getInfosImagesParIdsNoms(Array $idsNoms) {
|
|
|
47 |
$url = $this->getUrlImagesParIdsNoms($idsNoms);
|
495 |
jpm |
48 |
$donnees = $this->chargerDonnees($url);
|
|
|
49 |
$images = (isset($donnees['resultats'])) ? $donnees['resultats'] : array();
|
|
|
50 |
return $images;
|
130 |
jpm |
51 |
}
|
495 |
jpm |
52 |
|
475 |
delphine |
53 |
public function getInfosImageParIdImage($id_image) {
|
|
|
54 |
$tpl = Config::get('imagesPopupTpl');
|
495 |
jpm |
55 |
$url = $this->formaterUrl($tpl, array('id' => $id_image));
|
475 |
delphine |
56 |
return $this->chargerDonnees($url);
|
|
|
57 |
}
|
624 |
mathilde |
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 |
}
|
130 |
jpm |
72 |
|
624 |
mathilde |
73 |
|
130 |
jpm |
74 |
private function getUrlImagesParIdsNoms($idsNoms) {
|
|
|
75 |
$tpl = Config::get('imagesResultatsDeterminationTpl');
|
|
|
76 |
$params = array('idsNoms' => implode(',', $idsNoms));
|
|
|
77 |
$url = $this->formaterUrl($tpl, $params);
|
|
|
78 |
return $url;
|
|
|
79 |
}
|
495 |
jpm |
80 |
|
414 |
delphine |
81 |
public function getUrlPremiereImageParIdsNoms($idsNoms) {
|
|
|
82 |
$tpl = Config::get('imagesFicheBlocTpl');
|
|
|
83 |
$params = array('idsNoms' => implode(',', $idsNoms));
|
|
|
84 |
$url = $this->formaterUrl($tpl, $params);
|
433 |
delphine |
85 |
return $this->chargerDonnees($url);
|
414 |
delphine |
86 |
}
|
624 |
mathilde |
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 |
}
|
130 |
jpm |
101 |
}
|
|
|
102 |
?>
|