Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 776 | Rev 927 | Go to most recent revision | Details | Compare with Previous | 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() {
926 delphine 45
		if (isset($this->getParametre('referentiel'))) {
46
			$noms = new Noms($this->getParametre('referentiel'));
47
		} else {
48
			$noms = new Noms($this->getParametre('referentiel_defaut'));
49
		}
291 jpm 50
		return $noms;
51
	}
52
 
53
	public function getApiTaxons() {
926 delphine 54
		if (isset($this->getParametre('referentiel'))) {
55
			$taxons = new Taxons($this->getParametre('referentiel'));
56
		} else {
57
			$taxons = new Taxons($this->getParametre('referentiel_defaut'));
58
		}
291 jpm 59
		return $taxons;
60
	}
518 jpm 61
 
349 gduche 62
	public function getApiBiblioBota() {
63
		$biblioBota = new BiblioBota();
64
		return $biblioBota;
65
	}
291 jpm 66
 
67
	public function getApiImages() {
68
		$images = new Images();
69
		return $images;
70
	}
71
 
72
	public function getApiCartes() {
73
		$cartes = new Cartes();
74
		return $cartes;
75
	}
76
 
303 jpm 77
	public function getApiNomsVernaculaires() {
78
		$nomsVernaculaires = new NomsVernaculaires();
79
		return $nomsVernaculaires;
80
	}
81
 
291 jpm 82
	public function getApiTextes() {
83
		$textes = new Textes();
84
		return $textes;
85
	}
518 jpm 86
 
387 aurelien 87
	public function getApiWikini() {
88
		$wiki = new Wikini();
89
		return $wiki;
90
	}
574 mathilde 91
 
92
	public function getApiGraphiques() {
93
		$graphique = new Graphiques();
94
		return $graphique;
95
	}
776 mathilde 96
 
97
	public function getApiSyntaxons() {
98
		$syntaxon = new Syntaxons();
99
		return $syntaxon;
100
	}
291 jpm 101
 
102
	public function getApiMetaDonnees() {
103
		$meta = new MetaDonnees();
104
		return $meta;
105
	}
543 mathilde 106
 
107
	public function getApiInformations() {
108
		$informations = new Informations();
109
		return $informations;
110
	}
769 aurelien 111
 
112
	public function getApiStatuts() {
113
		$statuts = new Statuts();
114
		return $statuts;
115
	}
291 jpm 116
 
293 delphine 117
	public function getNomCourant() {
118
		if (!isset($this->partages['NomCourant'])){
291 jpm 119
			$nns = $this->getParametre('num_nom');
120
			$noms = $this->getApiNoms();
121
			$taxons = $this->getApiTaxons();
293 delphine 122
			$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
291 jpm 123
		}
293 delphine 124
		return $this->partages['NomCourant'];
291 jpm 125
	}
126
 
127
	public function getUtilisateur() {
128
		if (!isset($this->partages['Utilisateur'])){
518 jpm 129
			$this->partages['Utilisateur'] = new Utilisateur($this);
291 jpm 130
		}
131
		return $this->partages['Utilisateur'];
132
	}
133
 
134
	public function getBdd() {
135
		if (!isset($this->partages['Bdd'])){
136
			$this->partages['Bdd'] = new Bdd();
137
		}
138
		return $this->partages['Bdd'];
139
	}
518 jpm 140
 
141
	public function getRestClient() {
142
		if (!isset($this->partages['RestClient'])){
143
			$this->partages['RestClient'] = new RestClient();
144
		}
145
		return $this->partages['RestClient'];
146
	}
291 jpm 147
}
148
?>