Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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