Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 282 Rev 312
Line 26... Line 26...
26
		$this->urls = (is_null($urls)) ? new AppUrls() : $urls;
26
		$this->urls = (is_null($urls)) ? new AppUrls() : $urls;
27
		$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine;
27
		$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine;
28
		$this->imagesService = is_null($imagesService) ? new Images($this->parametres->projetImg) : $imagesService;
28
		$this->imagesService = is_null($imagesService) ? new Images($this->parametres->projetImg) : $imagesService;
29
		$this->chargerRepartition();
29
		$this->chargerRepartition();
30
	}
30
	}
31
	
31
 
32
	private function chargerRepartition($nn) {
32
	private function chargerRepartition($nn) {
33
		$serviceRepartition = new Cartes('chorodep', $nn, 'nn', "108x101");
33
		$conteneur = new Conteneur();
34
		$urlPng = $serviceRepartition->getUrlPng();
34
		$cartesWs = $conteneur->getApiCartes();
-
 
35
		$cartesWs->setProjet('chorodep');
-
 
36
		$cartesWs->setLargeur('108x101');
35
		return $urlPng;
37
		$urls = array();
-
 
38
		Debug::printr($this->noms);
-
 
39
		foreach ($this->noms as $nom) {
-
 
40
			if (array_key_exists('nom_retenu.code', $nom)) {
-
 
41
				$id = $nom['nom_retenu.code'];
-
 
42
				$id = $this->supprimerCodeReftax($id);
-
 
43
				$cartesWs->setId("nn:$id");
-
 
44
				if (array_key_exists($id, $urls) == false) {
-
 
45
					$urls[$id] = $cartesWs->getUrlPng();
-
 
46
				}
-
 
47
			}
-
 
48
		}
-
 
49
		$this->infosPourTpl['repartition']['urls'] = $urls;
36
	}
50
	}
Line 37... Line 51...
37
 
51
 
38
	public function getTplInfos() {
52
	public function getTplInfos() {
39
		return $this->infosPourTpl;
53
		return $this->infosPourTpl;
Line 70... Line 84...
70
		}
84
		}
71
		return $nns;
85
		return $nns;
72
	}
86
	}
Line 73... Line 87...
73
 
87
 
74
	private function supprimerCodeReftaxDesUrls($urls) {
-
 
75
		$codeReftax = $this->parametres->reftaxCourant.'.';
88
	private function supprimerCodeReftaxDesUrls($urls) {
76
		$urlsNettoyees = array();
89
				$urlsNettoyees = array();
77
		foreach ($urls as $id => $url) {
90
		foreach ($urls as $id => $url) {
78
			$id = str_replace($codeReftax, '', $id);
91
			$id = $this->supprimerCodeReftax($id);
79
			$urlsNettoyees[$id] = $url;
92
			$urlsNettoyees[$id] = $url;
80
		}
93
		}
81
		return $urlsNettoyees;
94
		return $urlsNettoyees;
82
	}
95
	}
-
 
96
 
-
 
97
	private function supprimerCodeReftax($chaine) {
-
 
98
		$codeReftax = $this->parametres->reftaxCourant.'.';
-
 
99
		$chaine = str_replace($codeReftax, '', $chaine);
-
 
100
		return $chaine;
-
 
101
	}
Line 83... Line 102...
83
	
102
 
84
 
103
 
85
	private function extraireInfosNomsPourTplDetermination() {
104
	private function extraireInfosNomsPourTplDetermination() {
86
		$taxons = array();
105
		$taxons = array();
Line 98... Line 117...
98
			$nom_verna['nom_vernaculaire'] = $nom['nom_vernaculaire'];
117
			$nom_verna['nom_vernaculaire'] = $nom['nom_vernaculaire'];
99
			$taxons[$nn]['nomVerna'][] = $nom_verna;
118
			$taxons[$nn]['nomVerna'][] = $nom_verna;
100
		}
119
		}
101
		$this->infosPourTpl['noms'] = (count($taxons) > 0) ? $taxons : false;
120
		$this->infosPourTpl['noms'] = (count($taxons) > 0) ? $taxons : false;
102
	}
121
	}
103
	
122
 
104
	private function supprimerCodeReftaxDesNns($nn) {
123
	private function supprimerCodeReftaxDesNns($nn) {
105
		$codeReftax = $this->parametres->reftaxCourant.'.nn:';
124
		$codeReftax = $this->parametres->reftaxCourant.'.nn:';
106
		return str_replace($codeReftax, '', $nn);
125
		return str_replace($codeReftax, '', $nn);
107
	}
126
	}
108
	
127
 
Line 109... Line 128...
109
 
128
 
Line 110... Line 129...
110
	public function trier() {
129
	public function trier() {
Line 118... Line 137...
118
				$nom['nomVerna'][$idVerna]['nom_vernaculaire'] = $this->surlignerMotsMasqueRecherche($nomVerna['nom_vernaculaire']);
137
				$nom['nomVerna'][$idVerna]['nom_vernaculaire'] = $this->surlignerMotsMasqueRecherche($nomVerna['nom_vernaculaire']);
119
			}
138
			}
120
			$this->infosPourTpl['noms'][$idNom] = $nom;
139
			$this->infosPourTpl['noms'][$idNom] = $nom;
121
		}
140
		}
122
	}
141
	}
123
	
142
 
124
	private function definirMotsASurligner() {
143
	private function definirMotsASurligner() {
125
		$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche);
144
		$this->motsASurligner = explode(' ', $this->parametres->masqueRecherche);
126
	}
145
	}
127
	
146
 
128
	private function surlignerMotsMasqueRecherche($nom) {
147
	private function surlignerMotsMasqueRecherche($nom) {
129
		$this->surligneur->setTexte($nom);
148
		$this->surligneur->setTexte($nom);
130
		$nom = $this->surligneur->surlignerMots($this->motsASurligner);
149
		$nom = $this->surligneur->surlignerMots($this->motsASurligner);
131
		return $nom;
150
		return $nom;
132
	}
151
	}