Subversion Repositories eFlore/Applications.cel

Rev

Rev 1204 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1204 Rev 1222
Line 18... Line 18...
18
	public function __construct(array $parametres = null) {
18
	public function __construct(array $parametres = null) {
19
		$this->parametres = is_null($parametres) ? array() : $parametres;
19
		$this->parametres = is_null($parametres) ? array() : $parametres;
20
	}
20
	}
Line 21... Line 21...
21
 
21
 
22
	public function getParametre($cle) {
22
	public function getParametre($cle) {
-
 
23
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : null;
-
 
24
		if (is_null($valeur) && $this->etreParametreASection($cle)) {
-
 
25
			$valeur = $this->getParametreAvecSection($cle);
23
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : null;
26
		}
-
 
27
		return $valeur;
-
 
28
	}
-
 
29
 
-
 
30
	private function etreParametreASection($cle) {
-
 
31
		return strpos($cle, '.') ? true : false;
-
 
32
	}
-
 
33
 
-
 
34
	private function getParametreAvecSection($cle) {
-
 
35
		$cleComposee = explode('.', $cle);
-
 
36
		$valeur = $this->parametres;
-
 
37
		foreach ($cleComposee as $cleCourrante) {
-
 
38
			$valeur = isset($valeur[$cleCourrante]) ? $valeur[$cleCourrante] : null;
-
 
39
		}
24
		return $valeur;
40
		return $valeur;
Line 25... Line 41...
25
	}
41
	}
26
 
42
 
27
	public function getParametreTableau($cle) {
43
	public function getParametreTableau($cle) {
Line 49... Line 65...
49
	public function getBdd() {
65
	public function getBdd() {
50
		if (!isset($this->partages['Bdd'])){
66
		if (!isset($this->partages['Bdd'])){
51
			$this->partages['Bdd'] = new Bdd($this->getParametre('database_cel'));
67
			$this->partages['Bdd'] = new Bdd($this->getParametre('database_cel'));
52
		}
68
		}
53
		return $this->partages['Bdd'];
69
		return $this->partages['Bdd'];
-
 
70
	}
-
 
71
 
-
 
72
	public function getScript() {
-
 
73
		if (!isset($this->partages['Script'])){
-
 
74
			$this->partages['Script'] = new Script();
-
 
75
		}
-
 
76
		return $this->partages['Script'];
54
	}
77
	}
55
}
78
}
56
?>
79
?>
57
80