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;
|
952 |
delphine |
21 |
private $referentiel = 'bdtfx';
|
|
|
22 |
private $donnees = array();
|
291 |
jpm |
23 |
|
|
|
24 |
public function __construct(Conteneur $conteneur) {
|
|
|
25 |
$this->conteneur = $conteneur;
|
294 |
delphine |
26 |
$this->nomCourant = $this->conteneur->getNomCourant();
|
952 |
delphine |
27 |
$this->referentiel = $this->conteneur->getParametre('referentiel');
|
829 |
delphine |
28 |
$this->taxons = $this->conteneur->getApiTaxons();
|
291 |
jpm |
29 |
$this->noms = $this->conteneur->getApiNoms();
|
326 |
aurelien |
30 |
$this->meta = $this->conteneur->getApiMetaDonnees();
|
291 |
jpm |
31 |
$this->appUrls = $this->conteneur->getAppUrls();
|
463 |
delphine |
32 |
$this->wikini = $this->conteneur->getApiWikini();
|
944 |
delphine |
33 |
//print_r($_GET['niveau']);
|
|
|
34 |
//Registre::set('parametres.niveau', 2);
|
272 |
delphine |
35 |
}
|
291 |
jpm |
36 |
|
|
|
37 |
public function obtenirDonnees() {
|
952 |
delphine |
38 |
$this->donnees['baseUrlIco'] = $this->appUrls->obtenirUrlBaseDossier();
|
|
|
39 |
$this->donnees['referentiel'] = $this->referentiel;
|
|
|
40 |
$this->getFlores();
|
|
|
41 |
$this->donnees['synonymes']['noms'] = $this->getSynonymes();
|
|
|
42 |
$this->donnees['date_maj'] = $this->nomCourant->getNomRetenu()->get('maj_modif');
|
326 |
aurelien |
43 |
$meta = $this->meta->getMetaDonnees();
|
|
|
44 |
$titreMeta = $meta[0]['titre'];
|
952 |
delphine |
45 |
$this->donnees['synonymes']['meta']['titre'] = $titreMeta;
|
955 |
delphine |
46 |
$this->donnees['synonymes']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees($this->referentiel);
|
952 |
delphine |
47 |
$this->donnees['num_type'] = $this->nomCourant->getNomSelectionne()->get('num_type');
|
|
|
48 |
$this->donnees['urls'] = $this->appUrls;
|
|
|
49 |
$this->donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
|
|
|
50 |
$this->donnees['nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('nom_retenu.id');
|
|
|
51 |
$this->donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
|
|
|
52 |
$this->donnees['basionyme_nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('basionyme.id');
|
|
|
53 |
$this->donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html');
|
|
|
54 |
$this->donnees['nom_retenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci');
|
|
|
55 |
$this->donnees['wikini'] = $this->getWikini();
|
|
|
56 |
$this->donnees['hybride_parent_01'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_01_html_complet');
|
|
|
57 |
$this->donnees['hybride_parent_02'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_02_html_complet');
|
|
|
58 |
$this->donnees['hybride_parent_01_nn'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_01.id');
|
|
|
59 |
$this->donnees['hybride_parent_02_nn'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_02.id');
|
914 |
delphine |
60 |
|
829 |
delphine |
61 |
|
952 |
delphine |
62 |
$this->donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
|
|
|
63 |
$this->donnees['taxon_courant']['rang.libelle'] = $this->nomCourant->getNomRetenu()->get('rang.libelle');
|
|
|
64 |
$this->donnees['taxon_courant']['nom_sci'] = $this->nomCourant->getNomRetenu()->get('nom_sci');
|
|
|
65 |
$this->donnees['taxon_courant']['num_nom'] = $this->nomCourant->getNomRetenu()->get('id');
|
|
|
66 |
$this->donnees['taxons_inf'] = $this->getTaxonsInferieurs();
|
|
|
67 |
return $this->donnees;
|
272 |
delphine |
68 |
}
|
712 |
mathilde |
69 |
|
829 |
delphine |
70 |
|
|
|
71 |
private function getTaxonsInferieurs() {
|
944 |
delphine |
72 |
$num_nom = $this->nomCourant->getNomRetenu()->get('id');
|
|
|
73 |
$resultat = $this->taxons->getTaxonsInf($num_nom);
|
|
|
74 |
|
|
|
75 |
return $resultat[$num_nom];
|
829 |
delphine |
76 |
}
|
|
|
77 |
|
712 |
mathilde |
78 |
public function obtenirVersionDonnees() {
|
|
|
79 |
$meta = $this->meta->getMetaDonnees();
|
952 |
delphine |
80 |
$this->donnees['version'] = $meta[0]['code'].' v.'.$meta[0]['version'];
|
|
|
81 |
return $this->donnees;
|
712 |
mathilde |
82 |
}
|
|
|
83 |
|
291 |
jpm |
84 |
|
|
|
85 |
public function getBloc() {
|
977 |
delphine |
86 |
$this->donnees['urls'] = $this->appUrls;
|
952 |
delphine |
87 |
$this->donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html_complet');
|
|
|
88 |
$this->donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
|
|
|
89 |
$this->donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
|
291 |
jpm |
90 |
$synonymes = $this->getSynonymes();
|
952 |
delphine |
91 |
$this->donnees['synonymes'] = array_slice($synonymes, 0, 3);
|
|
|
92 |
$this->donnees['autresSynonymesNbre'] = count($synonymes) - 3;
|
829 |
delphine |
93 |
|
952 |
delphine |
94 |
$this->donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
|
|
|
95 |
$this->donnees['taxons_inf'] = $this->getTaxonsInferieurs();
|
|
|
96 |
$this->donnees['taxons_sup'] = is_array($this->donnees['taxons_sup']) ? array_slice($this->donnees['taxons_sup'], -3 , 3) : array();
|
|
|
97 |
$this->donnees['taxons_inf'] = is_array($this->donnees['taxons_inf']) ? array_slice($this->donnees['taxons_inf'], 0 , 3) : array();
|
977 |
delphine |
98 |
|
952 |
delphine |
99 |
return $this->donnees;
|
291 |
jpm |
100 |
}
|
498 |
jpm |
101 |
|
336 |
aurelien |
102 |
private function getFlores() {
|
952 |
delphine |
103 |
if (Config::get($this->referentiel.'.baseFloresRef') != "") {
|
|
|
104 |
$nnr = $this->nomCourant->getNnr();
|
|
|
105 |
$flores = $this->noms->getFlores($nnr);
|
|
|
106 |
$this->donnees['flores_synonymes'] = (isset($flores['resultat']) && is_array($flores['resultat'])) ? $flores['resultat'] : array();
|
|
|
107 |
}
|
336 |
aurelien |
108 |
}
|
291 |
jpm |
109 |
|
|
|
110 |
private function getSynonymes() {
|
294 |
delphine |
111 |
$nns = $this->nomCourant->getNns();
|
498 |
jpm |
112 |
$synonymesReponse = $this->noms->getSynonymes($nns);
|
|
|
113 |
|
|
|
114 |
$synonymes = array();
|
565 |
delphine |
115 |
if (isset($synonymesReponse['resultat']) && is_array($synonymesReponse['resultat'])) {
|
498 |
jpm |
116 |
$synonymes = $synonymesReponse['resultat'];
|
|
|
117 |
if (array_key_exists($this->nomCourant->getNnr(), $synonymes)) {
|
|
|
118 |
unset($synonymes[$this->nomCourant->getNnr()]);
|
|
|
119 |
}
|
469 |
delphine |
120 |
}
|
498 |
jpm |
121 |
return $synonymes;
|
291 |
jpm |
122 |
}
|
498 |
jpm |
123 |
|
463 |
delphine |
124 |
private function getWikini() {
|
|
|
125 |
$wikini = array();
|
|
|
126 |
$wikini['titre'] = 'Wikini';
|
|
|
127 |
$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
|
952 |
delphine |
128 |
$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($this->referentiel, $num_tax);
|
463 |
delphine |
129 |
$wikini['nomenclature'] = $this->wikini->getTexteFormate($page_wiki, 'nomenclature');
|
|
|
130 |
return $wikini;
|
|
|
131 |
}
|
272 |
delphine |
132 |
}
|
|
|
133 |
?>
|