public function deleteLesson() { if (isset($_POST['confirmed']) && $_POST['confirmed'] === 'true') { $id = $this->secureString($_POST['lessonId']); if (Lesson::deleteLesson($id)) { $this->getView()->addSuccessMessage('Lesson was successfully deleted.'); } else { $this->getView()->addErrorMessage('Lesson could not be deleted!'); } } else { $this->getView()->addWarnMessage('Are you sure you want to delete this lesson?'); $this->getView()->addDeleteConfirmation(); } $this->defaultAction(); }