Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 63 → Rev 64

/trunk/modules/liste/Liste.php
17,6 → 17,7
private $alphabet = null;
protected $rang = null;
protected $lettre = null;
private $rangsCorrespondance = array('F' => 'Famille', 'G' => 'Genre');
public function initialiser() {
$this->capturerParametres();
27,13 → 28,8
}
public function executerListe() {
$this->chargerAlphabet();
$this->lettre = key($this->alphabet);
$this->executerFiltre();
}
public function executerFiltre() {
$this->chargerAlphabet();
$this->initialiserAlphabet();
$this->initialiserLettre();
$couleurs = $this->creerColoration($this->alphabet);
$taxons = $this->getListeTaxons();
41,7 → 37,9
$donnees['i18n'] = I18n::get('Liste');
$donnees['lettre'] = $this->lettre;
$donnees['rang'] = $this->rang;
$donnees['rangCodes'] = array_keys($this->rangsCorrespondance);
$donnees['initiales'] = $this->alphabet;
$donnees['lettreCorrespondance'] = $this->chargerCorrespondanceSpeciale();
$donnees['couleurs'] = $couleurs;
$donnees['taxons'] = $taxons;
$donnees['nbreTaxons'] = $this->getEfloreTaxons()->getEnteteTotal();
48,7 → 46,7
$donnees['urlFiltre'] = $this->obtenirUrlBase();
$donnees['referentiel'] = Registre::get('parametres.referentiel');
$donnees['module'] = strtolower(get_class($this));
$donnees['action'] = 'filtre';
$donnees['action'] = 'liste';
$this->setSortie(self::RENDU_CORPS, $this->getVue('liste', $donnees));
}
62,13 → 60,29
}
}
private function chargerAlphabet() {
private function initialiserAlphabet() {
if (!isset($this->alphabet)) {
$this->alphabet = $this->getStatsInitiales();
}
ksort($this->alphabet);
}
 
private function initialiserLettre() {
if (empty($this->lettre)) {
if (!is_null($this->alphabet)) {
$this->lettre = key($this->alphabet);
} else {
$m = "Aucune lettre n'a pu être initialiser car l'alphabet vaut null.";
trigger_error($m, E_USER_WARNING);
}
}
}
private function chargerCorrespondanceSpeciale() {
return array('chimere' => '+', 'hybride' => '×');
}
private function getStatsInitiales() {
$nomRang = $this->getNomCodeRang();
$stats = array();
80,7 → 94,7
}
private function getListeTaxons() {
$taxons = array();
$taxons = false;
if (isset($this->lettre)) {
$nomRang = $this->getNomCodeRang();
if ($nomRang) {
93,16 → 107,11
private function getNomCodeRang() {
$nom = false;
switch ($this->rang) {
case 'F' :
$nom = 'Famille';
break;
case 'G' :
$nom = 'Genre';
break;
default :
$m = "Ce code de rang '{$this->rang}' est inconnu. Codes disponibles : F (Famille), G (Genre).";
trigger_error($m, E_USER_WARNING);
if (array_key_exists($this->rang, $this->rangsCorrespondance)) {
$nom = $this->rangsCorrespondance[$this->rang];
} else {
$m = "Ce code de rang '{$this->rang}' est inconnu. Codes disponibles : ".implode(', ', $this->rangsCorrespondance);
trigger_error($m, E_USER_WARNING);
}
return $nom;
}