Subversion Repositories eFlore/Applications.eflore-consultation

Rev

Rev 776 | Rev 927 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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