Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 927 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 927 Rev 990
1
<?php
1
<?php
2
class Conteneur {
2
class Conteneur {
3
	protected $parametres = array();
3
	protected $parametres = array();
4
	protected $partages = array();
4
	protected $partages = array();
5
 
5
 
6
	public function __construct(array $parametres = null) {
6
	public function __construct(array $parametres = null) {
7
		$this->parametres = is_null($parametres) ? array() : $parametres;
7
		$this->parametres = is_null($parametres) ? array() : $parametres;
8
	}
8
	}
9
 
9
 
10
	public function getParametre($cle) {
10
	public function getParametre($cle) {
11
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
11
		$valeur = isset($this->parametres[$cle]) ? $this->parametres[$cle] : Config::get($cle);
12
		return $valeur;
12
		return $valeur;
13
	}
13
	}
14
 
14
 
15
	public function getParametreTableau($cle) {
15
	public function getParametreTableau($cle) {
16
		$tableau = array();
16
		$tableau = array();
17
		$parametre = $this->getParametre($cle);
17
		$parametre = $this->getParametre($cle);
18
		if (empty($parametre) === false) {
18
		if (empty($parametre) === false) {
19
			$tableauPartiel = explode(',', $parametre);
19
			$tableauPartiel = explode(',', $parametre);
20
			$tableauPartiel = array_map('trim', $tableauPartiel);
20
			$tableauPartiel = array_map('trim', $tableauPartiel);
21
			foreach ($tableauPartiel as $champ) {
21
			foreach ($tableauPartiel as $champ) {
22
				if (strpos($champ, '=') === false) {
22
				if (strpos($champ, '=') === false) {
23
					$tableau[] = trim($champ);
23
					$tableau[] = trim($champ);
24
				} else {
24
				} else {
25
					list($cle, $val) = explode('=', $champ);
25
					list($cle, $val) = explode('=', $champ);
26
					$tableau[trim($cle)] = trim($val);
26
					$tableau[trim($cle)] = trim($val);
27
				}
27
				}
28
			}
28
			}
29
		}
29
		}
30
		return $tableau;
30
		return $tableau;
31
	}
31
	}
32
 
32
 
33
	public function setParametre($cle, $valeur) {
33
	public function setParametre($cle, $valeur) {
34
		$this->parametres[$cle] = $valeur;
34
		$this->parametres[$cle] = $valeur;
35
	}
35
	}
36
 
36
 
37
	public function getAppUrls() {
37
	public function getAppUrls() {
38
		if (!isset($this->partages['AppUrls'])){
38
		if (!isset($this->partages['AppUrls'])){
39
			$this->partages['AppUrls'] = new AppUrls();
39
			$this->partages['AppUrls'] = new AppUrls();
40
		}
40
		}
41
		return $this->partages['AppUrls'];
41
		return $this->partages['AppUrls'];
42
	}
42
	}
43
 
43
 
44
	public function getApiNoms() {
44
	public function getApiNoms() {
45
			$noms = new Noms($this->getParametre('referentiel'));
45
			$noms = new Noms($this->getParametre('referentiel'));
46
		return $noms;
46
		return $noms;
47
	}
47
	}
48
 
48
 
49
	public function getApiTaxons() {
49
	public function getApiTaxons() {
50
			$taxons = new Taxons($this->getParametre('referentiel'));
50
			$taxons = new Taxons($this->getParametre('referentiel'));
51
		return $taxons;
51
		return $taxons;
52
	}
52
	}
53
 
53
 
54
	public function getApiBiblioBota() {
54
	public function getApiBiblioBota() {
55
		$biblioBota = new BiblioBota();
55
		$biblioBota = new BiblioBota();
56
		return $biblioBota;
56
		return $biblioBota;
57
	}
57
	}
58
 
58
 
59
	public function getApiImages() {
59
	public function getApiImages() {
60
		$images = new Images();
60
		$images = new Images();
61
		return $images;
61
		return $images;
62
	}
62
	}
63
 
63
 
64
	public function getApiCartes() {
64
	public function getApiCartes() {
65
		$cartes = new Cartes();
65
		$cartes = new Cartes();
66
		return $cartes;
66
		return $cartes;
67
	}
67
	}
68
 
68
 
69
	public function getApiNomsVernaculaires() {
69
	public function getApiNomsVernaculaires() {
70
		$nomsVernaculaires = new NomsVernaculaires();
70
		$nomsVernaculaires = new NomsVernaculaires();
71
		return $nomsVernaculaires;
71
		return $nomsVernaculaires;
72
	}
72
	}
73
 
73
 
74
	public function getApiTextes() {
74
	public function getApiTextes() {
75
		$textes = new Textes();
75
		$textes = new Textes();
76
		return $textes;
76
		return $textes;
77
	}
77
	}
78
 
78
 
79
	public function getApiWikini() {
79
	public function getApiWikini() {
80
		$wiki = new Wikini();
80
		$wiki = new Wikini();
81
		return $wiki;
81
		return $wiki;
82
	}
82
	}
83
	
83
	
84
	public function getApiGraphiques() {
84
	public function getApiGraphiques() {
85
		$graphique = new Graphiques();
85
		$graphique = new Graphiques();
86
		return $graphique;
86
		return $graphique;
87
	}
87
	}
88
	
88
	
89
	public function getApiSyntaxons() {
89
	public function getApiSyntaxons() {
90
		$syntaxon = new Syntaxons();
90
		$syntaxon = new Syntaxons();
91
		return $syntaxon;
91
		return $syntaxon;
92
	}
92
	}
93
 
93
 
94
	public function getApiMetaDonnees() {
94
	public function getApiMetaDonnees() {
95
		$meta = new MetaDonnees();
95
		$meta = new MetaDonnees();
96
		return $meta;
96
		return $meta;
97
	}
97
	}
98
	
98
	
99
	public function getApiInformations() {
99
	public function getApiInformations() {
100
		$informations = new Informations();
100
		$informations = new Informations();
101
		return $informations;
101
		return $informations;
102
	}
102
	}
103
	
103
	
104
	public function getApiStatuts() {
104
	public function getApiStatuts() {
105
		$statuts = new Statuts();
105
		$statuts = new Statuts();
106
		return $statuts;
106
		return $statuts;
107
	}
107
	}
108
 
108
 
109
	public function getNomCourant() {
109
	public function getNomCourant() {
110
		if (!isset($this->partages['NomCourant'])){
110
		if (!isset($this->partages['NomCourant'])){
111
			$nns = $this->getParametre('num_nom');
111
			$nns = $this->getParametre('num_nom');
112
			$noms = $this->getApiNoms();
112
			$noms = $this->getApiNoms();
113
			$taxons = $this->getApiTaxons();
113
			$taxons = $this->getApiTaxons();
114
			$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
114
			$this->partages['NomCourant'] = new NomCourant($nns, $noms, $taxons);
115
		}
115
		}
116
		return $this->partages['NomCourant'];
116
		return $this->partages['NomCourant'];
117
	}
117
	}
118
 
118
 
119
	public function getUtilisateur() {
119
	public function getUtilisateur() {
120
		if (!isset($this->partages['Utilisateur'])){
120
		if (!isset($this->partages['Utilisateur'])){
121
			$this->partages['Utilisateur'] = new Utilisateur($this);
121
			$this->partages['Utilisateur'] = new Utilisateur($this);
122
		}
122
		}
123
		return $this->partages['Utilisateur'];
123
		return $this->partages['Utilisateur'];
124
	}
124
	}
125
 
125
 
126
	public function getBdd() {
126
	public function getBdd() {
127
		if (!isset($this->partages['Bdd'])){
127
		if (!isset($this->partages['Bdd'])){
128
			$this->partages['Bdd'] = new Bdd();
128
			$this->partages['Bdd'] = new Bdd();
129
		}
129
		}
130
		return $this->partages['Bdd'];
130
		return $this->partages['Bdd'];
131
	}
131
	}
-
 
132
	
-
 
133
	public function getCache($dossierStockage = null) {
-
 
134
		if (!isset($this->partages['Cache'])){
-
 
135
			$params = array(
-
 
136
				'mise_en_cache' => $this->getParametre('cache'), 
-
 
137
				'stockage_chemin' => is_null($dossierStockage) ? $this->getParametre('chemincache') : $dossierStockage, 
-
 
138
				'duree_de_vie' => $this->getParametre('dureecache')
-
 
139
			);
-
 
140
			$this->partages['Cache'] = new CacheSimple($params);
-
 
141
		}
-
 
142
		return $this->partages['Cache'];
-
 
143
	}
132
 
144
 
133
	public function getRestClient() {
145
	public function getRestClient() {
134
		if (!isset($this->partages['RestClient'])){
146
		if (!isset($this->partages['RestClient'])){
135
			$this->partages['RestClient'] = new RestClient();
147
			$this->partages['RestClient'] = new RestClient();
136
		}
148
		}
137
		return $this->partages['RestClient'];
149
		return $this->partages['RestClient'];
138
	}
150
	}
-
 
151
	
-
 
152
	public function getQrCode() {
-
 
153
		if (!isset($this->partages['QrCode'])){
-
 
154
			$this->partages['QrCode'] = new QrCode($this);
-
 
155
		}
-
 
156
		return $this->partages['QrCode'];
-
 
157
	}
139
}
158
}
140
?>
159
?>