Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 198 → Rev 199

/trunk/modules/resultat/formateurs/nom_vernaculaire/DeterminationVernaFormateur.php
37,9 → 37,68
}
 
public function formater() {
$this->infosPourTpl['noms'] = false;
$this->obtenirUrlsPhotos();
$this->extraireInfosNomsPourTplDetermination();
}
 
private function obtenirUrlsPhotos() {
$nns = $this->extraireNnDesNoms();
 
$urls = $this->imagesService->getUrlsImagesParIdsNoms($nns);
 
$this->infosPourTpl['imagesUrls'] = $this->supprimerCodeReftaxDesUrls($urls);
}
 
private function extraireNnDesNoms() {
$nns = array();
foreach ($this->noms as $id => $nom) {
if (array_key_exists('nom_retenu.code', $nom)) {
if (in_array($nom['nom_retenu.code'], $nns) == false) {
$idAAjouter = $this->supprimerCodeReftaxDesNns($nom['nom_retenu.code']);
if (is_numeric($idAAjouter)) {
$nns[] = $idAAjouter;
}
}
}
}
return $nns;
}
 
private function supprimerCodeReftaxDesUrls($urls) {
$codeReftax = $this->parametres->reftaxCourant.'.';
$urlsNettoyees = array();
foreach ($urls as $id => $url) {
$id = str_replace($codeReftax, '', $id);
$urlsNettoyees[$id] = $url;
}
return $urlsNettoyees;
}
 
private function extraireInfosNomsPourTplDetermination() {
$taxons = array();
foreach ($this->noms as $idNomCourant => $nom) {
$nn = $this->supprimerCodeReftaxDesNns($nom['nom_retenu.code']);
if (array_key_exists($nn, $taxons) == false) {
$taxon = array();
$taxon['nomSci'] = $nom['taxon'];
$taxon['urlFiche'] = $this->urls->obtenirUrlFiche($nn);
$taxons[$nn] = $taxon;
}
$nom_verna = array();
$nom_verna['nn'] = $nom['id'];
$nom_verna['nom_vernaculaire'] = $nom['nom_vernaculaire'];
$taxons[$nn]['nomVerna'][] = $nom_verna;
}
$this->infosPourTpl['noms'] = (count($taxons) > 0) ? $taxons : false;
}
private function supprimerCodeReftaxDesNns($nn) {
$codeReftax = $this->parametres->reftaxCourant.'.nn:';
return str_replace($codeReftax, '', $nn);
}
 
public function trier() {
 
}