| Line 26... |
Line 26... |
| 26 |
|
26 |
|
| 27 |
public function __construct(Conteneur $conteneur = null) {
|
27 |
public function __construct(Conteneur $conteneur = null) {
|
| 28 |
$this->conteneur = $conteneur == null ? new Conteneur() : $conteneur;
|
28 |
$this->conteneur = $conteneur == null ? new Conteneur() : $conteneur;
|
| 29 |
$this->conteneur->chargerConfiguration('config_departements.ini');
|
29 |
$this->conteneur->chargerConfiguration('config_departements.ini');
|
| - |
|
30 |
$this->conteneur->chargerConfiguration('config_observations.ini');
|
| 30 |
$this->conteneur->chargerConfiguration('config_observations.ini');
|
31 |
$this->conteneur->chargerConfiguration('config_votes.ini');
|
| 31 |
$this->navigation = $conteneur->getNavigation();
|
32 |
$this->navigation = $conteneur->getNavigation();
|
| 32 |
$this->masque = $conteneur->getMasque();
|
33 |
$this->masque = $conteneur->getMasque();
|
| 33 |
$this->gestionBdd = $conteneur->getGestionBdd();
|
34 |
$this->gestionBdd = $conteneur->getGestionBdd();
|
| 34 |
$this->bdd = $this->gestionBdd->getBdd();
|
35 |
$this->bdd = $this->gestionBdd->getBdd();
|
| Line 68... |
Line 69... |
| 68 |
* Configuration du service en fonction du fichier de config config_del.ini
|
69 |
* Configuration du service en fonction du fichier de config config_del.ini
|
| 69 |
* */
|
70 |
* */
|
| 70 |
private function configurer() {
|
71 |
private function configurer() {
|
| 71 |
$this->mappingFiltre = $this->conteneur->getParametre('mapping_masque');
|
72 |
$this->mappingFiltre = $this->conteneur->getParametre('mapping_masque');
|
| 72 |
$this->mappingObservation = $this->conteneur->getParametre('mapping_observation');
|
73 |
$this->mappingObservation = $this->conteneur->getParametre('mapping_observation');
|
| - |
|
74 |
$this->mappingVotes = $this->conteneur->getParametre('mapping_votes');
|
| 73 |
}
|
75 |
}
|
| Line 74... |
Line 76... |
| 74 |
|
76 |
|
| 75 |
/**
|
77 |
/**
|
| 76 |
* Vérifier que le service est bien configuré
|
78 |
* Vérifier que le service est bien configuré
|
| Line 311... |
Line 313... |
| 311 |
$this->gestionBdd->formaterTable('del_commentaire_vote').
|
313 |
$this->gestionBdd->formaterTable('del_commentaire_vote').
|
| 312 |
'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
|
314 |
'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
|
| Line 313... |
Line 315... |
| 313 |
|
315 |
|
| 314 |
$resultatsVotes = $this->bdd->recupererTous($requeteVotes);
|
316 |
$resultatsVotes = $this->bdd->recupererTous($requeteVotes);
|
| 315 |
foreach ($resultatsVotes as $vote) {
|
317 |
foreach ($resultatsVotes as $vote) {
|
| 316 |
$propositions[$vote['ce_proposition']]['votes'][] = $vote;
|
318 |
$propositions[$vote['ce_proposition']]['votes'][] = $this->formaterVotes($vote);
|
| 317 |
}
|
319 |
}
|
| 318 |
return $propositions;
|
320 |
return $propositions;
|
| Line 319... |
Line 321... |
| 319 |
}
|
321 |
}
|
| Line 383... |
Line 385... |
| 383 |
$url = $this->conteneur->getParametre('url_images');
|
385 |
$url = $this->conteneur->getParametre('url_images');
|
| 384 |
$urlImage = str_replace('%s', $idImage, $url);
|
386 |
$urlImage = str_replace('%s', $idImage, $url);
|
| 385 |
return $urlImage;
|
387 |
return $urlImage;
|
| 386 |
}
|
388 |
}
|
| Line -... |
Line 389... |
| - |
|
389 |
|
| - |
|
390 |
/**
|
| - |
|
391 |
* Formater un vote en fonction du fichier de configuration config_votes.ini
|
| - |
|
392 |
* @param $votes array()
|
| - |
|
393 |
* */
|
| - |
|
394 |
private function formaterVotes($vote) {
|
| - |
|
395 |
$retour = array();
|
| - |
|
396 |
foreach ($vote as $param=>$valeur) {
|
| - |
|
397 |
$retour[$vote['id_vote']][$this->mappingVotes[$param]] = $valeur;
|
| - |
|
398 |
}
|
| - |
|
399 |
return $retour;
|
| - |
|
400 |
}
|
| 387 |
|
401 |
|
| 388 |
private function proteger($valeur) {
|
402 |
private function proteger($valeur) {
|
| 389 |
if (is_array($valeur)) {
|
403 |
if (is_array($valeur)) {
|
| 390 |
return $this->bdd->protegerTableau($valeur);
|
404 |
return $this->bdd->protegerTableau($valeur);
|
| 391 |
} else {
|
405 |
} else {
|