341,6 → 341,8 |
case 'referentiel' : |
case 'liste' : |
$referentiel = $infos_projets['referentiel']; |
////////////////////// temporaire test transmission liste taxons |
$retour['taxons'] = $this->recupererListeNomsSci(); |
break; |
} |
} else if ( isset( $infos_projets['referentiel'] ) ) { |
350,15 → 352,16 |
} |
} |
|
$projetsAListeDeNoms = $this->transformerEnTableau( $this->config['projets']['liste_noms'] ) ; |
if ( in_array( $this->projet, $projetsAListeDeNoms ) && !$this->especeEstImposee() ) { |
$projetsAListeDeNomsSciEtVerna = $this->transformerEnTableau( $this->config['projets']['liste_noms_sci_et_verna'] ); |
if ( in_array( $this->projet, $projetsAListeDeNomsSciEtVerna ) ) { |
$retour['taxons'] = $this->recupererListeNoms(); |
} else { |
$retour['taxons'] = $this->recupererListeNomsSci(); |
} |
} |
// $projetsAListeDeNoms = $this->transformerEnTableau( $this->config['projets']['liste_noms'] ) ; |
// if ( in_array( $this->parametres['projet'], $projetsAListeDeNoms ) && !$this->especeEstImposee() ) { |
// var_dump($this->parametres['projet']); |
// $projetsAListeDeNomsSciEtVerna = $this->transformerEnTableau( $this->config['projets']['liste_noms_sci_et_verna'] ); |
// if ( in_array( $this->parametres['projet'], $projetsAListeDeNomsSciEtVerna ) ) { |
// $retour['taxons'] = $this->recupererListeNoms(); |
// } else { |
// $retour['taxons'] = $this->recupererListeNomsSci(); |
// } |
// } |
return $retour; |
} |
|
407,7 → 410,7 |
} |
|
/** |
* Trie par nom français les taxons lus dans le fichier tsv |
* Trie par nom français les taxons lus dans le fichier csv |
*/ |
protected function recupererListeNomsSci() { |
$taxons = $this->recupererListeTaxon(); |
463,30 → 466,34 |
} |
|
/** |
* Lit une liste de taxons depuis un fichier tsv fourni |
* Lit une liste de taxons depuis un fichier csv fourni |
*/ |
protected function recupererListeTaxon() { |
$taxons = array(); |
if ($this->projet == 'missions-flore') { |
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_'.$this->mission.'_taxons.tsv'; |
$langue_projet_url = ( isset ( $this->parametres['langue'] ) && $this->parametres['langue'] !== 'fr' ) ? '_' . $this->parametres['langue'] : ''; |
$chemin_images = dirname(__FILE__) . self::DS . '..' . self::DS . 'manager' . self::DS . 'squelettes' . self::DS . 'img' . self::DS . 'images_projets' . self::DS; |
if ( $this->parametres['projet'] == 'missions-flore' ) { |
// chemin temporaire à modifier une fois réorganisés avec le nouveau widget |
// $fichier_csv = $chemin_images . $this->parametres['projet'] . '_'.$this->mission . $langue_projet_url . '/especes.csv'; |
$fichier_csv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->parametres['projet'].'_'.$this->mission.'_taxons.tsv'; |
} else { |
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv'; |
$fichier_csv = $chemin_images . $this->parametres['projet'] . $langue_projet_url . self::DS . 'especes.csv'; ; |
} |
if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) { |
$taxons = $this->decomposerFichierTsv($fichier_tsv); |
if ( file_exists( $fichier_csv ) && is_readable( $fichier_csv ) ) { |
$taxons = $this->decomposerFichierCsv( $fichier_csv ); |
} else { |
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'."; |
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_csv'."; |
} |
return $taxons; |
} |
|
/** |
* Découpe un fihcier tsv |
* Découpe un fihcier csv |
*/ |
protected function decomposerFichierTsv($fichier, $delimiter = '\t'){ |
protected function decomposerFichierCsv($fichier, $delimiter = "\t"){ |
$header = null; |
$data = array(); |
if (($handle = fopen($fichier, 'r')) !== FALSE) { |
if (($handle = fopen($fichier, "r")) !== FALSE) { |
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) { |
if (!$header) { |
$header = $row; |