Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 990 Rev 1036
Line 41... Line 41...
41
 
41
 
42
		return $this->donnees;
42
		return $this->donnees;
Line 43... Line 43...
43
	}
43
	}
44
	
44
	
45
	public function getPhotos() {
45
	public function getPhotos() {
-
 
46
		$url_picto = $this->obtenirUrlPicto();
46
		$projets[] = Config::get($this->referentiel.'.baseImages');
47
		$obj =  json_decode(file_get_contents($url_picto), true);
47
		$projets[] = Config::get($this->referentiel.'.baseImagesSupp');
48
		
48
		foreach ($projets as $projet) {
49
		$arr = $obj['resultats'];
49
			if ($projet != "") {
50
		//echo '<pre>'.print_r($obj, true).'</pre>';
50
				$images = $this->initialiserPhotos($projet);
-
 
51
				$this->formaterListePhotos($projet, $images);
51
		foreach($arr as $index) {
52
			}
52
			$this->formaterListePhotos($index);
-
 
53
		}
-
 
54
	}
-
 
55
 
-
 
56
	
-
 
57
	public function obtenirUrlPicto() {
-
 
58
		$url_picto = "http://www.tela-botanica.org/eflore/del/services/0.1/images?navigation.depart=0"
Line 53... Line -...
53
		}
-
 
54
	}
-
 
55
	
59
					."&navigation.limite=4&masque.nn=".$this->nomCourant->getNnr()
56
	private function initialiserPhotos($projet) {
-
 
57
		$this->images->setProjet($projet);
60
					."&tri=votes&ordre=desc&protocole=1";
Line 58... Line 61...
58
		$nnr = $this->nomCourant->getNnr();
61
	
59
		return $this->images->getInfosImagesParIdsNoms(array($nnr));
-
 
60
	}
-
 
61
	
62
		return ($url_picto);
62
	private function formaterListePhotos($projet, $images) {
63
	}
63
		$max = Config::get('pictures.number.max');
64
	
64
		foreach ($images as $idImg => $img) {
-
 
65
			$infosImg['src'] = htmlentities($img['binaire.href']);
-
 
66
		
-
 
67
			if ($img['auteur.libelle'] != '') {
-
 
68
				$infosImg['legende']['titre'] = htmlentities($img['auteur.libelle']);
-
 
69
			} else {
65
	private function formaterListePhotos($images) {
70
				$infosImg['legende']['titre'] = "Anonyme";
66
		$infosImg['src'] = $images['binaire.href'];
71
			}
-
 
72
			
-
 
73
			if ($img['date'] != '') {
67
	
74
				$infosImg['legende']['titre'] .= ", le ".htmlentities($this->formaterDateImg($img['date']));
-
 
75
			}
-
 
76
			
68
		$obs = $images['observation'];
77
			if ($img['station.libelle'] != '') {
69
		if ($obs['auteur.nom'] != '') {
-
 
70
			$infosImg['legende']['titre'] = $obs['auteur.nom'];
-
 
71
			if ($obs['auteur.prenom'] != '') {
-
 
72
				$infosImg['legende']['titre'] .= ' '.$obs['auteur.prenom'];
78
				$infosImg['legende']['texte'] = htmlentities($img['station.libelle']);
73
			}
79
			} else {
74
		} else {
-
 
75
			$infosImg['legende']['titre'] = "Anonyme";
-
 
76
		}
-
 
77
		
80
				$infosImg['legende']['texte'] = "&nbsp;";
78
		if ($obs['date_observation'] != '') {
-
 
79
			$infosImg['legende']['titre'] .= ", le ".$this->formaterDateImg($obs['date_observation']);
81
			}
80
		}
-
 
81
		
82
			
82
		if ($obs['zone_geo'] != '') {
-
 
83
			$infosImg['legende']['texte'] = $obs['zone_geo'];
-
 
84
			if ($obs['lieudit'] != '') {
83
			array_push($this->donnees, $infosImg);
85
				$infosImg['legende']['texte'] .= ' ('.$obs['lieudit'].')';
-
 
86
			}
-
 
87
		} else {
84
			if (--$max <= 0) {
88
			$infosImg['legende']['texte'] = "&nbsp;";
Line 85... Line 89...
85
				return null;
89
		}
86
			}
90
		
87
		}
91
		array_push($this->donnees, $infosImg);