Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 708 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 708 Rev 765
1
<?php
1
<?php
2
// declare(encoding='UTF-8');
2
// declare(encoding='UTF-8');
3
/**
3
/**
4
 * Classe gérant les noms scientifiques.
4
 * Classe gérant les noms scientifiques.
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 Taxons extends Eflore {
15
class Taxons extends Eflore {
16
 
16
 
17
	public function getTaxon($nn) {
17
	public function getTaxon($nn) {
18
		$url = $this->getUrlTaxon($nn);
18
		$url = $this->getUrlTaxon($nn);
19
		return $this->chargerDonnees($url);
19
		return $this->chargerDonnees($url);
20
	}
20
	}
21
 
21
 
22
	public function getStatsInitialesFamille() {
22
	public function getStatsInitialesFamille() {
23
		$url = $this->getUrlStatsInitiales(self::RANG_FAMILLE);
23
		$url = $this->getUrlStatsInitiales(self::RANG_FAMILLE);
24
		$donnees = $this->chargerDonnees($url);
24
		$donnees = $this->chargerDonnees($url);
25
		if (isset($donnees['Famille'])) {
25
		if (isset($donnees['Famille'])) {
26
			$initiales = $donnees['Famille'];
26
			$initiales = $donnees['Famille'];
27
		} elseif (isset($donnees[self::RANG_FAMILLE])) {
27
		} elseif (isset($donnees[self::RANG_FAMILLE])) {
28
			$initiales = $donnees[self::RANG_FAMILLE];
28
			$initiales = $donnees[self::RANG_FAMILLE];
29
		}
29
		}
30
 
30
 
31
		return $initiales;
31
		return $initiales;
32
	}
32
	}
33
 
33
 
34
	private function getUrlTaxon($nn) {
34
	private function getUrlTaxon($nn) {
35
		$tpl = Config::get('taxonTpl');
35
		$tpl = Config::get('taxonTpl');
36
		$params = array('id' => $nn);
36
		$params = array('id' => $nn);
37
		$url = $this->formaterUrl($tpl, $params);
37
		$url = $this->formaterUrl($tpl, $params);
38
		return $url;
38
		return $url;
39
	}
39
	}
40
 
40
 
41
	public function getStatsInitialesGenre() {
41
	public function getStatsInitialesGenre() {
42
		$url = $this->getUrlStatsInitiales(self::RANG_GENRE);
42
		$url = $this->getUrlStatsInitiales(self::RANG_GENRE);
43
		$donnees = $this->chargerDonnees($url);
43
		$donnees = $this->chargerDonnees($url);
44
		$initiales = $donnees['Genre'];
44
		$initiales = $donnees['Genre'];
45
		if (isset($donnees['Genre'])) {
45
		if (isset($donnees['Genre'])) {
46
			$initiales = $donnees['Genre'];
46
			$initiales = $donnees['Genre'];
47
		} elseif (isset($donnees[self::RANG_GENRE])) {
47
		} elseif (isset($donnees[self::RANG_GENRE])) {
48
			$initiales = $donnees[self::RANG_GENRE];
48
			$initiales = $donnees[self::RANG_GENRE];
49
		}
49
		}
50
		return $initiales;
50
		return $initiales;
51
	}
51
	}
52
 
52
 
53
	private function getUrlStatsInitiales($rang) {
53
	private function getUrlStatsInitiales($rang) {
54
		$tpl = Config::get('taxonsStatsInitialesRangTpl');
54
		$tpl = Config::get('taxonsStatsInitialesRangTpl');
55
		$params = array('rang' => $rang);
55
		$params = array('rang' => $rang);
56
		$url = $this->formaterUrl($tpl, $params);
56
		$url = $this->formaterUrl($tpl, $params);
57
		return $url;
57
		return $url;
58
	}
58
	}
59
 
59
 
60
	public function getListeFamilleParInitiale($lettre) {
60
	public function getListeFamilleParInitiale($lettre) {
61
		$url = $this->getUrlInitiales(self::RANG_FAMILLE, $lettre);
61
		$url = $this->getUrlInitiales(self::RANG_FAMILLE, $lettre);
62
		$donnees = $this->chargerDonneesRecursivement($url);
62
		$donnees = $this->chargerDonneesRecursivement($url);
63
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
63
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
64
		return $taxons;
64
		return $taxons;
65
	}
65
	}
66
 
66
 
67
	public function getListeGenreParInitiale($lettre) {
67
	public function getListeGenreParInitiale($lettre) {
68
		$url = $this->getUrlInitiales(self::RANG_GENRE, $lettre);
68
		$url = $this->getUrlInitiales(self::RANG_GENRE, $lettre);
69
		$donnees = $this->chargerDonneesRecursivement($url);
69
		$donnees = $this->chargerDonneesRecursivement($url);
70
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
70
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
71
		return $taxons;
71
		return $taxons;
72
	}
72
	}
73
 
73
 
74
	private function getUrlInitiales($rang, $lettre) {
74
	private function getUrlInitiales($rang, $lettre) {
75
		$tpl = Config::get('taxonsListeInitialesRangTpl');
75
		$tpl = Config::get('taxonsListeInitialesRangTpl');
76
		$params = array('rang' => $rang, 'initiale' => $lettre);
76
		$params = array('rang' => $rang, 'initiale' => $lettre);
77
		$url = $this->formaterUrl($tpl, $params);
77
		$url = $this->formaterUrl($tpl, $params);
78
		return $url;
78
		return $url;
79
	}
79
	}
80
 
80
 
81
	public function getRechercheEtendue($nom) {
81
	public function getRechercheEtendue($nom) {
82
		$url = $this->getUrlRecherche($nom, 'etendue');
82
		$url = $this->getUrlRecherche($nom, 'etendue');
83
		return $this->chargerDonnees($url);
83
		return $this->chargerDonnees($url);
84
	}
84
	}
85
 
85
 
86
	public function getRechercheFloue($nom) {
86
	public function getRechercheFloue($nom) {
87
		$url = $this->getUrlRecherche($nom, 'floue');
87
		$url = $this->getUrlRecherche($nom, 'floue');
88
		return $this->chargerDonnees($url);
88
		return $this->chargerDonnees($url);
89
	}
89
	}
90
 
90
 
91
	private function getUrlRecherche($nom, $typeRech) {
91
	private function getUrlRecherche($nom, $typeRech) {
92
		$tpl = Config::get('taxonsRechercheTpl');
92
		$tpl = Config::get('taxonsRechercheTpl');
93
		$params = array('valeur' => $nom, 'type' => $typeRech);
93
		$params = array('valeur' => $nom, 'type' => $typeRech);
94
		$url = $this->formaterUrl($tpl, $params);
94
		$url = $this->formaterUrl($tpl, $params);
95
		return $url;
95
		return $url;
96
	}
96
	}
97
	
97
	
98
	public function getTaxonsInf($num_nom) {
98
	public function getTaxonsInf($num_nom) {
99
		$url = $this->getUrlTaxonsInf($num_nom);
99
		$url = $this->getUrlTaxonsInf($num_nom);
100
		return $this->chargerDonnees($url);
100
		return $this->chargerDonnees($url);
101
	}
101
	}
102
	
102
	
103
	private function getUrlTaxonsInf($num_nom) {
103
	private function getUrlTaxonsInf($num_nom) {
104
		$tpl = Config::get('taxonInfTpl');
104
		$tpl = Config::get('taxonInfTpl');
105
		$params = array('id' => $num_nom);
105
		$params = array('id' => $num_nom);
106
		$url = $this->formaterUrl($tpl, $params);
106
		$url = $this->formaterUrl($tpl, $params);
107
		return $url;
107
		return $url;
108
	}
108
	}
109
	
109
	
110
	public function getTaxonsSup($num_nom) {
110
	public function getTaxonsSup($num_nom) {
111
		$url = $this->getUrlTaxonsSup($num_nom);
111
		$url = $this->getUrlTaxonsSup($num_nom);
112
		return $this->chargerDonnees($url);
112
		return $this->chargerDonnees($url);
113
	}
113
	}
114
	
114
	
115
	private function getUrlTaxonsSup($num_nom) {
115
	private function getUrlTaxonsSup($num_nom) {
116
		$tpl = Config::get('taxonSupTpl');
116
		$tpl = Config::get('taxonSupTpl');
117
		$params = array('id' => $num_nom);
117
		$params = array('id' => $num_nom);
118
		$url = $this->formaterUrl($tpl, $params);
118
		$url = $this->formaterUrl($tpl, $params);
119
		return $url;
119
		return $url;
120
	}
120
	}
121
	
121
	
122
	public function getUrlPermalienNumNom($referentiel, $version, $num_nom) {
122
	public function getUrlPermalienNumNom($referentiel, $version, $num_nom) {
123
		$tpl = Config::get('permalienNumNomTpl');
123
		$tpl = Config::get('permalienNumNomTpl');
124
		$params = array('ref_tax' =>$referentiel, 'ref_version' =>$version, 'id' => $num_nom);
124
		$params = array('ref_tax' => $referentiel, 'ref_version' => $version, 'id' => $num_nom);
125
		$url = $this->formaterUrl($tpl, $params);
125
		$url = $this->formaterUrl($tpl, $params);
126
		return $url;
126
		return $url;
127
	}
127
	}
128
	
128
	
129
	public function getUrlPermalienTaxon($referentiel, $version, $num_tax) {
129
	public function getUrlPermalienTaxon($referentiel, $version, $num_tax) {
130
		$tpl = Config::get('permalienTaxonTpl');
130
		$tpl = Config::get('permalienTaxonTpl');
131
		$params = array('ref_tax' =>$referentiel, 'ref_version' =>$version, 'id' => $num_tax);
131
		$params = array('ref_tax' =>$referentiel, 'ref_version' =>$version, 'id' => $num_tax);
132
		$url = $this->formaterUrl($tpl, $params);
132
		$url = $this->formaterUrl($tpl, $params);
133
		return $url;
133
		return $url;
134
	}
134
	}
135
}
135
}
136
?>
136
?>