Line 52... |
Line 52... |
52 |
$total = $this->compterObservations();
|
52 |
$total = $this->compterObservations();
|
53 |
$this->navigation->setTotal($total);
|
53 |
$this->navigation->setTotal($total);
|
54 |
$observations = $this->chargerObservations($liaisons);
|
54 |
$observations = $this->chargerObservations($liaisons);
|
55 |
$observations = $this->chargerImages($observations);
|
55 |
$observations = $this->chargerImages($observations);
|
56 |
$observations = $this->chargerDeterminations($observations);
|
56 |
$observations = $this->chargerDeterminations($observations);
|
57 |
$observations = $this->chargerNombreCommentaire($observations);
|
- |
|
Line 58... |
Line 57... |
58 |
|
57 |
|
59 |
// Mettre en forme le résultat et l'envoyer pour affichage
|
58 |
// Mettre en forme le résultat et l'envoyer pour affichage
|
60 |
$resultat = new ResultatService();
|
59 |
$resultat = new ResultatService();
|
61 |
$resultat->corps = array('entete' => $this->conteneur->getEntete(), 'resultats' => $observations);
|
60 |
$resultat->corps = array('entete' => $this->conteneur->getEntete(), 'resultats' => $observations);
|
Line 284... |
Line 283... |
284 |
private function chargerDeterminations($observations) {
|
283 |
private function chargerDeterminations($observations) {
|
285 |
foreach ($observations as $id => $observation) {
|
284 |
foreach ($observations as $id => $observation) {
|
286 |
$requetePropositions = 'SELECT * FROM '.$this->gestionBdd->formaterTable('del_commentaire', 'dc').
|
285 |
$requetePropositions = 'SELECT * FROM '.$this->gestionBdd->formaterTable('del_commentaire', 'dc').
|
287 |
'WHERE dc.nom_sel IS NOT NULL AND ce_observation = '.$observation['id_observation'];
|
286 |
'WHERE dc.nom_sel IS NOT NULL AND ce_observation = '.$observation['id_observation'];
|
288 |
$propositions = $this->bdd->recupererTous($requetePropositions);
|
287 |
$propositions = $this->bdd->recupererTous($requetePropositions);
|
289 |
$observations[$id]['propositions'] = $propositions;
|
288 |
$observations[$id]['propositions'] = $this->formaterDeterminations($propositions);
|
290 |
}
|
289 |
}
|
291 |
return $observations;
|
290 |
return $observations;
|
292 |
}
|
291 |
}
|
Line -... |
Line 292... |
- |
|
292 |
|
- |
|
293 |
private function formaterDeterminations($propositions) {
|
- |
|
294 |
$propositions_format = array();
|
- |
|
295 |
if ($propositions != array()) {
|
- |
|
296 |
foreach ($propositions as $id => $proposition) {
|
- |
|
297 |
$propositions_format[$proposition['id_commentaire']] = $proposition;
|
- |
|
298 |
$ids_proposition[] = $proposition['id_commentaire'];
|
- |
|
299 |
}
|
- |
|
300 |
$propositions_format = $this->chargerVotes($ids_proposition, $propositions_format);
|
- |
|
301 |
$propositions_format = $this->chargerNombreCommentaire($ids_proposition, $propositions_format);
|
- |
|
302 |
}
|
- |
|
303 |
return $propositions_format;
|
- |
|
304 |
}
|
- |
|
305 |
/**
|
- |
|
306 |
* Charger les votes sur les déterminations
|
- |
|
307 |
* @param Array $observations le tableau des observatins à mettre à jour
|
- |
|
308 |
* */
|
- |
|
309 |
private function chargerVotes($ids_proposition, $propositions) {
|
- |
|
310 |
$requeteVotes = 'SELECT * FROM '.
|
- |
|
311 |
$this->gestionBdd->formaterTable('del_commentaire_vote').
|
- |
|
312 |
'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
|
- |
|
313 |
|
- |
|
314 |
$resultatsVotes = $this->bdd->recupererTous($requeteVotes);
|
- |
|
315 |
foreach ($resultatsVotes as $vote) {
|
- |
|
316 |
$propositions[$vote['ce_proposition']]['votes'][] = $vote;
|
- |
|
317 |
}
|
- |
|
318 |
return $propositions;
|
- |
|
319 |
}
|
293 |
|
320 |
|
294 |
/**
|
321 |
/**
|
295 |
* Charger le nombre de commentaires (sans détermination) associé à l'observation
|
322 |
* Charger le nombre de commentaires (sans détermination) associé à l'observation
|
296 |
* @param Array $observations le tableau des observatins à mettre à jour
|
323 |
* @param Array $observations le tableau des observatins à mettre à jour
|
297 |
* */
|
324 |
* */
|
298 |
private function chargerNombreCommentaire($observations) {
|
- |
|
299 |
foreach ($observations as $id => $observation) {
|
325 |
private function chargerNombreCommentaire($ids_proposition, $propositions) {
|
300 |
$requeteNbCommentaires = 'SELECT COUNT('.$this->proteger('id_commentaire').') as nb '.
|
326 |
$requeteNbCommentaires = 'SELECT ce_proposition, COUNT('.$this->proteger('id_commentaire').') as nb '.
|
301 |
'FROM '.$this->gestionBdd->formaterTable('del_commentaire').
|
327 |
'FROM '.$this->gestionBdd->formaterTable('del_commentaire').
|
302 |
'WHERE ce_observation = '.$observation['id_observation'].' '.
|
- |
|
303 |
'AND nom_sel IS NULL';
|
328 |
'WHERE ce_proposition IN ('.implode(', ', $ids_proposition).')';
|
- |
|
329 |
$nbCommentaires = $this->bdd->recuperer($requeteNbCommentaires);
|
304 |
$nbCommentaires = $this->bdd->recuperer($requeteNbCommentaires);
|
330 |
foreach ($nbCommentaires as $vote) {
|
305 |
$observations[$id]['commentaires'] = (int) $nbCommentaires['nb'];
|
331 |
$propositions[$vote['ce_proposition']]['commentaires']= $vote;
|
306 |
}
|
332 |
}
|
307 |
return $observations;
|
- |
|
308 |
|
- |
|
309 |
|
- |
|
310 |
|
333 |
return $propositions;
|
Line 311... |
Line 334... |
311 |
}
|
334 |
}
|
312 |
|
335 |
|
313 |
/*-------------------------------------------------------------------------------
|
336 |
/*-------------------------------------------------------------------------------
|