Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 163 Rev 199
Line 35... Line 35...
35
	public function getTplNom() {
35
	public function getTplNom() {
36
		return self::TPL_VUE;
36
		return self::TPL_VUE;
37
	}
37
	}
Line 38... Line 38...
38
 
38
 
-
 
39
	public function formater() {
39
	public function formater() {
40
		$this->obtenirUrlsPhotos();
40
		$this->infosPourTpl['noms'] = false;
41
		$this->extraireInfosNomsPourTplDetermination();
Line -... Line 42...
-
 
42
	}
-
 
43
 
-
 
44
	private function obtenirUrlsPhotos() {
-
 
45
		$nns = $this->extraireNnDesNoms();
-
 
46
 
-
 
47
		$urls = $this->imagesService->getUrlsImagesParIdsNoms($nns);
-
 
48
 
-
 
49
		$this->infosPourTpl['imagesUrls'] = $this->supprimerCodeReftaxDesUrls($urls);
-
 
50
	}
-
 
51
 
-
 
52
	private function extraireNnDesNoms() {
-
 
53
		$nns = array();
-
 
54
		foreach ($this->noms as $id => $nom) {
-
 
55
			if (array_key_exists('nom_retenu.code', $nom)) {
-
 
56
				if (in_array($nom['nom_retenu.code'], $nns) == false) {
-
 
57
					$idAAjouter = $this->supprimerCodeReftaxDesNns($nom['nom_retenu.code']);
-
 
58
					if (is_numeric($idAAjouter)) {
-
 
59
						$nns[] = $idAAjouter;
-
 
60
					}
-
 
61
				}
-
 
62
			}
-
 
63
		}
-
 
64
		return $nns;
-
 
65
	}
-
 
66
 
-
 
67
	private function supprimerCodeReftaxDesUrls($urls) {
-
 
68
		$codeReftax = $this->parametres->reftaxCourant.'.';
-
 
69
		$urlsNettoyees = array();
-
 
70
		foreach ($urls as $id => $url) {
-
 
71
			$id = str_replace($codeReftax, '', $id);
-
 
72
			$urlsNettoyees[$id] = $url;
-
 
73
		}
-
 
74
		return $urlsNettoyees;
-
 
75
	}
-
 
76
	
-
 
77
 
-
 
78
	private function extraireInfosNomsPourTplDetermination() {
-
 
79
		$taxons = array();
-
 
80
		foreach ($this->noms as $idNomCourant => $nom) {
-
 
81
			$nn = $this->supprimerCodeReftaxDesNns($nom['nom_retenu.code']);
-
 
82
			if (array_key_exists($nn, $taxons) == false) {
-
 
83
				$taxon = array();
-
 
84
				$taxon['nomSci'] = $nom['taxon'];
-
 
85
				$taxon['urlFiche'] = $this->urls->obtenirUrlFiche($nn);
-
 
86
				$taxons[$nn] = $taxon;
-
 
87
			}
-
 
88
			$nom_verna = array();
-
 
89
			$nom_verna['nn'] = $nom['id'];
-
 
90
			$nom_verna['nom_vernaculaire'] = $nom['nom_vernaculaire'];
-
 
91
			$taxons[$nn]['nomVerna'][] = $nom_verna;
-
 
92
		}
-
 
93
		$this->infosPourTpl['noms'] = (count($taxons) > 0) ? $taxons : false;
-
 
94
	}
-
 
95
	
-
 
96
	private function supprimerCodeReftaxDesNns($nn) {
-
 
97
		$codeReftax = $this->parametres->reftaxCourant.'.nn:';
-
 
98
		return str_replace($codeReftax, '', $nn);
-
 
99
	}
41
	}
100
	
Line 42... Line 101...
42
 
101
 
Line 43... Line 102...
43
	public function trier() {
102
	public function trier() {