load->model('MessageModel', '', TRUE); } public function index() { $this->neededPermission('feedback.receive'); $feedback = $this->MessageModel->getFeedbackMessages(); $this->load->view('admin/sidebar', ['title' => 'Feedback-Nachrichten']); $this->load->view('admin/feedback', ['feedback' => $feedback]); $this->load->view('admin/footer', ['additionalScripts' => 'feedback.js']); } public function takeover($id = null, $state = 1) { $this->neededPermission('feedback.reply'); if($id != null) { $this->MessageModel->setFeedbackSupporter($id, $_SESSION['user']['ID'], $state); } redirect(base_url('admin/feedback')); } public function change($id) { $this->neededPermission('feedback.reply'); if($id != null) { $newStatus = $this->input->post('feedbackState'); $this->MessageModel->updateState($id, $_SESSION['user']['ID'], $newStatus); } redirect(base_url('admin/feedback')); } public function archive() { // header('Content-Type: application/json'); if (!$this->hasPermission('feedback.reply')) { echo json_encode(['type' => 'error', 'message' => 'Du musst eingeloggt sein, um Feedbacks zu beantworten.']); exit; } $feedbackID = intval($this->input->post('id')); if(!is_numeric($feedbackID)) { echo json_encode(['type' => 'error', 'message' => 'Die angegebene Feedback-ID ist ungültig.']); exit; } $successful = $this->MessageModel->archiveFeedback($feedbackID); if($successful) { echo json_encode(['type' => 'success', 'message' => 'Das Feedback wurde erfolgreich gelöscht.']); } else { echo json_encode(['type' => 'error', 'message' => 'Das Feedback muss vor dem Löschen zuerst bearbeitet und geschlossen werden.']); } } }