Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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