Subversion Repositories eFlore/Projets.eflore-projets

Rev

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

Rev 215 Rev 216
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 getParametresUrl() {
37
	public function getParametresUrl() {
38
		if (!isset($this->partages['Parametres'])){
38
		if (!isset($this->partages['Parametres'])){
39
			$this->partages['Parametres'] = new Parametres($this->parametres['parametres'], $this->getBdd());
39
			$this->partages['Parametres'] = new Parametres($this->parametres['parametres'], $this->getBdd());
40
		}
40
		}
41
		return $this->partages['Parametres'];
41
		return $this->partages['Parametres'];
42
	}
42
	}
43
 
43
 
44
	public function getParametresUrlVerificateur() {
44
	public function getParametresUrlVerificateur() {
45
		if (!isset($this->partages['ParametresVerificateur'])){
45
		if (!isset($this->partages['ParametresVerificateur'])){
46
			$parametres = $this->getParametresUrl();
46
			$parametres = $this->getParametresUrl();
47
			$parametresAPI = $this->getParametreTableau('parametresAPI');
47
			$parametresAPI = $this->getParametreTableau('parametresAPI');
48
			$this->partages['ParametresVerificateur'] = new ParametresVerificateur($parametres, $parametresAPI);
48
			$this->partages['ParametresVerificateur'] = new ParametresVerificateur($parametres, $parametresAPI);
49
		}
49
		}
50
		return $this->partages['ParametresVerificateur'];
50
		return $this->partages['ParametresVerificateur'];
51
	}
51
	}
52
 
52
 
53
	public function getRessourcesUrl() {
53
	public function getRessourcesUrl() {
54
		if (!isset($this->partages['Ressources'])){
54
		if (!isset($this->partages['Ressources'])){
55
			$this->partages['Ressources'] = new Ressources($this->parametres['ressources']);
55
			$this->partages['Ressources'] = new Ressources($this->parametres['ressources']);
56
		}
56
		}
57
		return $this->partages['Ressources'];
57
		return $this->partages['Ressources'];
58
	}
58
	}
59
 
59
 
60
	public function getRessourcesUrlVerificateur() {
60
	public function getRessourcesUrlVerificateur() {
61
		if (!isset($this->partages['RessourcesVerificateur'])){
61
		if (!isset($this->partages['RessourcesVerificateur'])){
62
			$ressources = $this->getRessourcesUrl();
62
			$ressources = $this->getRessourcesUrl();
63
			$projetsDispo = $this->getParametreTableau('projetsDispo');
63
			$projetsDispo = $this->getParametreTableau('projetsDispo');
64
			$servicesDispo = $this->getParametreTableau('servicesDispo');
64
			$servicesDispo = $this->getParametreTableau('servicesDispo');
65
			$this->partages['RessourcesVerificateur'] = new RessourcesVerificateur($ressources, $projetsDispo, $servicesDispo);
65
			$this->partages['RessourcesVerificateur'] = new RessourcesVerificateur($ressources, $projetsDispo, $servicesDispo);
66
		}
66
		}
67
		return $this->partages['RessourcesVerificateur'];
67
		return $this->partages['RessourcesVerificateur'];
68
	}
68
	}
-
 
69
 
-
 
70
	public function getVersionVerificateur() {
-
 
71
		if (!isset($this->partages['VersionVerificateur'])){
-
 
72
			$ressources = $this->getRessourcesUrl();
-
 
73
			$parametres = $this->getParametresUrl();
-
 
74
			$versions = $this->getVersions();
-
 
75
			$this->partages['VersionVerificateur'] = new VersionVerificateur($ressources, $parametres, $versions);
-
 
76
		}
-
 
77
		return $this->partages['VersionVerificateur'];
-
 
78
	}
69
 
79
 
70
	public function getBdd() {
80
	public function getBdd() {
71
		if (!isset($this->partages['Bdd'])){
81
		if (!isset($this->partages['Bdd'])){
72
			$this->partages['Bdd'] = new Bdd();
82
			$this->partages['Bdd'] = new Bdd();
73
		}
83
		}
74
		return $this->partages['Bdd'];
84
		return $this->partages['Bdd'];
75
	}
85
	}
76
 
86
 
77
	public function getVersions() {
87
	public function getVersions() {
78
		if (!isset($this->partages['Versions'])){
88
		if (!isset($this->partages['Versions'])){
79
			$parametres = $this->getParametresUrl();
89
			$parametres = $this->getParametresUrl();
80
			$ressources = $this->getRessourcesUrl();
90
			$ressources = $this->getRessourcesUrl();
81
			$bdd = $this->getBdd();
91
			$bdd = $this->getBdd();
82
			$versions = new Versions($parametres, $ressources, $bdd);
92
			$versions = new Versions($parametres, $ressources, $bdd);
83
			$this->partages['Versions'] = $versions;
93
			$this->partages['Versions'] = $versions;
84
		}
94
		}
85
		return $this->partages['Versions'];
95
		return $this->partages['Versions'];
86
	}
96
	}
