Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 1103 | Rev 1115 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1103 Rev 1108
Line 34... Line 34...
34
	public function getDonnees() {
34
	public function getDonnees() {
35
		$this->donnees = array();
35
		$this->donnees = array();
36
		$this->getPhotos();
36
		$this->getPhotos();
37
		$dessin = $this->addDessin();
37
		$dessin = $this->addDessin();
38
		if (!empty($dessin)) {
38
		if (!empty($dessin)) {
39
			array_push($this->donnees, $dessin);	
39
			array_push($this->donnees, $dessin);
40
		}
40
		}
Line 41... Line 41...
41
 
41
 
42
		return $this->donnees;
42
		return $this->donnees;
43
	}
43
	}
44
	
44
 
45
	public function getPhotos() {
45
	public function getPhotos() {
46
		$url_picto = $this->obtenirUrlPicto();
46
		$url_picto = $this->obtenirUrlPicto();
47
		$obj =  json_decode(file_get_contents($url_picto), true);
47
		$obj = json_decode(file_get_contents($url_picto), true);
48
		
48
 
49
		$arr = $obj['resultats'];
49
		$listePhotos = $obj['resultats'];
50
		//echo '<pre>'.print_r($obj, true).'</pre>';
50
		//echo '<pre>'.print_r($obj, true).'</pre>';
51
		foreach($arr as $index) {
51
		foreach($listePhotos as $index) {
52
			$this->formaterListePhotos($index);
52
			$this->formaterListePhotos($index);
53
		}
53
		}
Line 54... Line 54...
54
	}
54
	}
55
 
55
 
56
	
56
 
57
	public function obtenirUrlPicto() {
57
	public function obtenirUrlPicto() {
58
		//TODO : passer les valeurs dans le fichier de config
58
		//TODO : passer les valeurs dans le fichier de config
59
		$url_picto = "http://www.tela-botanica.org/eflore/del/services/0.1/images?navigation.depart=0"
59
		$url_picto = "http://www.tela-botanica.org/eflore/del/services/0.1/images?navigation.depart=0"
60
					."&navigation.limite=4&masque.nn=".$this->nomCourant->getNnr()
60
					."&navigation.limite=4&masque.nn=".$this->nomCourant->getNnr()
61
					."&tri=votes&ordre=desc&protocole=3&format=CRS";
61
					."&tri=votes&ordre=desc&protocole=3&format=CRS";
62
	
62
 
63
		return ($url_picto);
63
		return ($url_picto);
64
	}
64
	}
65
	
65
 
66
	private function formaterListePhotos($images) {
66
	private function formaterListePhotos($images) {
67
		$infosImg['src'] = $images['binaire.href'];
67
		$infosImg['src'] = $images['binaire.href'];
68
	
68
 
69
		$obs = $images['observation'];
69
		$obs = $images['observation'];
70
		if ($obs['auteur.nom'] != '') {
70
		if ($obs['auteur.nom'] != '') {
71
			$infosImg['legende']['titre'] = $obs['auteur.nom'];
71
			$infosImg['legende']['titre'] = $obs['auteur.nom'];
72
			if ($obs['auteur.prenom'] != '') {
72
			if ($obs['auteur.prenom'] != '') {
73
				$infosImg['legende']['titre'] .= ' '.$obs['auteur.prenom'];
73
				$infosImg['legende']['titre'] .= ' '.$obs['auteur.prenom'];
74
			}
74
			}
75
		} else {
75
		} else {
76
			$infosImg['legende']['titre'] = "Anonyme";
76
			$infosImg['legende']['titre'] = "Anonyme";
77
		}
77
		}
78
		
78
 
79
		if ($obs['date_observation'] != '') {
79
		if ($obs['date_observation'] != '') {
80
			$infosImg['legende']['titre'] .= ", le ".$this->formaterDateImg($obs['date_observation']);
80
			$infosImg['legende']['titre'] .= ", le ".$this->formaterDateImg($obs['date_observation']);
81
		}
81
		}
82
		
82
 
83
		if ($obs['zone_geo'] != '') {
83
		if ($obs['zone_geo'] != '') {
84
			$infosImg['legende']['texte'] = $obs['zone_geo'];
84
			$infosImg['legende']['texte'] = $obs['zone_geo'];
85
			if ($obs['lieudit'] != '') {
85
			if ($obs['lieudit'] != '') {
86
				$infosImg['legende']['texte'] .= ' ('.$obs['lieudit'].')';
86
				$infosImg['legende']['texte'] .= ' ('.$obs['lieudit'].')';
87
			}
87
			}
88
		} else {
88
		} else {
89
			$infosImg['legende']['texte'] = "&nbsp;";
89
			$infosImg['legende']['texte'] = "&nbsp;";
90
		}
90
		}
91
		
91
 
Line 92... Line 92...
92
		array_push($this->donnees, $infosImg);
92
		array_push($this->donnees, $infosImg);
93
	}
93
	}
Line 99... Line 99...
99
		} else {
99
		} else {
100
			$dateFmt = strftime('%e %B %Y', strtotime($date));
100
			$dateFmt = strftime('%e %B %Y', strtotime($date));
101
		}
101
		}
102
		return $dateFmt;
102
		return $dateFmt;
103
	}
103
	}
104
	
104
 
105
	public function addDessin() {
105
	public function addDessin() {
106
		$img = array();
106
		$img = array();
107
		$projet = Config::get($this->referentiel.'.baseDessins');
107
		$projet = Config::get($this->referentiel.'.baseDessins');
108
		if ($projet != "") {
108
		if ($projet != "") {
109
			$dessin = array();
109
			$dessin = array();
110
			$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
110
			$tax = $this->nomCourant->getNomRetenu()->get('num_taxonomique');
111
			$this->images->setProjet($projet);
111
			$this->images->setProjet($projet);
112
			$this->images->setNnTaxon($tax);
112
			$this->images->setNnTaxon($tax);
113
			$costeImg = $this->images->getInfosImagesTaxons();
113
			$costeImg = $this->images->getInfosImagesTaxons();
114
			
114
 
115
			if (count($costeImg) != 0) {
115
			if (count($costeImg) != 0) {
116
				$img['src'] = $costeImg[key($costeImg)]['binaire.href'];
116
				$img['src'] = $costeImg[key($costeImg)]['binaire.href'];
117
				$img['legende']['titre'] = "Illustration de Coste";
117
				$img['legende']['titre'] = "Illustration de Coste";
118
				$img['legende']['texte'] = "&nbsp;";
118
				$img['legende']['texte'] = "&nbsp;";
119
			}
119
			}