Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 1115 Rev 1357
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
	private $referentiel = 'bdtfx';
22
	private $referentiel = 'bdtfx';
23
	private $donnees = array();
23
	private $donnees = array();
24
 
24
 
25
	public function __construct(Conteneur $conteneur) {
25
	public function __construct(Conteneur $conteneur) {
26
		$this->conteneur = $conteneur;
26
		$this->conteneur = $conteneur;
27
		$this->nomCourant = $this->conteneur->getNomCourant();
27
		$this->nomCourant = $this->conteneur->getNomCourant();
28
		$this->referentiel = $this->conteneur->getParametre('referentiel');
28
		$this->referentiel = $this->conteneur->getParametre('referentiel');
29
		$this->images = $this->conteneur->getApiImages();
29
		$this->images = $this->conteneur->getApiImages();
30
		$this->appUrls = $this->conteneur->getAppUrls();
30
		$this->appUrls = $this->conteneur->getAppUrls();
31
		$this->meta = $this->conteneur->getApiMetaDonnees();
31
		$this->meta = $this->conteneur->getApiMetaDonnees();
32
 
32
 
33
		$this->images->setApi(Images::API_DEL);
33
		$this->images->setApi(Images::API_DEL);
34
	}
34
	}
35
 
35
 
36
	public function getDonnees() {
36
	public function getDonnees() {
37
		$this->donnees = array();
37
		$this->donnees = array();
38
		$this->getPhotos();
38
		$this->getPhotos();
39
		$dessin = $this->addDessin();
39
		$dessin = $this->addDessin();
40
		if (!empty($dessin)) {
40
		if (!empty($dessin)) {
41
			array_push($this->donnees, $dessin);
41
			array_push($this->donnees, $dessin);
42
		}
42
		}
43
 
43
 
44
		return $this->donnees;
44
		return $this->donnees;
45
	}
45
	}
46
 
46
 
47
	public function getPhotos() {
47
	public function getPhotos() {
48
		$listePhotos = $this->images->getInfosImagesGalerieMobile($this->nomCourant->getNnr());
48
		$listePhotos = $this->images->getInfosImagesGalerieMobile($this->nomCourant->getNnr());
49
		foreach($listePhotos as $index) {
49
		foreach($listePhotos as $index) {
50
			$this->formaterListePhotos($index);
50
			$this->formaterListePhotos($index);
51
		}
51
		}
52
	}
52
	}
53
 
53
 
54
	private function formaterListePhotos($images) {
54
	private function formaterListePhotos($images) {
55
		$infosImg['src'] = $images['binaire.href'];
55
		$infosImg['src'] = $images['binaire.href'];
56
 
56
 
57
		$obs = $images['observation'];
57
		$obs = $images['observation'];
58
		if ($obs['auteur.nom'] != '') {
58
		if ($obs['auteur.nom'] != '') {
59
			$infosImg['legende']['titre'] = $obs['auteur.nom'];
59
			$infosImg['legende']['titre'] = $obs['auteur.nom'];
60
			if ($obs['auteur.prenom'] != '') {
60
			if ($obs['auteur.prenom'] != '') {
61
				$infosImg['legende']['titre'] .= ' '.$obs['auteur.prenom'];
61
				$infosImg['legende']['titre'] .= ' '.$obs['auteur.prenom'];
62
			}
62
			}
63
		} else {
63
		} else {
64
			$infosImg['legende']['titre'] = "Anonyme";
64
			$infosImg['legende']['titre'] = "Anonyme";
65
		}
65
		}
66
 
66
 
67
		if ($obs['date_observation'] != '') {
67
		if ($obs['date_observation'] != '') {
68
			$infosImg['legende']['titre'] .= ", le ".$this->formaterDateImg($obs['date_observation']);
68
			$infosImg['legende']['titre'] .= ", le ".$this->formaterDateImg($obs['date_observation']);
69
		}
69
		}
70
 
70
 
71
		if ($obs['zone_geo'] != '') {
71
		if ($obs['zone_geo'] != '') {
72
			$infosImg['legende']['texte'] = $obs['zone_geo'];
72
			$infosImg['legende']['texte'] = $obs['zone_geo'];
73
			if ($obs['lieudit'] != '') {
73
			if ($obs['lieudit'] != '') {
74
				$infosImg['legende']['texte'] .= ' ('.$obs['lieudit'].')';
74
				$infosImg['legende']['texte'] .= ' ('.$obs['lieudit'].')';
75
			}
75
			}
76
		} else {
76
		} else {
77
			$infosImg['legende']['texte'] = "&nbsp;";
77
			$infosImg['legende']['texte'] = "&nbsp;";
78
		}
78
		}
79
 
79
 
80
		array_push($this->donnees, $infosImg);
80
		array_push($this->donnees, $infosImg);
81
	}
81
	}
82
 
82
 
83
	private function formaterDateImg($date) {
83
	private function formaterDateImg($date) {
84
		$dateFmt = $date;
84
		$dateFmt = $date;
85
		if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
85
		if ($date == '0000-00-00' || $date == '1970-01-01 01:01:01') {
86
			$dateFmt = 'inconnue';
86
			$dateFmt = 'inconnue';
87
		} else {
87
		} else {
88
			$dateFmt = strftime('%e %B %Y', strtotime($date));
88
			$dateFmt = strftime('%e %B %Y', strtotime($date));
89
		}
89
		}
90
		return $dateFmt;
90
		return $dateFmt;
91
	}
91
	}
92
 
92
 
93
	public function addDessin() {
93
	public function addDessin() {
94
		$img = array();
94
		$img = array();
95
		$projet = Config::get($this->referentiel.'.baseDessins');
95
		$projet = Config::get($this->referentiel.'.baseDessins');
96
		if ($projet != "") {
96
		if ($projet != "") {
97
			$dessin = array();
97
			$dessin = array();
98
			$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
98
			$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
99
			$this->images->setProjet($projet);
99
			$this->images->setProjet($projet);
100
			$this->images->setNnTaxon($tax);
100
			$this->images->setNnTaxon($tax);
-
 
101
			if ($this->referentiel == 'bdtfx') {
101
			$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
102
				$costeImg = $this->images->setApi(Eflore::API_EFLORE)->getInfosImagesTaxons();
102
			$this->images->setApi(Eflore::API_DEL);
103
				$this->images->setApi(Eflore::API_DEL);
103
 
-
 
104
			if (count($costeImg) != 0) {
104
				if (count($costeImg) != 0) {
105
				$img['src'] = $costeImg[key($costeImg)]['binaire.href'];
105
					$img['src'] = $costeImg[key($costeImg)]['binaire.href'];
106
				$img['legende']['titre'] = "Illustration de Coste";
106
					$img['legende']['titre'] = "Illustration de Coste";
107
				$img['legende']['texte'] = "&nbsp;";
107
					$img['legende']['texte'] = "&nbsp;";
-
 
108
				}
108
			}
109
			}
109
		}
110
		}
110
 
111
 
111
		return $img;
112
		return $img;
112
	}
113
	}
113
}
114
}
114
?>
115
?>