87
 
97
 
88
	public function getProjet() {
98
	public function getProjet() {
89
		if (!isset($this->partages['Projet'])){
99
		if (!isset($this->partages['Projet'])){
90
			$ressources = $this->getRessourcesUrl();
100
			$ressources = $this->getRessourcesUrl();
91
			$projet = new Projet($ressources);
101
			$projet = new Projet($ressources);
92
			$projet->setCheminBase($this->getParametre('cheminBase'));
102
			$projet->setCheminBase($this->getParametre('cheminBase'));
93
			$projet->setCheminConfig($this->getParametre('chemin_configurations'));
103
			$projet->setCheminConfig($this->getParametre('chemin_configurations'));
94
			$projet->setCheminBiblio($this->getParametre('chemin_bibliotheque'));
104
			$projet->setCheminBiblio($this->getParametre('chemin_bibliotheque'));
95
			$projet->initialiser();
105
			$projet->initialiser();
96
			$projet->setParamsVerif($this->getParametresUrlVerificateur());
106
			$projet->setParamsVerif($this->getParametresUrlVerificateur());
97
			$projet->setRessourcesVerif($this->getRessourcesUrlVerificateur());
107
			$projet->setRessourcesVerif($this->getRessourcesUrlVerificateur());
-
 
108
			$projet->setVersionVerif($this->getVersionVerificateur());
98
			$projet->setServiceGenerique($this->getServiceGenerique());
109
			$projet->setServiceGenerique($this->getServiceGenerique());
99
			$this->partages['Projet'] = $projet;
110
			$this->partages['Projet'] = $projet;
100
		}
111
		}
101
		return $this->partages['Projet'];
112
		return $this->partages['Projet'];
102
	}
113
	}
103
 
114
 
104
	public function getNomDao() {
115
	public function getNomDao() {
105
		$ressources = $this->getRessourcesUrl();
116
		$ressources = $this->getRessourcesUrl();
106
		$parametres = $this->getParametresUrl();
117
		$parametres = $this->getParametresUrl();
107
		$bdd = $this->getBdd();
118
		$bdd = $this->getBdd();
108
		$versions = $this->getVersions();
119
		$versions = $this->getVersions();
109
		$nomDao = new NomDAO($ressources, $parametres, $bdd, $versions);
120
		$nomDao = new NomDAO($ressources, $parametres, $bdd, $versions);
110
		return $nomDao;
121
		return $nomDao;
111
	}
122
	}
112
 
123
 
113
	public function getNomFormateur() {
124
	public function getNomFormateur() {
114
		$formateur = new NomFormateur();
125
		$formateur = new NomFormateur();
115
		$formateur->setBdd($this->getBdd());
126
		$formateur->setBdd($this->getBdd());
116
		$formateur->setChampsProjet($this->getParametreTableau('champsProjet'));
127
		$formateur->setChampsProjet($this->getParametreTableau('champsProjet'));
117
		$formateur->setDetailsHrefTpl($this->getParametre('detailsHrefTpl'));
128
		$formateur->setDetailsHrefTpl($this->getParametre('detailsHrefTpl'));
118
		$formateur->setOntologieHrefTpl($this->getParametre('ontologieHrefTpl'));
129
		$formateur->setOntologieHrefTpl($this->getParametre('ontologieHrefTpl'));
119
		return $formateur;
130
		return $formateur;
120
	}
131
	}
121
 
132
 
122
	public function getServiceGenerique() {
133
	public function getServiceGenerique() {
123
		$classe = $this->getRessourcesUrl()->getServiceClasse();
134
		$classe = $this->getRessourcesUrl()->getServiceClasse();
124
		$classeGenerique = $classe.'Generique';
135
		$classeGenerique = $classe.'Generique';
125
		$service = new $classeGenerique($this->getRessourcesUrl(), $this->getParametresUrl(), $this->getNomDao(), $this->getNomFormateur());
136
		$service = new $classeGenerique($this->getRessourcesUrl(), $this->getParametresUrl(), $this->getNomDao(), $this->getNomFormateur());
126
		if ($classe == 'NomsListe') {
137
		if ($classe == 'NomsListe') {
127
			$service->setListeUrl($this->getParametre('listeUrl'));
138
			$service->setListeUrl($this->getParametre('listeUrl'));
128
		}
139
		}
129
		return $service;
140
		return $service;
130
	}
141
	}
131
}
142
}
132
?>
143
?>