Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 333 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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