Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1612 → Rev 1613

/trunk/widget/modules/saisie/Saisie.php
140,7 → 140,11
}
}
if ($this->projet != 'defaut' || $this->projetASquelette()) {
$widget['donnees']['taxons'] = $this->recupererListeTaxon();
if ($this->projet == 'florileges') {
$widget['donnees']['taxons'] = $this->recupererListeNoms();
} else {
$widget['donnees']['taxons'] = $this->recupererListeNomsSci();
}
$widget['donnees']['milieux'] = $this->parserMilieux();
}
return $widget;
155,15 → 159,65
public function executerTaxons() {
$widget['squelette'] = $this->projet.'_taxons';
$widget['squelette_ext'] = '.tpl.js';
$widget['donnees'] = array();
$taxons = $this->recupererListeTaxon();
$taxons_tries = array();
foreach ($taxons as $taxon) {
$taxons_tries[$taxon['num_nom_sel']] = $taxon;
}
$widget['donnees']['taxons'] = json_encode($taxons_tries);
$widget['donnees'] = array();
$nomsAAfficher = $this->recupererListeNomsSci();
$widget['donnees']['taxons'] = json_encode($nomsAAfficher);
return $widget;
}
 
private function recupererListeNomsSci() {
$taxons = $this->recupererListeTaxon();
$nomsAAfficher = array();
if (is_array($taxons)) {
$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
foreach ($taxons as $taxon) {
$nomsAAfficher[$taxon['num_nom_sel']] = $taxon;
}
}
return $nomsAAfficher;
}
 
private function recupererListeNoms() {
$taxons = $this->recupererListeTaxon();
$nomsAAfficher = array();
$nomsSpeciaux = array();
if (is_array($taxons)) {
foreach ($taxons as $taxon) {
$nomSciTitle = $taxon['nom_ret'].
($taxon['nom_fr'] != '' ? ' - '.$taxon['nom_fr'] : '' ).
($taxon['nom_fr_autre'] != '' ? ' - '.$taxon['nom_fr_autre'] : '' );
$nomFrTitle = $taxon['nom_sel'].
($taxon['nom_ret'] != $taxon['nom_sel']? ' - '.$taxon['nom_ret'] : '' ).
($taxon['nom_fr_autre'] != '' ? ' - '.$taxon['nom_fr_autre'] : '' );
 
if ($taxon['groupe'] == 'special') {
$nomsSpeciaux[] = array(
'num_nom' => $taxon['num_nom_sel'],
'nom_a_afficher' => $taxon['nom_fr'],
'nom_a_sauver' => $taxon['nom_sel'],
'nom_title' => $nomSciTitle,
'nom_type' => 'nom-special');
} else {
$nomsAAfficher[] = array(
'num_nom' => $taxon['num_nom_sel'],
'nom_a_afficher' => $taxon['nom_sel'],
'nom_a_sauver' => $taxon['nom_sel'],
'nom_title' => $nomSciTitle,
'nom_type' => 'nom-sci');
$nomsAAfficher[] = array(
'num_nom' => $taxon['num_nom_sel'],
'nom_a_afficher' => $taxon['nom_fr'],
'nom_a_sauver' => $taxon['nom_fr'],
'nom_title' => $nomFrTitle,
'nom_type' => 'nom-fr');
}
}
$nomsAAfficher = self::trierTableauMd($nomsAAfficher, array('nom_a_afficher' => SORT_ASC));
$nomsSpeciaux = self::trierTableauMd($nomsSpeciaux, array('nom_a_afficher' => SORT_ASC));
$nomsAAfficher = array_merge($nomsAAfficher, $nomsSpeciaux);
}
return array('speciaux' => $nomsSpeciaux, 'sci-et-fr' => $nomsAAfficher);
}
 
private function recupererListeTaxon() {
$taxons = null;
170,7 → 224,6
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
$taxons = $this->decomposerFichierTsv($fichier_tsv);
$taxons = self::trierTableauMd($taxons, array('nom_fr' => SORT_ASC));
} else {
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
}