| @@ 30-43 (lines=14) @@ | ||
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function postAddAction() |
|
| 31 | { |
|
| 32 | $model = new ExamAddModel($this->get('dbh')); |
|
| 33 | ||
| 34 | if ($examID = $model->add($this->getFromRequest('post'))) { |
|
| 35 | $this->setMessage('success', 'Dodano pomyślnie'); |
|
| 36 | $this->redirect('/admin/exam/edit/'.$examID); |
|
| 37 | ||
| 38 | return; |
|
| 39 | } |
|
| 40 | ||
| 41 | $this->setMessage('warning', 'Coś się zepsuło'); |
|
| 42 | $this->redirect('/admin/exam/add'); |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| @@ 37-48 (lines=12) @@ | ||
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function postEditAction(int $examID) |
|
| 38 | { |
|
| 39 | $editModel = new ExamEditModel($this->get('dbh')); |
|
| 40 | ||
| 41 | if ($editModel->edit($examID, $this->getFromRequest('post'))) { |
|
| 42 | $this->setMessage('success', 'Uaktualniono pomyślnie!'); |
|
| 43 | } else { |
|
| 44 | $this->setMessage('warning', 'Coś się zepsuło!'); |
|
| 45 | } |
|
| 46 | ||
| 47 | $this->redirect('/admin/exam/edit/'.$examID); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||