Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 944 | Rev 955 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 944 Rev 952
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe mère du module Liste.
4
 * Classe mère du module Liste.
5
 *
5
 *
6
 * @category	PHP 5.2
6
 * @category	PHP 5.2
7
 * @package		eflore-consultation
7
 * @package		eflore-consultation
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
8
 * @author		Jean-Pascal MILCENT <jpm@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
9
 * @author		Delphine CAUQUIL <delphine@tela-botanica.org>
10
 * @copyright	2011 Tela-Botanica
10
 * @copyright	2011 Tela-Botanica
11
 * @license		http://www.gnu.org/licenses/gpl.html Licence GNU-GPL-v3
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
12
 * @license		http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL-v2
13
 * @version		$Id$
13
 * @version		$Id$
14
 */
14
 */
15
class Nomenclature extends aControleur {
15
class Nomenclature extends aControleur {
16
 
16
 
17
	private $conteneur = null;
17
	private $conteneur = null;
18
	private $nomCourant = null;
18
	private $nomCourant = null;
19
	private $noms = null;
19
	private $noms = null;
20
	private $meta = null;
20
	private $meta = null;
-
 
21
	private $referentiel = 'bdtfx';
-
 
22
	private $donnees = array();
21
 
23
 
22
	public function __construct(Conteneur $conteneur) {
24
	public function __construct(Conteneur $conteneur) {
23
		$this->conteneur = $conteneur;
25
		$this->conteneur = $conteneur;
24
		$this->nomCourant = $this->conteneur->getNomCourant();
26
		$this->nomCourant = $this->conteneur->getNomCourant();
-
 
27
		$this->referentiel = $this->conteneur->getParametre('referentiel');
25
		$this->taxons = $this->conteneur->getApiTaxons();
28
		$this->taxons = $this->conteneur->getApiTaxons();
26
		$this->noms = $this->conteneur->getApiNoms();
29
		$this->noms = $this->conteneur->getApiNoms();
27
		$this->meta = $this->conteneur->getApiMetaDonnees();
30
		$this->meta = $this->conteneur->getApiMetaDonnees();
28
		$this->appUrls = $this->conteneur->getAppUrls();
31
		$this->appUrls = $this->conteneur->getAppUrls();
29
		$this->wikini = $this->conteneur->getApiWikini();
32
		$this->wikini = $this->conteneur->getApiWikini();
30
		//print_r($_GET['niveau']);
33
		//print_r($_GET['niveau']);
31
		//Registre::set('parametres.niveau', 2);
34
		//Registre::set('parametres.niveau', 2);
32
	}
35
	}
33
 
36
 
34
	public function obtenirDonnees() {
37
	public function obtenirDonnees() {
35
 
-
 
36
		$donnees = array();
-
 
37
		$donnees['baseUrlIco'] = $this->appUrls->obtenirUrlBaseDossier();
38
		$this->donnees['baseUrlIco'] = $this->appUrls->obtenirUrlBaseDossier();
38
		$donnees['referentiel'] = 'bdtfx';
39
		$this->donnees['referentiel'] = $this->referentiel;
39
		$donnees['flores_synonymes'] = $this->getFlores();
40
		$this->getFlores();
40
		$donnees['synonymes']['noms'] = $this->getSynonymes();
41
		$this->donnees['synonymes']['noms'] = $this->getSynonymes();
41
		$donnees['date_maj'] = $this->nomCourant->getNomRetenu()->get('maj_modif');
42
		$this->donnees['date_maj'] = $this->nomCourant->getNomRetenu()->get('maj_modif');
42
		$meta = $this->meta->getMetaDonnees();
43
		$meta = $this->meta->getMetaDonnees();
43
		$titreMeta = $meta[0]['titre'];
44
		$titreMeta = $meta[0]['titre'];
44
		$donnees['synonymes']['meta']['titre'] = $titreMeta;
45
		$this->donnees['synonymes']['meta']['titre'] = $titreMeta;
45
		$donnees['synonymes']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
46
		$this->donnees['synonymes']['meta']['url'] = $this->appUrls->obtenirUrlMetaDonnees('bdtfx');
46
		$donnees['num_type'] = $this->nomCourant->getNomSelectionne()->get('num_type');
47
		$this->donnees['num_type'] = $this->nomCourant->getNomSelectionne()->get('num_type');
47
		$donnees['urls'] = $this->appUrls;
48
		$this->donnees['urls'] = $this->appUrls;
48
		$donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
49
		$this->donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
49
		$donnees['nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('nom_retenu.id');
50
		$this->donnees['nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('nom_retenu.id');
50
		$donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
51
		$this->donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
51
		$donnees['basionyme_nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('basionyme.id');
52
		$this->donnees['basionyme_nom_retenu_nn'] = $this->nomCourant->getNomRetenu()->get('basionyme.id');
52
		$donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html');
53
		$this->donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html');
53
		$donnees['nom_retenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci');
54
		$this->donnees['nom_retenu'] = $this->nomCourant->getNomRetenu()->get('nom_sci');
54
		$donnees['wikini'] = $this->getWikini(); 
55
		$this->donnees['wikini'] = $this->getWikini(); 
55
		$donnees['hybride_parent_01'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_01_html_complet');
56
		$this->donnees['hybride_parent_01'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_01_html_complet');
56
		$donnees['hybride_parent_02'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_02_html_complet');
57
		$this->donnees['hybride_parent_02'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_02_html_complet');
57
		$donnees['hybride_parent_01_nn'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_01.id');
58
		$this->donnees['hybride_parent_01_nn'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_01.id');
58
		$donnees['hybride_parent_02_nn'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_02.id');
59
		$this->donnees['hybride_parent_02_nn'] = $this->nomCourant->getNomRetenu()->get('hybride.parent_02.id');
59
			
60
			
60
		
61
		
61
		$donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
62
		$this->donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
62
		$donnees['taxon_courant']['rang.libelle'] = $this->nomCourant->getNomRetenu()->get('rang.libelle');
63
		$this->donnees['taxon_courant']['rang.libelle'] = $this->nomCourant->getNomRetenu()->get('rang.libelle');
63
		$donnees['taxon_courant']['nom_sci'] = $this->nomCourant->getNomRetenu()->get('nom_sci');
64
		$this->donnees['taxon_courant']['nom_sci'] = $this->nomCourant->getNomRetenu()->get('nom_sci');
64
		$donnees['taxon_courant']['num_nom'] = $this->nomCourant->getNomRetenu()->get('id');
65
		$this->donnees['taxon_courant']['num_nom'] = $this->nomCourant->getNomRetenu()->get('id');
65
		$donnees['taxons_inf'] = $this->getTaxonsInferieurs();
66
		$this->donnees['taxons_inf'] = $this->getTaxonsInferieurs();
66
		return $donnees;
67
		return $this->donnees;
67
	}
68
	}
68
	
69
	
69
	
70
	
70
	private function getTaxonsInferieurs() {
71
	private function getTaxonsInferieurs() {
71
		$num_nom = $this->nomCourant->getNomRetenu()->get('id');
72
		$num_nom = $this->nomCourant->getNomRetenu()->get('id');
72
		$resultat = $this->taxons->getTaxonsInf($num_nom);
73
		$resultat = $this->taxons->getTaxonsInf($num_nom);
73
		
74
		
74
		return $resultat[$num_nom];
75
		return $resultat[$num_nom];
75
	}
76
	}
76
	
77
	
77
	public function obtenirVersionDonnees() {
78
	public function obtenirVersionDonnees() {
78
		$meta = $this->meta->getMetaDonnees();
79
		$meta = $this->meta->getMetaDonnees();
79
		$donnees['version'] = $meta[0]['code'].' v.'.$meta[0]['version'];
80
		$this->donnees['version'] = $meta[0]['code'].' v.'.$meta[0]['version'];
80
		return $donnees;
81
		return $this->donnees;
81
	}
82
	}
82
	
83
	
83
 
84
 
84
	public function getBloc() {
85
	public function getBloc() {
85
		$donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html_complet');
86
		$this->donnees['nom_selectionne'] = $this->nomCourant->getNomSelectionne()->get('nom_sci_html_complet');
86
		$donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
87
		$this->donnees['nom_retenu_formate'] = $this->nomCourant->getNomRetenu()->get('nom_sci_html_complet');
87
		$donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
88
		$this->donnees['basionyme_nom_retenu'] = $this->nomCourant->getNomRetenu()->get('basionyme_html_complet');
88
		$synonymes = $this->getSynonymes();
89
		$synonymes = $this->getSynonymes();
89
		$donnees['synonymes'] = array_slice($synonymes, 0, 3);
90
		$this->donnees['synonymes'] = array_slice($synonymes, 0, 3);
90
		$donnees['autresSynonymesNbre'] = count($synonymes) - 3;
91
		$this->donnees['autresSynonymesNbre'] = count($synonymes) - 3;
91
		
92
		
92
		$donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
93
		$this->donnees['taxons_sup'] = $this->nomCourant->taxons_sup;
93
		$donnees['taxons_inf'] = $this->getTaxonsInferieurs();
94
		$this->donnees['taxons_inf'] = $this->getTaxonsInferieurs();
94
		$donnees['taxons_sup'] = is_array($donnees['taxons_sup']) ? array_slice($donnees['taxons_sup'], -3 , 3) : array();
95
		$this->donnees['taxons_sup'] = is_array($this->donnees['taxons_sup']) ? array_slice($this->donnees['taxons_sup'], -3 , 3) : array();
95
		$donnees['taxons_inf'] = is_array($donnees['taxons_inf']) ? array_slice($donnees['taxons_inf'], 0 , 3) : array();
96
		$this->donnees['taxons_inf'] = is_array($this->donnees['taxons_inf']) ? array_slice($this->donnees['taxons_inf'], 0 , 3) : array();
96
		
97
		
97
		return $donnees;
98
		return $this->donnees;
98
	}
99
	}
99
 
100
 
100
	private function getFlores() {
101
	private function getFlores() {
-
 
102
		if (Config::get($this->referentiel.'.baseFloresRef') != "") {
101
		$nnr = $this->nomCourant->getNnr();
103
			$nnr = $this->nomCourant->getNnr();
102
		$flores = $this->noms->getFlores($nnr);
104
			$flores = $this->noms->getFlores($nnr);
103
		$flores['resultat'] = (isset($flores['resultat']) && is_array($flores['resultat'])) ? $flores['resultat'] : array();
105
			$this->donnees['flores_synonymes'] =  (isset($flores['resultat']) && is_array($flores['resultat'])) ? $flores['resultat'] : array();
104
		return $flores['resultat'];
106
		}
105
	}
107
	}
106
 
108
 
107
	private function getSynonymes() {
109
	private function getSynonymes() {
108
		$nns = $this->nomCourant->getNns();
110
		$nns = $this->nomCourant->getNns();
109
		$synonymesReponse = $this->noms->getSynonymes($nns);
111
		$synonymesReponse = $this->noms->getSynonymes($nns);
110
 
112
 
111
		$synonymes = array();
113
		$synonymes = array();
112
		if (isset($synonymesReponse['resultat']) && is_array($synonymesReponse['resultat'])) {
114
		if (isset($synonymesReponse['resultat']) && is_array($synonymesReponse['resultat'])) {
113
			$synonymes = $synonymesReponse['resultat'];
115
			$synonymes = $synonymesReponse['resultat'];
114
			if (array_key_exists($this->nomCourant->getNnr(), $synonymes)) {
116
			if (array_key_exists($this->nomCourant->getNnr(), $synonymes)) {
115
				unset($synonymes[$this->nomCourant->getNnr()]);
117
				unset($synonymes[$this->nomCourant->getNnr()]);
116
			}
118
			}
117
		}
119
		}
118
		return $synonymes;
120
		return $synonymes;
119
	}
121
	}
120
 
122
 
121
	private function getWikini() {
123
	private function getWikini() {
122
		$wikini = array();
124
		$wikini = array();
123
		$wikini['titre'] = 'Wikini';
125
		$wikini['titre'] = 'Wikini';
124
		$referentiel = $this->conteneur->getParametre('referentiel');
-
 
125
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
126
		$num_tax = $this->nomCourant->getNomSelectionne()->get('num_taxonomique');
126
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($referentiel, $num_tax);
127
		$page_wiki = $this->wikini->getPageWikiPourRefEtNumTax($this->referentiel, $num_tax);
127
		$wikini['nomenclature'] = $this->wikini->getTexteFormate($page_wiki, 'nomenclature');
128
		$wikini['nomenclature'] = $this->wikini->getTexteFormate($page_wiki, 'nomenclature');
128
		return $wikini;
129
		return $wikini;
129
	}
130
	}
130
}
131
}
131
?>
132
?>