| @@ 255-270 (lines=16) @@ | ||
| 252 | ||
| 253 | $form->bind($occurrence); |
|
| 254 | ||
| 255 | if ($this->getRequest()->isPost()) { |
|
| 256 | $data = array_merge( |
|
| 257 | $this->getRequest()->getPost()->toArray(), |
|
| 258 | $this->getRequest()->getFiles()->toArray() |
|
| 259 | ); |
|
| 260 | $occurrence = $service->updateOccurrence($data, $occurrence->getId()); |
|
| 261 | ||
| 262 | if ($occurrence) { |
|
| 263 | // Redirect to list of games |
|
| 264 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The occurrence was edited'); |
|
| 265 | return $this->redirect()->toRoute( |
|
| 266 | 'admin/playgroundgame/instantwin-occurrence-list', |
|
| 267 | array('gameId'=>$this->game->getId()) |
|
| 268 | ); |
|
| 269 | } |
|
| 270 | } |
|
| 271 | return $viewModel->setVariables( |
|
| 272 | array( |
|
| 273 | '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()->toRoute('admin/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-134 (lines=18) @@ | ||
| 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()->toRoute('admin/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 | } |
|
| @@ 125-140 (lines=16) @@ | ||
| 122 | $model = new TradingCardModel(); |
|
| 123 | $form->bind($model); |
|
| 124 | ||
| 125 | if ($this->getRequest()->isPost()) { |
|
| 126 | $data = array_merge( |
|
| 127 | $this->getRequest()->getPost()->toArray(), |
|
| 128 | $this->getRequest()->getFiles()->toArray() |
|
| 129 | ); |
|
| 130 | ||
| 131 | $model = $this->getAdminGameService()->updateModel($data, $model); |
|
| 132 | if ($model) { |
|
| 133 | // Redirect to list of games |
|
| 134 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been created'); |
|
| 135 | return $this->redirect()->toRoute( |
|
| 136 | 'admin/playgroundgame/tradingcard-model-list', |
|
| 137 | array('gameId'=>$this->game->getId()) |
|
| 138 | ); |
|
| 139 | } |
|
| 140 | } |
|
| 141 | return $viewModel->setVariables( |
|
| 142 | array( |
|
| 143 | 'form' => $form, |
|
| @@ 172-187 (lines=16) @@ | ||
| 169 | ||
| 170 | $form->bind($model); |
|
| 171 | ||
| 172 | if ($this->getRequest()->isPost()) { |
|
| 173 | $data = array_merge( |
|
| 174 | $this->getRequest()->getPost()->toArray(), |
|
| 175 | $this->getRequest()->getFiles()->toArray() |
|
| 176 | ); |
|
| 177 | $model = $service->updateModel($data, $model); |
|
| 178 | ||
| 179 | if ($model) { |
|
| 180 | // Redirect to list of games |
|
| 181 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The model has been edited'); |
|
| 182 | return $this->redirect()->toRoute( |
|
| 183 | 'admin/playgroundgame/tradingcard-model-list', |
|
| 184 | array('gameId'=>$this->game->getId()) |
|
| 185 | ); |
|
| 186 | } |
|
| 187 | } |
|
| 188 | return $viewModel->setVariables( |
|
| 189 | array( |
|
| 190 | 'form' => $form, |
|