272 |
delphine |
1 |
<?php
|
|
|
2 |
// declare(encoding='UTF-8');
|
|
|
3 |
/**
|
|
|
4 |
* Classe mère du module Liste.
|
|
|
5 |
*
|
|
|
6 |
* @category PHP 5.2
|
|
|
7 |
* @package eflore-consultation
|
|
|
8 |
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
9 |
* @author Delphine CAUQUIL <delphine@tela-botanica.org>
|
|
|
10 |
* @copyright 2011 Tela-Botanica
|
|
|
11 |
* @license http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
|
|
|
12 |
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
|
|
|
13 |
* @version $Id$
|
|
|
14 |
*/
|
|
|
15 |
class Nomenclature extends aControleur {
|
291 |
jpm |
16 |
|
|
|
17 |
private $conteneur = null;
|
294 |
delphine |
18 |
private $nomCourant = null;
|
291 |
jpm |
19 |
private $noms = null;
|
|
|
20 |
private $meta = null;
|
|
|
21 |
|
|
|
22 |
public function __construct(Conteneur $conteneur) {
|
|
|
23 |
$this->conteneur = $conteneur;
|
294 |
delphine |
24 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
291 |
jpm |
25 |
$this->noms = $this->conteneur->getApiNoms();
|
326 |
aurelien |
26 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
291 |
jpm |
27 |
$this->appUrls = $this->conteneur->getAppUrls();
|
463 |
delphine |
28 |
$this->wikini = $this->conteneur->getApiWikini();
|
272 |
delphine |
29 |
}
|
291 |
jpm |
30 |
|
|
|
31 |
public function obtenirDonnees() {
|
498 |
jpm |
32 |
|
291 |
jpm |
33 |
$donnees = array();
|
336 |
aurelien |
34 |
$donnees['flores_synonymes'] = $this->getFlores();
|
332 |
aurelien |
35 |
$donnees['synonymes']['noms'] = $this->getSynonymes();
|
373 |
aurelien |
36 |
$donnees['date_maj'] = $this->nomCourant->getNomRetenu()->get('maj_modif');
|
326 |
aurelien |
37 |
$meta = $this->meta->getMetaDonnees();
|
|
|
38 |
$titreMeta = $meta[0]['titre'];
|
|
|
39 |
$donnees['synonymes']['meta']['titre'] = $titreMeta;
|
|
|
40 |
$donnees['synonymes']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
|
332 |
aurelien |
41 |
$donnees['num_type'] = $this->nomCourant->getNomSelectionne()->get('num_type');
|
334 |
aurelien |
42 |
$donnees['urls'] = $this->appUrls;
|
378 |
delphine |
43 |
$donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
|
584 |
aurelien |
44 |
$donnees['nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('nom_retenu.id');
|
378 |
delphine |
45 |
$donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
|
584 |
aurelien |
46 |
$donnees['basionyme_nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('basionyme.id');
|
448 |
delphine |
47 |
$donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html');
|
|
|
48 |
$donnees['nom_retenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html');
|
463 |
delphine |
49 |
$donnees['wikini'] = $this->getWikini();
|
272 |
delphine |
50 |
return $donnees;
|
|
|
51 |
}
|
712 |
mathilde |
52 |
|
|
|
53 |
public function obtenirVersionDonnees() {
|
|
|
54 |
$meta = $this->meta->getMetaDonnees();
|
|
|
55 |
$donnees['version'] = $meta[0]['code'].' v.'.$meta[0]['version'];
|
|
|
56 |
return $donnees;
|
|
|
57 |
}
|
|
|
58 |
|
291 |
jpm |
59 |
|
|
|
60 |
public function getBloc() {
|
469 |
delphine |
61 |
$donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html_complet');
|
378 |
delphine |
62 |
$donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
|
|
|
63 |
$donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
|
291 |
jpm |
64 |
$synonymes = $this->getSynonymes();
|
372 |
aurelien |
65 |
$donnees['synonymes'] = array_slice($synonymes, 0, 3);
|
|
|
66 |
$donnees['autresSynonymesNbre'] = count($synonymes) - 3;
|
291 |
jpm |
67 |
return $donnees;
|
|
|
68 |
}
|
498 |
jpm |
69 |
|
336 |
aurelien |
70 |
private function getFlores() {
|
448 |
delphine |
71 |
$nnr = $this->nomCourant->getNnr();
|
|
|
72 |
$flores = $this->noms->getFlores($nnr);
|
336 |
aurelien |
73 |
$flores['resultat'] = (isset($flores['resultat']) && is_array($flores['resultat'])) ? $flores['resultat'] : array();
|
|
|
74 |
return $flores['resultat'];
|
|
|
75 |
}
|
291 |
jpm |
76 |
|
|
|
77 |
private function getSynonymes() {
|
294 |
delphine |
78 |
$nns = $this->nomCourant->getNns();
|
498 |
jpm |
79 |
$synonymesReponse = $this->noms->getSynonymes($nns);
|
|
|
80 |
|
|
|
81 |
$synonymes = array();
|
565 |
delphine |
82 |
if (isset($synonymesReponse['resultat']) && is_array($synonymesReponse['resultat'])) {
|
498 |
jpm |
83 |
$synonymes = $synonymesReponse['resultat'];
|
|
|
84 |
if (array_key_exists($this->nomCourant->getNnr(), $synonymes)) {
|
|
|
85 |
unset($synonymes[$this->nomCourant->getNnr()]);
|
|
|
86 |
}
|
469 |
delphine |
87 |
}
|
498 |
jpm |
88 |
return $synonymes;
|
291 |
jpm |
89 |
}
|
498 |
jpm |
90 |
|
463 |
delphine |
91 |
private function getWikini() {
|
|
|
92 |
$wikini = array();
|
|
|
93 |
$wikini['titre'] = 'Wikini';
|
|
|
94 |
$referentiel = $this->conteneur->getParametre('referentiel');
|
|
|
95 |
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
|
|
|
96 |
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
|
|
|
97 |
$wikini['nomenclature'] = $this->wikini->getTexteFormate($page_wiki, 'nomenclature');
|
|
|
98 |
return $wikini;
|
|
|
99 |
}
|
272 |
delphine |
100 |
}
|
|
|
101 |
?>
|