Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 291 | Rev 349 | 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() {
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
	}
53
 
54
	public function getApiImages() {
55
		$images = new Images();
56
		return $images;
57
	}
58
 
59
	public function getApiCartes() {
60
		$cartes = new Cartes();
61
		return $cartes;
62
	}
63
 
64
	public function getApiTextes() {
65
		$textes = new Textes();
66
		return $textes;
67
	}
68
 
69
	public function getApiMetaDonnees() {
70
		$meta = new MetaDonnees();
71
		return $meta;
72
	}
73
 
293 delphine 74
	public function getNomCourant() {
75
		if (!isset($this->partages['NomCourant'])){
291 jpm 76
			$nns = $this->getParametre('num_nom');
77
			$noms = $this->getApiNoms();
78
			$taxons = $this->getApiTaxons();
293 delphine 79
			$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
291 jpm 80
		}
293 delphine 81
		return $this->partages['NomCourant'];
291 jpm 82
	}
83
 
84
	public function getUtilisateur() {
85
		if (!isset($this->partages['Utilisateur'])){
86
			$this->partages['Utilisateur'] = new Utilisateur($this->parametres['utilisateur.niveau.defaut']);
87
		}
88
		return $this->partages['Utilisateur'];
89
	}
90
 
91
	public function getBdd() {
92
		if (!isset($this->partages['Bdd'])){
93
			$this->partages['Bdd'] = new Bdd();
94
		}
95
		return $this->partages['Bdd'];
96
	}
97
}
98
?>