Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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