Subversion Repositories eFlore/Applications.eflore-consultation

Rev

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

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