@@ 19-63 (lines=45) @@ | ||
16 | ||
17 | protected $mission; |
|
18 | ||
19 | public function createMissionAction() |
|
20 | { |
|
21 | $service = $this->getAdminGameService(); |
|
22 | $viewModel = new ViewModel(); |
|
23 | $viewModel->setTemplate('playground-game/mission/mission'); |
|
24 | ||
25 | $gameForm = new ViewModel(); |
|
26 | $gameForm->setTemplate('playground-game/game/game-form'); |
|
27 | ||
28 | $mission = new Mission(); |
|
29 | ||
30 | $form = $this->getServiceLocator()->get('playgroundgame_mission_form'); |
|
31 | $form->bind($mission); |
|
32 | $form->get('submit')->setAttribute('label', 'Add'); |
|
33 | $form->setAttribute( |
|
34 | 'action', |
|
35 | $this->adminUrl()->fromRoute( |
|
36 | 'playgroundgame/create-mission', |
|
37 | array('gameId' => 0) |
|
38 | ) |
|
39 | ); |
|
40 | $form->setAttribute('method', 'post'); |
|
41 | ||
42 | $request = $this->getRequest(); |
|
43 | if ($request->isPost()) { |
|
44 | $data = array_replace_recursive( |
|
45 | $this->getRequest()->getPost()->toArray(), |
|
46 | $this->getRequest()->getFiles()->toArray() |
|
47 | ); |
|
48 | if (empty($data['prizes'])) { |
|
49 | $data['prizes'] = array(); |
|
50 | } |
|
51 | ||
52 | $game = $service->createOrUpdate($data, $mission, 'playgroundgame_mission_form'); |
|
53 | if ($game) { |
|
54 | $this->flashMessenger()->setNamespace('mission')->addMessage('The game was created'); |
|
55 | ||
56 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
57 | } |
|
58 | } |
|
59 | $gameForm->setVariables(array('form' => $form, 'game' => $mission)); |
|
60 | $viewModel->addChild($gameForm, 'game_form'); |
|
61 | ||
62 | return $viewModel->setVariables(array('form' => $form, 'title' => 'Create mission', 'mission' => $mission)); |
|
63 | } |
|
64 | ||
65 | public function editMissionAction() |
|
66 | { |
@@ 26-69 (lines=44) @@ | ||
23 | return $this->createForm($form); |
|
24 | } |
|
25 | ||
26 | public function createPostVoteAction() |
|
27 | { |
|
28 | $service = $this->getAdminGameService(); |
|
29 | $viewModel = new ViewModel(); |
|
30 | $viewModel->setTemplate('playground-game/post-vote/postvote'); |
|
31 | ||
32 | $gameForm = new ViewModel(); |
|
33 | $gameForm->setTemplate('playground-game/game/game-form'); |
|
34 | ||
35 | $postVote = new PostVote(); |
|
36 | ||
37 | $form = $this->getServiceLocator()->get('playgroundgame_postvote_form'); |
|
38 | $form->bind($postVote); |
|
39 | $form->get('submit')->setAttribute('label', 'Add'); |
|
40 | $form->setAttribute( |
|
41 | 'action', |
|
42 | $this->adminUrl()->fromRoute( |
|
43 | 'playgroundgame/create-postvote', |
|
44 | array('gameId' => 0) |
|
45 | ) |
|
46 | ); |
|
47 | $form->setAttribute('method', 'post'); |
|
48 | ||
49 | $request = $this->getRequest(); |
|
50 | if ($request->isPost()) { |
|
51 | $data = array_replace_recursive( |
|
52 | $this->getRequest()->getPost()->toArray(), |
|
53 | $this->getRequest()->getFiles()->toArray() |
|
54 | ); |
|
55 | if (empty($data['prizes'])) { |
|
56 | $data['prizes'] = array(); |
|
57 | } |
|
58 | $game = $service->createOrUpdate($data, $postVote, 'playgroundgame_postvote_form'); |
|
59 | if ($game) { |
|
60 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The game was created'); |
|
61 | ||
62 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
63 | } |
|
64 | } |
|
65 | $gameForm->setVariables(array('form' => $form, 'game' => $postVote)); |
|
66 | $viewModel->addChild($gameForm, 'game_form'); |
|
67 | ||
68 | return $viewModel->setVariables(array('form' => $form, 'title' => 'Create Post & Vote')); |
|
69 | } |
|
70 | ||
71 | public function editPostVoteAction() |
|
72 | { |
@@ 164-207 (lines=44) @@ | ||
161 | return $model->setTerminal(true); |
|
162 | } |
|
163 | ||
164 | public function createQuizAction() |
|
165 | { |
|
166 | $service = $this->getAdminGameService(); |
|
167 | $viewModel = new ViewModel(); |
|
168 | $viewModel->setTemplate('playground-game/quiz/quiz'); |
|
169 | ||
170 | $gameForm = new ViewModel(); |
|
171 | $gameForm->setTemplate('playground-game/game/game-form'); |
|
172 | ||
173 | $quiz = new Quiz(); |
|
174 | ||
175 | $form = $this->getServiceLocator()->get('playgroundgame_quiz_form'); |
|
176 | $form->bind($quiz); |
|
177 | $form->get('submit')->setAttribute('label', 'Add'); |
|
178 | $form->setAttribute( |
|
179 | 'action', |
|
180 | $this->adminUrl()->fromRoute( |
|
181 | 'playgroundgame/create-quiz', |
|
182 | array('gameId' => 0) |
|
183 | ) |
|
184 | ); |
|
185 | $form->setAttribute('method', 'post'); |
|
186 | ||
187 | $request = $this->getRequest(); |
|
188 | if ($request->isPost()) { |
|
189 | $data = array_replace_recursive( |
|
190 | $this->getRequest()->getPost()->toArray(), |
|
191 | $this->getRequest()->getFiles()->toArray() |
|
192 | ); |
|
193 | if (empty($data['prizes'])) { |
|
194 | $data['prizes'] = array(); |
|
195 | } |
|
196 | $game = $service->createOrUpdate($data, $quiz, 'playgroundgame_quiz_form'); |
|
197 | if ($game) { |
|
198 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The game was created'); |
|
199 | ||
200 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
201 | } |
|
202 | } |
|
203 | $gameForm->setVariables(array('form' => $form, 'game' => $quiz)); |
|
204 | $viewModel->addChild($gameForm, 'game_form'); |
|
205 | ||
206 | return $viewModel->setVariables(array('form' => $form, 'title' => 'Create quiz')); |
|
207 | } |
|
208 | ||
209 | public function editQuizAction() |
|
210 | { |
@@ 21-64 (lines=44) @@ | ||
18 | */ |
|
19 | protected $adminGameService; |
|
20 | ||
21 | public function createTradingcardAction() |
|
22 | { |
|
23 | $service = $this->getAdminGameService(); |
|
24 | $viewModel = new ViewModel(); |
|
25 | $viewModel->setTemplate('playground-game/trading-card/tradingcard'); |
|
26 | ||
27 | $gameForm = new ViewModel(); |
|
28 | $gameForm->setTemplate('playground-game/game/game-form'); |
|
29 | ||
30 | $tradingcard = new TradingCard(); |
|
31 | ||
32 | $form = $this->getServiceLocator()->get('playgroundgame_tradingcard_form'); |
|
33 | $form->bind($tradingcard); |
|
34 | $form->get('submit')->setAttribute('label', 'Add'); |
|
35 | $form->setAttribute( |
|
36 | 'action', |
|
37 | $this->adminUrl()->fromRoute( |
|
38 | 'playgroundgame/create-tradingcard', |
|
39 | array('gameId' => 0) |
|
40 | ) |
|
41 | ); |
|
42 | $form->setAttribute('method', 'post'); |
|
43 | ||
44 | $request = $this->getRequest(); |
|
45 | if ($request->isPost()) { |
|
46 | $data = array_replace_recursive( |
|
47 | $this->getRequest()->getPost()->toArray(), |
|
48 | $this->getRequest()->getFiles()->toArray() |
|
49 | ); |
|
50 | if (empty($data['prizes'])) { |
|
51 | $data['prizes'] = array(); |
|
52 | } |
|
53 | $game = $service->createOrUpdate($data, $tradingcard, 'playgroundgame_tradingcard_form'); |
|
54 | if ($game) { |
|
55 | $this->flashMessenger()->setNamespace('playgroundgame')->addMessage('The game has been created'); |
|
56 | ||
57 | return $this->redirect()->toUrl($this->adminUrl()->fromRoute('playgroundgame/list')); |
|
58 | } |
|
59 | } |
|
60 | $gameForm->setVariables(array('form' => $form, 'game' => $tradingcard)); |
|
61 | $viewModel->addChild($gameForm, 'game_form'); |
|
62 | ||
63 | return $viewModel->setVariables(array('form' => $form, 'title' => 'Create trading card')); |
|
64 | } |
|
65 | ||
66 | public function editTradingcardAction() |
|
67 | { |