| Line 339... |
Line 339... |
| 339 |
$retour['especes'] = $this->chargerInfosTaxon( $infos_projets['referentiel'], $infos_projets['especes'] );
|
339 |
$retour['especes'] = $this->chargerInfosTaxon( $infos_projets['referentiel'], $infos_projets['especes'] );
|
| 340 |
break;
|
340 |
break;
|
| 341 |
case 'referentiel' :
|
341 |
case 'referentiel' :
|
| 342 |
case 'liste' :
|
342 |
case 'liste' :
|
| 343 |
$referentiel = $infos_projets['referentiel'];
|
343 |
$referentiel = $infos_projets['referentiel'];
|
| - |
|
344 |
////////////////////// temporaire test transmission liste taxons
|
| - |
|
345 |
$retour['taxons'] = $this->recupererListeNomsSci();
|
| 344 |
break;
|
346 |
break;
|
| 345 |
}
|
347 |
}
|
| 346 |
} else if ( isset( $infos_projets['referentiel'] ) ) {
|
348 |
} else if ( isset( $infos_projets['referentiel'] ) ) {
|
| 347 |
$referentiel = $infos_projets['referentiel'];
|
349 |
$referentiel = $infos_projets['referentiel'];
|
| 348 |
if ( isset($infos_projets['num_nom'] ) ) {
|
350 |
if ( isset($infos_projets['num_nom'] ) ) {
|
| 349 |
$retour['especes'] = $this->chargerInfosTaxon( $infos_projets['referentiel'], $infos_projets['num_nom'] );
|
351 |
$retour['especes'] = $this->chargerInfosTaxon( $infos_projets['referentiel'], $infos_projets['num_nom'] );
|
| 350 |
}
|
352 |
}
|
| 351 |
}
|
353 |
}
|
| Line 352... |
Line 354... |
| 352 |
|
354 |
|
| 353 |
$projetsAListeDeNoms = $this->transformerEnTableau( $this->config['projets']['liste_noms'] ) ;
|
355 |
// $projetsAListeDeNoms = $this->transformerEnTableau( $this->config['projets']['liste_noms'] ) ;
|
| - |
|
356 |
// if ( in_array( $this->parametres['projet'], $projetsAListeDeNoms ) && !$this->especeEstImposee() ) {
|
| 354 |
if ( in_array( $this->projet, $projetsAListeDeNoms ) && !$this->especeEstImposee() ) {
|
357 |
// var_dump($this->parametres['projet']);
|
| 355 |
$projetsAListeDeNomsSciEtVerna = $this->transformerEnTableau( $this->config['projets']['liste_noms_sci_et_verna'] );
|
358 |
// $projetsAListeDeNomsSciEtVerna = $this->transformerEnTableau( $this->config['projets']['liste_noms_sci_et_verna'] );
|
| 356 |
if ( in_array( $this->projet, $projetsAListeDeNomsSciEtVerna ) ) {
|
359 |
// if ( in_array( $this->parametres['projet'], $projetsAListeDeNomsSciEtVerna ) ) {
|
| 357 |
$retour['taxons'] = $this->recupererListeNoms();
|
360 |
// $retour['taxons'] = $this->recupererListeNoms();
|
| 358 |
} else {
|
361 |
// } else {
|
| 359 |
$retour['taxons'] = $this->recupererListeNomsSci();
|
362 |
// $retour['taxons'] = $this->recupererListeNomsSci();
|
| 360 |
}
|
363 |
// }
|
| 361 |
}
|
364 |
// }
|
| 362 |
return $retour;
|
365 |
return $retour;
|
| Line 363... |
Line 366... |
| 363 |
}
|
366 |
}
|
| 364 |
|
367 |
|
| Line 405... |
Line 408... |
| 405 |
}
|
408 |
}
|
| 406 |
return $referentiel_impose;
|
409 |
return $referentiel_impose;
|
| 407 |
}
|
410 |
}
|
| Line 408... |
Line 411... |
| 408 |
|
411 |
|
| 409 |
/**
|
412 |
/**
|
| 410 |
* Trie par nom français les taxons lus dans le fichier tsv
|
413 |
* Trie par nom français les taxons lus dans le fichier csv
|
| 411 |
*/
|
414 |
*/
|
| 412 |
protected function recupererListeNomsSci() {
|
415 |
protected function recupererListeNomsSci() {
|
| 413 |
$taxons = $this->recupererListeTaxon();
|
416 |
$taxons = $this->recupererListeTaxon();
|
| 414 |
if (is_array($taxons)) {
|
417 |
if (is_array($taxons)) {
|
| Line 461... |
Line 464... |
| 461 |
}
|
464 |
}
|
| 462 |
return array('speciaux' => $nomsSpeciaux, 'sci-et-fr' => $nomsAAfficher);
|
465 |
return array('speciaux' => $nomsSpeciaux, 'sci-et-fr' => $nomsAAfficher);
|
| 463 |
}
|
466 |
}
|
| Line 464... |
Line 467... |
| 464 |
|
467 |
|
| 465 |
/**
|
468 |
/**
|
| 466 |
* Lit une liste de taxons depuis un fichier tsv fourni
|
469 |
* Lit une liste de taxons depuis un fichier csv fourni
|
| 467 |
*/
|
470 |
*/
|
| 468 |
protected function recupererListeTaxon() {
|
471 |
protected function recupererListeTaxon() {
|
| - |
|
472 |
$taxons = array();
|
| - |
|
473 |
$langue_projet_url = ( isset ( $this->parametres['langue'] ) && $this->parametres['langue'] !== 'fr' ) ? '_' . $this->parametres['langue'] : '';
|
| 469 |
$taxons = array();
|
474 |
$chemin_images = dirname(__FILE__) . self::DS . '..' . self::DS . 'manager' . self::DS . 'squelettes' . self::DS . 'img' . self::DS . 'images_projets' . self::DS;
|
| - |
|
475 |
if ( $this->parametres['projet'] == 'missions-flore' ) {
|
| - |
|
476 |
// chemin temporaire à modifier une fois réorganisés avec le nouveau widget
|
| 470 |
if ($this->projet == 'missions-flore') {
|
477 |
// $fichier_csv = $chemin_images . $this->parametres['projet'] . '_'.$this->mission . $langue_projet_url . '/especes.csv';
|
| 471 |
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_'.$this->mission.'_taxons.tsv';
|
478 |
$fichier_csv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->parametres['projet'].'_'.$this->mission.'_taxons.tsv';
|
| 472 |
} else {
|
479 |
} else {
|
| 473 |
$fichier_tsv = dirname(__FILE__).self::DS.'configurations'.self::DS.$this->projet.'_taxons.tsv';
|
480 |
$fichier_csv = $chemin_images . $this->parametres['projet'] . $langue_projet_url . self::DS . 'especes.csv'; ;
|
| 474 |
}
|
481 |
}
|
| 475 |
if (file_exists($fichier_tsv) && is_readable($fichier_tsv)) {
|
482 |
if ( file_exists( $fichier_csv ) && is_readable( $fichier_csv ) ) {
|
| 476 |
$taxons = $this->decomposerFichierTsv($fichier_tsv);
|
483 |
$taxons = $this->decomposerFichierCsv( $fichier_csv );
|
| 477 |
} else {
|
484 |
} else {
|
| 478 |
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_tsv'.";
|
485 |
$this->debug[] = "Impossible d'ouvrir le fichier '$fichier_csv'.";
|
| 479 |
}
|
486 |
}
|
| 480 |
return $taxons;
|
487 |
return $taxons;
|
| Line 481... |
Line 488... |
| 481 |
}
|
488 |
}
|
| 482 |
|
489 |
|
| 483 |
/**
|
490 |
/**
|
| 484 |
* Découpe un fihcier tsv
|
491 |
* Découpe un fihcier csv
|
| 485 |
*/
|
492 |
*/
|
| 486 |
protected function decomposerFichierTsv($fichier, $delimiter = '\t'){
|
493 |
protected function decomposerFichierCsv($fichier, $delimiter = "\t"){
|
| 487 |
$header = null;
|
494 |
$header = null;
|
| 488 |
$data = array();
|
495 |
$data = array();
|
| 489 |
if (($handle = fopen($fichier, 'r')) !== FALSE) {
|
496 |
if (($handle = fopen($fichier, "r")) !== FALSE) {
|
| 490 |
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
|
497 |
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
|
| 491 |
if (!$header) {
|
498 |
if (!$header) {
|
| 492 |
$header = $row;
|
499 |
$header = $row;
|