Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 478 Rev 482
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
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 Illustrations extends aControleur {
15
class Illustrations extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $images = null;
19
	private $images = null;
20
	private $appUrls = null;
20
	private $appUrls = null;
21
	private $meta = null;
21
	private $meta = null;
22
 
22
 
23
	public function __construct(Conteneur $conteneur) {
23
	public function __construct(Conteneur $conteneur) {
24
		$this->conteneur = $conteneur;
24
		$this->conteneur = $conteneur;
25
		$this->nomCourant = $this->conteneur->getNomCourant();
25
		$this->nomCourant = $this->conteneur->getNomCourant();
26
		$this->images = $this->conteneur->getApiImages();
26
		$this->images = $this->conteneur->getApiImages();
27
		$this->appUrls = $this->conteneur->getAppUrls();
27
		$this->appUrls = $this->conteneur->getAppUrls();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
28
		$this->meta = $this->conteneur->getApiMetaDonnees();
29
	}
29
	}
30
 
30
 
31
	public function obtenirDonnees() {
31
	public function obtenirDonnees() {
32
		$donnees = array();
32
		$donnees = array();
33
		$donnees['cel'] = $this->getCel();
33
		$donnees['cel'] = $this->getCel();
34
		$donnees['photoflora'] = $this->getPhotoFlora();
34
		$donnees['photoflora'] = $this->getPhotoFlora();
35
		return $donnees;
35
		return $donnees;
36
	}
36
	}
37
 
37
 
38
	public function getBloc() {
38
	public function getBloc() {
39
		$this->images->setProjet('cel');
39
		$this->images->setProjet('cel');
40
		$nnr = $this->nomCourant->getNnr();
40
		$nnr = $this->nomCourant->getNnr();
41
		$infos_image = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
41
		$infos_image = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
42
		if (!$infos_image || $infos_image['entete']['total'] == 0) {
42
		if (!$infos_image || $infos_image['entete']['total'] == 0) {
43
			$this->images->setProjet('photoflora');
43
			$this->images->setProjet('photoflora');
44
			$nnr = $this->nomCourant->getNnr();
44
			$nnr = $this->nomCourant->getNnr();
45
			$infos_image = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
45
			$infos_image = $this->images->getUrlPremiereImageParIdsNoms(array($nnr));
46
		}
46
		}
47
 
47
 
48
		$image = array_shift($infos_image['resultats']);
48
		$image = array_shift($infos_image['resultats']);
49
		$donnees['imageUrl'] = $image['binaire.href'];
49
		$donnees['imageUrl'] = $image['binaire.href'];
50
		return $donnees;
50
		return $donnees;
51
	}
51
	}
52
 
52
 
53
	public function getPhotoFlora() {
53
	public function getPhotoFlora() {
54
		$photoflora = array();
54
		$photoflora = array();
55
		$this->images->setProjet('photoflora');
55
		$this->images->setProjet('photoflora');
56
		$nnr = $this->nomCourant->getNnr();
56
		$nnr = $this->nomCourant->getNnr();
57
		$images = $this->images->getInfosImagesParIdsNoms(array($nnr));
57
		$images = $this->images->getInfosImagesParIdsNoms(array($nnr));
58
		$photoflora['images'] = $images['resultats'];
58
		$photoflora['images'] = $images['resultats'];
59
 
59
 
60
		$this->meta->setProjet('photoflora');
60
		$this->meta->setProjet('photoflora');
61
		$meta = $this->meta->getMetaDonnees();
61
		$meta = $this->meta->getMetaDonnees();
62
		$titreMeta = $meta[0]['titre'];
62
		$titreMeta = $meta[0]['titre'];
63
		$photoflora['meta']['titre'] = $titreMeta;
63
		$photoflora['meta']['titre'] = $titreMeta;
64
		$photoflora['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('photoflora');
64
		$photoflora['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('photoflora');
65
 
65
 
66
		return $photoflora;
66
		return $photoflora;
67
	}
67
	}
68
 
68
 
69
	public function getCel() {
69
	public function getCel() {
70
		$cel = array();
70
		$cel = array();
71
		$this->images->setProjet('cel');
71
		$this->images->setProjet('cel');
72
		$nnr = $this->nomCourant->getNnr();
72
		$nnr = $this->nomCourant->getNnr();
73
		$images = $this->images->getInfosImagesParIdsNoms(array($nnr));
73
		$images = $this->images->getInfosImagesParIdsNoms(array($nnr));
74
		foreach ($images['resultats'] as $idImg => $img) {
74
		foreach ($images['resultats'] as $idImg => $img) {
75
			$cel['images'][$idImg] = $img;
75
			$cel['images'][$idImg] = $img;
76
			$cel['images'][$idImg]['url.pop-up'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
76
			$cel['images'][$idImg]['url.pop-up.img'] = $this->appUrls->obtenirUrlPopUpIllustrations($idImg);
-
 
77
			$cel['images'][$idImg]['url.pop-up.contact'] = $this->appUrls->obtenirUrlPopUpContact($img['auteur.id']);
77
		}
78
		}
78
 
79
 
79
		$this->meta->setProjet('cel');
80
		$this->meta->setProjet('cel');
80
		$meta = $this->meta->getMetaDonnees();
81
		$meta = $this->meta->getMetaDonnees();
81
		$titreMeta = $meta[0]['titre'];
82
		$titreMeta = $meta[0]['titre'];
82
		$cel['meta']['titre'] = $titreMeta;
83
		$cel['meta']['titre'] = $titreMeta;
83
		$cel['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('cel');
84
		$cel['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('cel');
84
 
85
 
85
		return $cel;
86
		return $cel;
86
	}
87
	}
87
}
88
}
88
?>
89
?>