Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

Rev 63 Rev 291
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
 
-
 
17
	public function getTaxon($nn) {
-
 
18
		$url = $this->getUrlTaxon($nn);
-
 
19
		return $this->chargerDonnees($url);
-
 
20
	}
16
 
21
 
17
	public function getStatsInitialesFamille() {
22
	public function getStatsInitialesFamille() {
18
		$url = $this->getUrlStatsInitiales(self::RANG_FAMILLE);
23
		$url = $this->getUrlStatsInitiales(self::RANG_FAMILLE);
19
		$donnees = $this->chargerDonnees($url);
24
		$donnees = $this->chargerDonnees($url);
20
		if (isset($donnees['Famille'])) {
25
		if (isset($donnees['Famille'])) {
21
			$initiales = $donnees['Famille'];
26
			$initiales = $donnees['Famille'];
22
		} elseif (isset($donnees[self::RANG_FAMILLE])) {
27
		} elseif (isset($donnees[self::RANG_FAMILLE])) {
23
			$initiales = $donnees[self::RANG_FAMILLE];
28
			$initiales = $donnees[self::RANG_FAMILLE];
24
		}
29
		}
25
		
30
 
26
		return $initiales;
31
		return $initiales;
27
	}
32
	}
-
 
33
 
-
 
34
	private function getUrlTaxon($nn) {
-
 
35
		$tpl = Config::get('taxonTpl');
-
 
36
		$params = array('id' => $nn);
-
 
37
		$url = $this->formaterUrl($tpl, $params);
-
 
38
		return $url;
28
 
39
	}
29
	
40
 
30
	public function getStatsInitialesGenre() {
41
	public function getStatsInitialesGenre() {
31
		$url = $this->getUrlStatsInitiales(self::RANG_GENRE);
42
		$url = $this->getUrlStatsInitiales(self::RANG_GENRE);
32
		$donnees = $this->chargerDonnees($url);
43
		$donnees = $this->chargerDonnees($url);
33
		$initiales = $donnees['Genre'];
44
		$initiales = $donnees['Genre'];
34
		if (isset($donnees['Genre'])) {
45
		if (isset($donnees['Genre'])) {
35
			$initiales = $donnees['Genre'];
46
			$initiales = $donnees['Genre'];
36
		} elseif (isset($donnees[self::RANG_GENRE])) {
47
		} elseif (isset($donnees[self::RANG_GENRE])) {
37
			$initiales = $donnees[self::RANG_GENRE];
48
			$initiales = $donnees[self::RANG_GENRE];
38
		}
49
		}
39
		return $initiales;
50
		return $initiales;
40
	}
51
	}
41
	
52
 
42
	private function getUrlStatsInitiales($rang) {
53
	private function getUrlStatsInitiales($rang) {
43
		$tpl = Config::get('taxonsStatsInitialesRangTpl');
54
		$tpl = Config::get('taxonsStatsInitialesRangTpl');
44
		$params = array('rang' => $rang);
55
		$params = array('rang' => $rang);
45
		$url = $this->formaterUrl($tpl, $params);
56
		$url = $this->formaterUrl($tpl, $params);
46
		return $url;
57
		return $url;
47
	}
58
	}
48
 
59
 
49
	public function getListeFamilleParInitiale($lettre) {
60
	public function getListeFamilleParInitiale($lettre) {
50
		$url = $this->getUrlInitiales(self::RANG_FAMILLE, $lettre);
61
		$url = $this->getUrlInitiales(self::RANG_FAMILLE, $lettre);
51
		$donnees = $this->chargerDonneesRecursivement($url);
62
		$donnees = $this->chargerDonneesRecursivement($url);
52
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
63
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
53
		return $taxons;
64
		return $taxons;
54
	}
65
	}
55
	
66
 
56
	public function getListeGenreParInitiale($lettre) {
67
	public function getListeGenreParInitiale($lettre) {
57
		$url = $this->getUrlInitiales(self::RANG_GENRE, $lettre);
68
		$url = $this->getUrlInitiales(self::RANG_GENRE, $lettre);
58
		$donnees = $this->chargerDonneesRecursivement($url);
69
		$donnees = $this->chargerDonneesRecursivement($url);
59
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
70
		$taxons = ($donnees === false) ?  $donnees : $donnees['resultat'];
60
		return $taxons;
71
		return $taxons;
61
	}
72
	}
62
	
73
 
63
	private function getUrlInitiales($rang, $lettre) {
74
	private function getUrlInitiales($rang, $lettre) {
64
		$tpl = Config::get('taxonsListeInitialesRangTpl');
75
		$tpl = Config::get('taxonsListeInitialesRangTpl');
65
		$params = array('rang' => $rang, 'initiale' => $lettre);
76
		$params = array('rang' => $rang, 'initiale' => $lettre);
66
		$url = $this->formaterUrl($tpl, $params);
77
		$url = $this->formaterUrl($tpl, $params);
67
		return $url;
78
		return $url;
68
	}
79
	}
69
	
80
 
70
	public function getRechercheEtendue($nom) {
81
	public function getRechercheEtendue($nom) {
71
		$url = $this->getUrlRecherche($nom, 'etendue');
82
		$url = $this->getUrlRecherche($nom, 'etendue');
72
		return $this->chargerDonnees($url);
83
		return $this->chargerDonnees($url);
73
	}
84
	}
74
	
85
 
75
	public function getRechercheFloue($nom) {
86
	public function getRechercheFloue($nom) {
76
		$url = $this->getUrlRecherche($nom, 'floue');
87
		$url = $this->getUrlRecherche($nom, 'floue');
77
		return $this->chargerDonnees($url);
88
		return $this->chargerDonnees($url);
78
	}
89
	}
79
	
90
 
80
	private function getUrlRecherche($nom, $typeRech) {
91
	private function getUrlRecherche($nom, $typeRech) {
81
		$tpl = Config::get('taxonsRechercheTpl');
92
		$tpl = Config::get('taxonsRechercheTpl');
82
		$params = array('valeur' => $nom, 'type' => $typeRech);
93
		$params = array('valeur' => $nom, 'type' => $typeRech);
83
		$url = $this->formaterUrl($tpl, $params);
94
		$url = $this->formaterUrl($tpl, $params);
84
		return $url;
95
		return $url;
85
	}
96
	}
86
}
97
}
87
?>
98
?>