Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 130 Rev 132
Line 13... Line 13...
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Resultat extends aControleur {
15
class Resultat extends aControleur {
Line 16... Line 16...
16
 
16
 
-
 
17
	private $resultatType = 'determination';
-
 
18
	private $projetImg = 'cel';
Line 17... Line 19...
17
	private $resultatType = 'determination';
19
	private $reftaxCourant = 'bdtfx';
18
 
20
 
-
 
21
	public function initialiser() {
-
 
22
		$this->capturerParametres();
19
	public function initialiser() {
23
		$this->reftaxCourant = Registre::get('parametres.referentiel');
Line 20... Line 24...
20
		$this->capturerParametres();
24
		$this->projetImg = Config::get($this->reftaxCourant.'.referentielImages');
21
	}
25
	}
22
 
26
 
Line 84... Line 88...
84
		return $noms;
88
		return $noms;
85
	}
89
	}
Line 86... Line 90...
86
 
90
 
87
	private function genererListeDetermination($resultats) {
91
	private function genererListeDetermination($resultats) {
88
		$donnees = array();
92
		$donnees = array();
89
		$donnees['imagesUrls'] = $this->obtenirUrlsImages($resultats);
93
		$donnees['imagesUrls'] = $this->obtenirUrlsPhotos($resultats);
90
		$donnees['noms'] = $this->trierSynonymes($resultats);
94
		$donnees['noms'] = $this->trierSynonymes($resultats);
91
		return $this->getVue('resultat_determination_noms', $donnees);
95
		return $this->getVue('resultat_determination_noms', $donnees);
Line 92... Line 96...
92
	}
96
	}
-
 
97
 
-
 
98
	private function obtenirUrlsPhotos($noms) {
-
 
99
		$ids = $this->extraireIdDesNoms($noms);
-
 
100
		$Images = new Images($this->projetImg);
-
 
101
		$urls = $Images->getUrlsImagesParIdsNoms($ids);
-
 
102
		$urlsReftaxCourant = $this->supprimerCodeReftaxDesIds($urls);
-
 
103
		return $urlsReftaxCourant;
-
 
104
	}
93
 
105
 
94
	private function obtenirUrlsImages($noms) {
106
	private function extraireIdDesNoms($noms) {
95
		$ids = array();
107
		$ids = array();
96
		foreach ($noms as $id => $nom) {
108
		foreach ($noms as $id => $nom) {
97
			$ids[] = $id;
-
 
98
		}
-
 
99
		$reftax = Registre::get('parametres.referentiel');
109
			$ids[] = $id;
-
 
110
		}
-
 
111
		return $ids;
100
		$projetImg = Config::get("$reftax.referentielImages");
112
	}
101
		$Images = new Images($projetImg);
113
 
102
		$urls = $Images->getUrlsImagesParIdsNoms($ids);
114
	private function supprimerCodeReftaxDesIds($urls) {
103
		$urlsReftaxCourant = array();
115
		$codeReftax = $this->reftaxCourant.'.';
104
		foreach ($urls as $id => $url) {
116
		foreach ($urls as $id => $url) {
105
			$id = str_replace("$reftax.", '', $id);
117
			$id = str_replace($codeReftax, '', $id);
106
			$urlsReftaxCourant[$id] = $url;
118
			$urls[$id] = $url;
107
		}
119
		}
Line 108... Line 120...
108
		return $urlsReftaxCourant;
120
		return $urls;
109
	}
121
	}
110
 
122
 
Line 132... Line 144...
132
				}
144
				}
Line 133... Line 145...
133
 
145
 
134
			}
146
			}
135
		}
147
		}
-
 
148
		$nomsRetenus = Tableau::trierMD($nomsRetenus, array('nom_sci_retenu' => SORT_ASC));
136
		$nomsRetenus = Tableau::trierMD($nomsRetenus, array('nom_sci_retenu' => SORT_ASC));
149
		if (count($nomsSansCorrespondance) > 0) {
-
 
150
			$nomsRetenus['nsc']['liste'] = $nomsSansCorrespondance;
137
		$nomsRetenus['nsc']['liste'] = $nomsSansCorrespondance;
151
		}
138
		return $nomsRetenus;
152
		return $nomsRetenus;
Line 139... Line 153...
139
	}
153
	}
140
 
154