Subversion Repositories eFlore/Applications.eflore-consultation

Compare Revisions

Ignore whitespace Rev 63 → Rev 64

/trunk/modules/liste/squelettes/liste.tpl.html
2,23 → 2,42
<input id="referentiel" name="referentiel" type="hidden" value="<?=$referentiel?>"/>
<input id="module" name="module" type="hidden" value="<?=$module?>"/>
<input id="action" name="action" type="hidden" value="<?=$action?>"/>
<input id="rang" name="rang" type="hidden" value="<?=$rang?>"/>
<fieldset>
<h1>Consultation par ordre alphabétique</h1>
<h2>Choisissez un rang</h2>
<p>Vous pouvez choisir d'afficher la liste des noms retenus des taxons pour les rangs suivant :</p>
<label for="rang">Rang :</label>
<select id="rang" name="rang">
<? foreach ($rangCodes as $codeRang) : ?>
<option
<?= ($codeRang == $rang) ? 'selected="selected"' : '' ?>
value="<?=$codeRang?>">
<?=$i18n['rang'.$codeRang]?>
</option>
<? endforeach; ?>
</select>
<button id="rang-submit" name="lettre" type="submit" value="<?=$lettre?>">OK</button>
</fieldset>
<fieldset>
<h2>Consultez les <?=strtolower($i18n['rang'.$rang])?>s par ordre alphabétique</h2>
<p>Plus la couleur de fond de la lettre est foncée plus, elle contient de taxons. Son survol avec la souris fait apparaitre le nombre de taxons présents.</p>
<p id="eft_alphabet">
<p id="alphabet">
<? foreach ($initiales as $initiale => $nbre) : ?>
<input id="eflore_lettre" name="lettre" type="submit"
<button name="lettre" type="submit"
title="<?=$nbre?> taxons"
value="<?=$initiale?>"
value="<?=isset($lettreCorrespondance[$initiale]) ? $lettreCorrespondance[$initiale] : $initiale?>"
<?=($initiale == $lettre) ? 'disabled="disabled"' : ''?>
style="background-color:rgb(<?=$couleurs[$nbre]['R']?>,<?=$couleurs[$nbre]['V']?>,<?=$couleurs[$nbre]['B']?>);color:black;">
<?=$initiale?>
</button>
<? endforeach; ?>
</p>
</fieldset>
</form>
<?php if (isset($taxons)) : ?>
 
<?php if ($taxons) : ?>
<h1>Taxons trouvés : <?=$nbreTaxons?></h1>
<ol>
<? foreach ($taxons as $id => $taxon) : ?>
/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;
}