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
	}
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
 
303 jpm 64
	public function getApiNomsVernaculaires() {
65
		$nomsVernaculaires = new NomsVernaculaires();
66
		return $nomsVernaculaires;
67
	}
68
 
291 jpm 69
	public function getApiTextes() {
70
		$textes = new Textes();
71
		return $textes;
72
	}
73
 
74
	public function getApiMetaDonnees() {
75
		$meta = new MetaDonnees();
76
		return $meta;
77
	}
78
 
293 delphine 79
	public function getNomCourant() {
80
		if (!isset($this->partages['NomCourant'])){
291 jpm 81
			$nns = $this->getParametre('num_nom');
82
			$noms = $this->getApiNoms();
83
			$taxons = $this->getApiTaxons();
293 delphine 84
			$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
291 jpm 85
		}
293 delphine 86
		return $this->partages['NomCourant'];
291 jpm 87
	}
88
 
89
	public function getUtilisateur() {
90
		if (!isset($this->partages['Utilisateur'])){
91
			$this->partages['Utilisateur'] = new Utilisateur($this->parametres['utilisateur.niveau.defaut']);
92
		}
93
		return $this->partages['Utilisateur'];
94
	}
95
 
96
	public function getBdd() {
97
		if (!isset($this->partages['Bdd'])){
98
			$this->partages['Bdd'] = new Bdd();
99
		}
100
		return $this->partages['Bdd'];
101
	}
102
}
103
?>