Loading view/unicaen-enquete/resultat/resultats.phtml +29 −5 Original line number Diff line number Diff line Loading @@ -335,14 +335,32 @@ $nbElements = count($elements); </thead> <tbody> <?php if (isset($comments[$question->getId()])) : ?> <?php foreach ($comments[$question->getId()] as [$note, $commentaire]) : ?> <tr> <?php $commentaires = $comments[$question->getId()]; usort($commentaires, function ($a, $b) { return $a[0] <=> $b[0]; }); $sortedCommentaires = []; foreach ($commentaires as $commentaire) { $sortedCommentaires[$commentaire[0]][] = $commentaire[1]; } ?> <?php foreach ($sortedCommentaires as $note => $liste) : ?> <?php if ($question->hasNote()) : ?> <th><?php echo $note; ?></th> <tr> <th rowspan="<?php echo count($liste)+1; ?>" class="toggler" id="<?php echo $note; ?>"> <?php echo $reponses[$note]??"Sans avis"; ?> </th> <td> <?php echo count($liste); ?> réponse·s</td> </tr> <?php endif; ?> <?php foreach ($liste as $commentaire) : ?> <tr class="comments_<?php echo $note; ?>"> <td><?php echo $commentaire; ?></td> </tr> <?php endforeach; ?> <?php endforeach; ?> <?php endif; ?> </tbody> </table> Loading Loading @@ -459,4 +477,10 @@ $nbElements = count($elements); let tableau = brut; downloadCSVFromJson('enquete_brut_' + $(this).attr('id') + '_' + Date.now().toString() + '.csv', header, tableau); }); $('th.toggler').on('click', function () { let id = $(this).attr("id"); console.log(id); $('tr.comments_' + id + ' td').toggle(); }); </script> No newline at end of file Loading
view/unicaen-enquete/resultat/resultats.phtml +29 −5 Original line number Diff line number Diff line Loading @@ -335,14 +335,32 @@ $nbElements = count($elements); </thead> <tbody> <?php if (isset($comments[$question->getId()])) : ?> <?php foreach ($comments[$question->getId()] as [$note, $commentaire]) : ?> <tr> <?php $commentaires = $comments[$question->getId()]; usort($commentaires, function ($a, $b) { return $a[0] <=> $b[0]; }); $sortedCommentaires = []; foreach ($commentaires as $commentaire) { $sortedCommentaires[$commentaire[0]][] = $commentaire[1]; } ?> <?php foreach ($sortedCommentaires as $note => $liste) : ?> <?php if ($question->hasNote()) : ?> <th><?php echo $note; ?></th> <tr> <th rowspan="<?php echo count($liste)+1; ?>" class="toggler" id="<?php echo $note; ?>"> <?php echo $reponses[$note]??"Sans avis"; ?> </th> <td> <?php echo count($liste); ?> réponse·s</td> </tr> <?php endif; ?> <?php foreach ($liste as $commentaire) : ?> <tr class="comments_<?php echo $note; ?>"> <td><?php echo $commentaire; ?></td> </tr> <?php endforeach; ?> <?php endforeach; ?> <?php endif; ?> </tbody> </table> Loading Loading @@ -459,4 +477,10 @@ $nbElements = count($elements); let tableau = brut; downloadCSVFromJson('enquete_brut_' + $(this).attr('id') + '_' + Date.now().toString() + '.csv', header, tableau); }); $('th.toggler').on('click', function () { let id = $(this).attr("id"); console.log(id); $('tr.comments_' + id + ' td').toggle(); }); </script> No newline at end of file