admin: Add availability to delete comments one by one.

This commit is contained in:
Olivier PEREZ 2014-12-19 00:13:21 +01:00
parent 178208380f
commit 1b01bcc6b6
4 changed files with 59 additions and 32 deletions

View file

@ -55,6 +55,7 @@ if (!$poll) {
// -------------------------------
// Update poll info
// -------------------------------
if (isset($_POST['update_poll_info'])) {
$updated = false;
$field = $inputService->filterAllowedValues($_POST['update_poll_info'], ['title', 'admin_mail', 'comment', 'rules']);
@ -107,6 +108,19 @@ if (isset($_POST['update_poll_info'])) {
}
}
// -------------------------------
// Delete a comment
// -------------------------------
if (!empty($_POST['delete_comment'])) {
$comment_id = filter_input(INPUT_POST, 'delete_comment', FILTER_VALIDATE_INT);
if ($pollService->deleteComment($poll_id, $comment_id)) {
$message = new Message('success', _('Comment deleted.'));
} else {
$message = new Message('danger', _('Failed to delete the comment.'));
}
}
// Retrieve data
$slots = $pollService->allSlotsByPollId($poll_id);
$votes = $pollService->allUserVotesByPollId($poll_id);