Line 51... |
Line 51... |
51 |
$this->initialiserRessourcesEtParametres($ressources, $requeteDonnees);
|
51 |
$this->initialiserRessourcesEtParametres($ressources, $requeteDonnees);
|
52 |
return $this->executerService();
|
52 |
return $this->executerService();
|
53 |
}
|
53 |
}
|
Line 54... |
Line 54... |
54 |
|
54 |
|
55 |
public function modifier($ressources, $requeteDonnees) {
|
55 |
public function modifier($ressources, $requeteDonnees) {
|
56 |
$this->methode = 'supprimer';
|
56 |
$this->methode = 'modifier';
|
57 |
$this->initialiserRessourcesEtParametres($ressources, $requeteDonnees);
|
57 |
$this->initialiserRessourcesEtParametres($ressources, $requeteDonnees);
|
58 |
return $this->executerService();
|
58 |
return $this->executerService();
|
Line 59... |
Line 59... |
59 |
}
|
59 |
}
|
Line 95... |
Line 95... |
95 |
$chemin = Config::get('chemin_configurations')."config_{$this->serviceNom}.ini";
|
95 |
$chemin = Config::get('chemin_configurations')."config_{$this->serviceNom}.ini";
|
96 |
Config::charger($chemin);
|
96 |
Config::charger($chemin);
|
97 |
}
|
97 |
}
|
Line 98... |
Line 98... |
98 |
|
98 |
|
99 |
/**
|
99 |
/**
|
- |
|
100 |
* URLs possibles :
|
- |
|
101 |
*
|
100 |
* URLs possibles GET :
|
102 |
* GET :
|
101 |
* http://localhost/del/services/0.1/images/ => toutes les images : classe ListeImages
|
103 |
* http://localhost/del/services/0.1/images/ => toutes les images : classe ListeImages
|
102 |
* http://localhost/del/services/0.1/images/#id/votes => tous les votes d'une image classés par protocole : classe VotesImage
|
104 |
* http://localhost/del/services/0.1/images/#idImg/votes => tous les votes d'une image (#idImg) classés par protocole : classe VotesImage
|
103 |
*
|
105 |
*
|
104 |
* Non Implémenté : http://localhost/del/services/0.1/images/#id => une image donnée => en test pour remplacer les appels à eflore/cel
|
106 |
* Non Implémenté : http://localhost/del/services/0.1/images/#id => une image donnée => en test pour remplacer les appels à eflore/cel
|
105 |
* Non Implémenté : http://localhost/del/services/0.1/images/#id/votes?protocole=#id => tous les votes d'une image et d'un protocole donné
|
107 |
* Non Implémenté : http://localhost/del/services/0.1/images/#id/votes?protocole=#id => tous les votes d'une image et d'un protocole donné
|
- |
|
108 |
*
|
- |
|
109 |
* PUT :
|
- |
|
110 |
* http://localhost/del/services/0.1/images/#idImg => ajouter un vote sur une image donnée (#idImg)
|
- |
|
111 |
*
|
- |
|
112 |
* POST :
|
- |
|
113 |
* http://localhost/del/services/0.1/images/#idImg => modifier un vote sur une image donnée (#idImg)
|
106 |
*
|
114 |
*
|
107 |
* URLs possibles DELETE :
|
115 |
* DELETE :
|
- |
|
116 |
* http://localhost/del/services/0.1/images/#idImg => supprimer une image donnée (#idImg)
|
108 |
* http://localhost/del/services/0.1/images/#id => supprimer une image donnée
|
117 |
* http://localhost/del/services/0.1/images/#idImg/votes/#idVote => supprimer un vote (#idVote) d'une image donnée (#idImg)
|
109 |
*/
|
118 |
*/
|
- |
|
119 |
private function analyserRessources() {
|
- |
|
120 |
if ($this->methode == 'consulter') {
|
110 |
private function analyserRessources() {
|
121 |
$this->analyserRessoucesConsultation();
|
111 |
if ($this->methode == 'consulter' || $this->methode == 'modifier' || $this->methode == 'ajouter') {
|
122 |
} else if ($this->methode == 'modifier' || $this->methode == 'ajouter') {
|
112 |
$this->analyserRessoucerConsultation();
|
123 |
$this->analyserRessoucesModification();
|
113 |
} else if ($this->methode == 'supprimer') {
|
124 |
} else if ($this->methode == 'supprimer') {
|
114 |
$this->analyserRessoucerSuppression();
|
125 |
$this->analyserRessoucesSuppression();
|
115 |
}
|
126 |
}
|
Line 116... |
Line 127... |
116 |
}
|
127 |
}
|
117 |
|
128 |
|
118 |
private function analyserRessoucerConsultation() {
|
129 |
private function analyserRessoucesConsultation() {
|
119 |
if (count($this->ressources) == 0) {
|
130 |
if (count($this->ressources) == 0) {
|
120 |
$this->sousServiceNom = 'liste-images';
|
131 |
$this->sousServiceNom = 'liste-images';
|
121 |
} else if (count($this->ressources) == 2) {
|
132 |
} else if (count($this->ressources) == 2) {
|
Line 127... |
Line 138... |
127 |
if ($this->sousServiceNom == null) {
|
138 |
if ($this->sousServiceNom == null) {
|
128 |
$this->lancerMessageErreurRessource();
|
139 |
$this->lancerMessageErreurRessource();
|
129 |
}
|
140 |
}
|
130 |
}
|
141 |
}
|
Line -... |
Line 142... |
- |
|
142 |
|
- |
|
143 |
private function analyserRessoucesModification() {
|
- |
|
144 |
if (count($this->ressources) == 2) {
|
- |
|
145 |
if ($this->etreRessourceIdentifiant(0) && $this->verifierRessourceValeur(1, 'votes')) {
|
- |
|
146 |
$this->sousServiceNom = 'votes-image';
|
- |
|
147 |
}
|
- |
|
148 |
}
|
- |
|
149 |
|
- |
|
150 |
if ($this->sousServiceNom == null) {
|
- |
|
151 |
$this->lancerMessageErreurRessource();
|
- |
|
152 |
}
|
- |
|
153 |
}
|
131 |
|
154 |
|
132 |
private function analyserRessoucerSuppression() {
|
155 |
private function analyserRessoucesSuppression() {
|
133 |
if (count($this->ressources) == 1 && $this->etreRessourceIdentifiant(0)) {
|
156 |
if (count($this->ressources) == 1 && $this->etreRessourceIdentifiant(0)) {
|
- |
|
157 |
$this->sousServiceNom = 'liste-images';
|
- |
|
158 |
} else if (count($this->ressources) == 3) {
|
- |
|
159 |
if ($this->etreRessourceIdentifiant(0) && $this->verifierRessourceValeur(1, 'votes') && $this->etreRessourceIdentifiant(2) ) {
|
- |
|
160 |
$this->sousServiceNom = 'votes-image';
|
134 |
$this->sousServiceNom = 'liste-images';
|
161 |
}
|
Line 135... |
Line 162... |
135 |
}
|
162 |
}
|
136 |
|
163 |
|
137 |
if ($this->sousServiceNom == null) {
|
164 |
if ($this->sousServiceNom == null) {
|
Line 181... |
Line 208... |
181 |
$this->conteneur->chargerConfiguration('config_'.$this->serviceNom.'.ini');
|
208 |
$this->conteneur->chargerConfiguration('config_'.$this->serviceNom.'.ini');
|
182 |
require_once $chemin;
|
209 |
require_once $chemin;
|
183 |
$service = new $classe($this->conteneur);
|
210 |
$service = new $classe($this->conteneur);
|
184 |
if ($this->methode == 'consulter') {
|
211 |
if ($this->methode == 'consulter') {
|
185 |
$retour = $service->consulter($this->ressources, $this->parametres);
|
212 |
$retour = $service->consulter($this->ressources, $this->parametres);
|
- |
|
213 |
} elseif ($this->methode == 'ajouter') {
|
- |
|
214 |
$retour = $service->ajouter($this->ressources, $this->parametres);
|
- |
|
215 |
} elseif ($this->methode == 'modifier') {
|
- |
|
216 |
$retour = $service->modifier($this->ressources, $this->parametres);
|
186 |
} elseif ($this->methode == 'supprimer') {
|
217 |
} elseif ($this->methode == 'supprimer') {
|
187 |
$retour = $service->supprimer($this->ressources);
|
218 |
$retour = $service->supprimer($this->ressources);
|
188 |
}
|
219 |
}
|
189 |
}
|
220 |
}
|
190 |
}
|
221 |
}
|