Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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