| @@ 49-62 (lines=14) @@ | ||
| 46 | * |
|
| 47 | * @return void |
|
| 48 | */ |
|
| 49 | public function postAddAction(int $examID) |
|
| 50 | { |
|
| 51 | $model = new QuestionAddModel($this->get('dbh')); |
|
| 52 | ||
| 53 | if ($id = $model->add($examID, $this->getFromRequest('post'))) { |
|
| 54 | $this->setMessage('success', 'Dodano pomyślnie!'); |
|
| 55 | $this->redirect('/admin/exam/edit/'.$examID.'/question/edit/'.$id); |
|
| 56 | ||
| 57 | return; |
|
| 58 | } |
|
| 59 | ||
| 60 | $this->setMessage('warning', 'Coś się zepsuło!'); |
|
| 61 | $this->redirect('/admin/exam/edit/'.$examID.'/question/add'); |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 40-53 (lines=14) @@ | ||
| 37 | * |
|
| 38 | * @return void |
|
| 39 | */ |
|
| 40 | public function postDeleteAction(int $examID, int $questionID) |
|
| 41 | { |
|
| 42 | $delModel = new QuestionDeleteModel($this->get('dbh')); |
|
| 43 | ||
| 44 | if ($delModel->delete($questionID)) { |
|
| 45 | $this->setMessage('success', 'Usunięto pomyślnie!'); |
|
| 46 | $this->redirect('/admin/exam/edit/'.$examID); |
|
| 47 | ||
| 48 | return; |
|
| 49 | } |
|
| 50 | ||
| 51 | $this->setMessage('warning', 'Coś się zepsuło!'); |
|
| 52 | $this->redirect('/admin/exam/edit/'.$examID.'/question/del/'.$questionID); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||