| @@ 246-258 (lines=13) @@ | ||
| 243 | ||
| 244 | $form->bind($occurrence); |
|
| 245 | ||
| 246 | if ($this->getRequest()->isPost()) { |
|
| 247 | $data = array_merge( |
|
| 248 | $this->getRequest()->getPost()->toArray(), |
|
| 249 | $this->getRequest()->getFiles()->toArray() |
|
| 250 | ); |
|
| 251 | $occurrence = $service->updateOccurrence($data, $occurrence->getId()); |
|
| 252 | ||
| 253 | if ($occurrence) { |
|
| 254 | // Redirect to list of games |
|
| 255 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence was edited'); |
|
| 256 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/instantwin-occurrence-list', array('gameId' => $this->game->getId()))); |
|
| 257 | } |
|
| 258 | } |
|
| 259 | return $viewModel->setVariables( |
|
| 260 | array( |
|
| 261 | 'form' => $form, |
|
| @@ 71-88 (lines=18) @@ | ||
| 68 | $question = new QuizQuestion(); |
|
| 69 | $form->bind($question); |
|
| 70 | ||
| 71 | if ($this->getRequest()->isPost()) { |
|
| 72 | $data = array_replace_recursive( |
|
| 73 | $this->getRequest()->getPost()->toArray(), |
|
| 74 | $this->getRequest()->getFiles()->toArray() |
|
| 75 | ); |
|
| 76 | ||
| 77 | $question = $service->createQuestion($data); |
|
| 78 | if ($question) { |
|
| 79 | // Redirect to list of games |
|
| 80 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The question was created'); |
|
| 81 | ||
| 82 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/quiz-question-list', array('quizId'=>$quizId))); |
|
| 83 | } else { // Creation failed |
|
| 84 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage( |
|
| 85 | 'The question was not updated - create at least one good answer' |
|
| 86 | ); |
|
| 87 | } |
|
| 88 | } |
|
| 89 | ||
| 90 | return $viewModel->setVariables(array('form' => $form, 'quiz_id' => $quizId, 'question_id' => 0)); |
|
| 91 | } |
|
| @@ 117-135 (lines=19) @@ | ||
| 114 | ||
| 115 | $form->bind($question); |
|
| 116 | ||
| 117 | if ($this->getRequest()->isPost()) { |
|
| 118 | $data = array_replace_recursive( |
|
| 119 | $this->getRequest()->getPost()->toArray(), |
|
| 120 | $this->getRequest()->getFiles()->toArray() |
|
| 121 | ); |
|
| 122 | ||
| 123 | $question = $service->updateQuestion($data, $question); |
|
| 124 | if ($question) { |
|
| 125 | // Redirect to list of games |
|
| 126 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The question was updated'); |
|
| 127 | ||
| 128 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/quiz-question-list', array('quizId'=>$quizId))); |
|
| 129 | } else { |
|
| 130 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage( |
|
| 131 | 'The question was not updated - create at least one good answer' |
|
| 132 | ); |
|
| 133 | } |
|
| 134 | } |
|
| 135 | ||
| 136 | return $viewModel->setVariables(array('form' => $form, 'quiz_id' => $quizId, 'question_id' => $questionId)); |
|
| 137 | } |
|
| 138 | ||
| @@ 124-138 (lines=15) @@ | ||
| 121 | $model = new TradingCardModel(); |
|
| 122 | $form->bind($model); |
|
| 123 | ||
| 124 | if ($this->getRequest()->isPost()) { |
|
| 125 | $data = array_merge( |
|
| 126 | $this->getRequest()->getPost()->toArray(), |
|
| 127 | $this->getRequest()->getFiles()->toArray() |
|
| 128 | ); |
|
| 129 | ||
| 130 | $model = $this->getAdminGameService()->updateModel($data, $model); |
|
| 131 | if ($model) { |
|
| 132 | // Redirect to list of games |
|
| 133 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been created'); |
|
| 134 | return $this->redirect()->toUrl( |
|
| 135 | $this->adminUrl()->fromRoute('playgroundgame/tradingcard-model-list', array('gameId' => $this->game->getId())) |
|
| 136 | ); |
|
| 137 | } |
|
| 138 | } |
|
| 139 | return $viewModel->setVariables( |
|
| 140 | array( |
|
| 141 | 'form' => $form, |
|
| @@ 170-184 (lines=15) @@ | ||
| 167 | ||
| 168 | $form->bind($model); |
|
| 169 | ||
| 170 | if ($this->getRequest()->isPost()) { |
|
| 171 | $data = array_merge( |
|
| 172 | $this->getRequest()->getPost()->toArray(), |
|
| 173 | $this->getRequest()->getFiles()->toArray() |
|
| 174 | ); |
|
| 175 | $model = $service->updateModel($data, $model); |
|
| 176 | ||
| 177 | if ($model) { |
|
| 178 | // Redirect to list of games |
|
| 179 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been edited'); |
|
| 180 | return $this->redirect()->toUrl( |
|
| 181 | $this->adminUrl()->fromRoute('playgroundgame/tradingcard-model-list', array('gameId' => $this->game->getId())) |
|
| 182 | ); |
|
| 183 | } |
|
| 184 | } |
|
| 185 | return $viewModel->setVariables( |
|
| 186 | array( |
|
| 187 | 'form' => $form, |
|