Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
291 jpm 1
<?php
2
class Conteneur {
3
	protected $parametres = array();
4
	protected $partages = array();
5
 
6
	public function __construct(array $parametres = null) {
7
		$this->parametres = is_null($parametres) ? array() : $parametres;
8
	}
9
 
10
	public function getParametre($cle) {
11
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
12
		return $valeur;
13
	}
14
 
15
	public function getParametreTableau($cle) {
16
		$tableau = array();
17
		$parametre = $this->getParametre($cle);
18
		if (empty($parametre) === false) {
19
			$tableauPartiel = explode(',', $parametre);
20
			$tableauPartiel = array_map('trim', $tableauPartiel);
21
			foreach ($tableauPartiel as $champ) {
22
				if (strpos($champ, '=') === false) {
23
					$tableau[] = trim($champ);
24
				} else {
25
					list($cle, $val) = explode('=', $champ);
26
					$tableau[trim($cle)] = trim($val);
27
				}
28
			}
29
		}
30
		return $tableau;
31
	}
32
 
33
	public function setParametre($cle, $valeur) {
34
		$this->parametres[$cle] = $valeur;
35
	}
36
 
37
	public function getAppUrls() {
38
		if (!isset($this->partages['AppUrls'])){
39
			$this->partages['AppUrls'] = new AppUrls();
40
		}
41
		return $this->partages['AppUrls'];
42
	}
43
 
44
	public function getApiNoms() {
45
		$noms = new Noms($this->getParametre('referentiel_defaut'));
46
		return $noms;
47
	}
48
 
49
	public function getApiTaxons() {
50
		$taxons = new Taxons($this->getParametre('referentiel_defaut'));
51
		return $taxons;
52
	}
518 jpm 53
 
349 gduche 54
	public function getApiBiblioBota() {
55
		$biblioBota = new BiblioBota();
56
		return $biblioBota;
57
	}
291 jpm 58
 
59
	public function getApiImages() {
60
		$images = new Images();
61
		return $images;
62
	}
63
 
64
	public function getApiCartes() {
65
		$cartes = new Cartes();
66
		return $cartes;
67
	}
68
 
303 jpm 69
	public function getApiNomsVernaculaires() {
70
		$nomsVernaculaires = new NomsVernaculaires();
71
		return $nomsVernaculaires;
72
	}
73
 
291 jpm 74
	public function getApiTextes() {
75
		$textes = new Textes();
76
		return $textes;
77
	}
518 jpm 78
 
387 aurelien 79
	public function getApiWikini() {
80
		$wiki = new Wikini();
81
		return $wiki;
82
	}
574 mathilde 83
 
84
	public function getApiGraphiques() {
85
		$graphique = new Graphiques();
86
		return $graphique;
87
	}
291 jpm 88
 
89
	public function getApiMetaDonnees() {
90
		$meta = new MetaDonnees();
91
		return $meta;
92
	}
543 mathilde 93
 
94
	public function getApiInformations() {
95
		$informations = new Informations();
96
		return $informations;
97
	}
769 aurelien 98
 
99
	public function getApiStatuts() {
100
		$statuts = new Statuts();
101
		return $statuts;
102
	}
291 jpm 103
 
293 delphine 104
	public function getNomCourant() {
105
		if (!isset($this->partages['NomCourant'])){
291 jpm 106
			$nns = $this->getParametre('num_nom');
107
			$noms = $this->getApiNoms();
108
			$taxons = $this->getApiTaxons();
293 delphine 109
			$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
291 jpm 110
		}
293 delphine 111
		return $this->partages['NomCourant'];
291 jpm 112
	}
113
 
114
	public function getUtilisateur() {
115
		if (!isset($this->partages['Utilisateur'])){
518 jpm 116
			$this->partages['Utilisateur'] = new Utilisateur($this);
291 jpm 117
		}
118
		return $this->partages['Utilisateur'];
119
	}
120
 
121
	public function getBdd() {
122
		if (!isset($this->partages['Bdd'])){
123
			$this->partages['Bdd'] = new Bdd();
124
		}
125
		return $this->partages['Bdd'];
126
	}
518 jpm 127
 
128
	public function getRestClient() {
129
		if (!isset($this->partages['RestClient'])){
130
			$this->partages['RestClient'] = new RestClient();
131
		}
132
		return $this->partages['RestClient'];
133
	}
291 jpm 134
}
135
?>