Rev 163 | Rev 798 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
class AlphabVernaFormateur implements Formateur {
const TPL_VUE = 'liste_noms_verna';
private $parametres = null;
private $surligneur = null;
private $trieur = null;
private $urls = null;
private $fusioneur = null;
private $manipulateurDeChaine = null;
private $imagesService = null;
private $motsASurligner = array();
private $noms = array();
private $infosPourTpl = array();
public function __construct(ParametresResultats $parametres, Array $resultats,
Surligneur $surligneur = null, Trieur $trieur = null, AppUrls $urls = null,
ChaineManipulateur $manipulateurDeChaine = null, Images $imagesService = null) {
$this->parametres = $parametres;
$this->noms = $resultats['resultat'];
$this->surligneur = (is_null($surligneur)) ? new Surligneur() : $surligneur;
$this->trieur = (is_null($trieur)) ? new Trieur() : $trieur;
$this->urls = (is_null($urls)) ? new AppUrls() : $urls;
$this->manipulateurDeChaine = is_null($manipulateurDeChaine) ? new ChaineManipulateur() : $manipulateurDeChaine;
$this->imagesService = is_null($imagesService) ? new Images($this->parametres->projetImg) : $imagesService;
}
public function getTplInfos() {
return $this->infosPourTpl;
}
public function getTplNom() {
return self::TPL_VUE;
}
private function supprimerCodeReftaxAvecNn($nn) {
$codeReftax = $this->parametres->reftaxCourant.'.nn:';
return str_replace($codeReftax, '', $nn);
}
public function formater() {
foreach ($this->noms as $id => $nom) {
$nn = $this->supprimerCodeReftaxAvecNn($nom['nom_retenu.code']);
$infosDuNom = array();
$infosDuNom['nomSci'] = $nom['taxon'];
$infosDuNom['nomVerna'] = $nom['nom_vernaculaire'];
$infosDuNom['langue'] = $nom['code_langue'];
$infosDuNom['geo'] = $nom['zone_usage'];
$infosDuNom['urlFiche'] = $this->urls->obtenirUrlFiche($nn, $this->parametres->typeNom, $this->parametres->masqueRecherche);
$this->infosPourTpl['noms'][$nn] = $infosDuNom;
}
}
public function trier() {
$this->trieur->setTableau($this->infosPourTpl['noms']);
$this->trieur->setChampsEtOrdres(array('nomVerna'=> SORT_NATURAL));
$this->infosPourTpl['noms'] = $this->trieur->trier();
}
public function surligner() {
}
}
?>