@@ 21-31 (lines=11) @@ | ||
18 | ||
19 | if ($this->game->getOccurrenceType()=='datetime') { |
|
20 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
21 | if (!$entry) { |
|
22 | // the user has already taken part of this game and the participation limit has been reached |
|
23 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
24 | ||
25 | return $this->redirect()->toUrl( |
|
26 | $this->frontendUrl()->fromRoute( |
|
27 | 'instantwin/result', |
|
28 | array('id' => $this->game->getIdentifier()) |
|
29 | ) |
|
30 | ); |
|
31 | } |
|
32 | ||
33 | // update the winner attribute in entry. |
|
34 | $occurrence = $this->getGameService()->IsInstantWinner($this->game, $this->user); |
|
@@ 91-99 (lines=9) @@ | ||
88 | { |
|
89 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
90 | ||
91 | if (!$lastEntry) { |
|
92 | return $this->redirect()->toUrl( |
|
93 | $this->frontendUrl()->fromRoute( |
|
94 | 'instantwin', |
|
95 | array('id' => $this->game->getIdentifier(), ), |
|
96 | array('force_canonical' => true) |
|
97 | ) |
|
98 | ); |
|
99 | } |
|
100 | $winner = $lastEntry->getWinner(); |
|
101 | $occurrence = null; |
|
102 |
@@ 20-30 (lines=11) @@ | ||
17 | } |
|
18 | ||
19 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
20 | if (!$entry) { |
|
21 | // the user has already taken part of this game and the participation limit has been reached |
|
22 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
23 | ||
24 | return $this->redirect()->toUrl( |
|
25 | $this->frontendUrl()->fromRoute( |
|
26 | 'lottery/result', |
|
27 | array('id' => $this->game->getIdentifier()) |
|
28 | ) |
|
29 | ); |
|
30 | } |
|
31 | ||
32 | // Every entry is eligible to draw |
|
33 | $entry->setDrawable(true); |
|
@@ 58-66 (lines=9) @@ | ||
55 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
56 | ||
57 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
58 | if (!$lastEntry) { |
|
59 | return $this->redirect()->toUrl( |
|
60 | $this->frontendUrl()->fromRoute( |
|
61 | 'lottery', |
|
62 | array('id' => $this->game->getIdentifier()), |
|
63 | array('force_canonical' => true) |
|
64 | ) |
|
65 | ); |
|
66 | } |
|
67 | ||
68 | $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form'); |
|
69 | $form->setAttribute('method', 'post'); |
@@ 47-57 (lines=11) @@ | ||
44 | { |
|
45 | $subGameIdentifier = $this->getEvent()->getRouteMatch()->getParam('gameId'); |
|
46 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
47 | if (!$entry) { |
|
48 | // the user has already taken part of this game and the participation limit has been reached |
|
49 | $this->flashMessenger()->addMessage('You have already played'); |
|
50 | ||
51 | return $this->redirect()->toUrl( |
|
52 | $this->frontendUrl()->fromRoute( |
|
53 | 'mission/result', |
|
54 | array('id' => $this->game->getIdentifier()) |
|
55 | ) |
|
56 | ); |
|
57 | } |
|
58 | ||
59 | if (!$subGameIdentifier) { |
|
60 | $subGame = $this->game->getNextPlayableGame($entry); |
|
@@ 65-75 (lines=11) @@ | ||
62 | $subGame = $this->getGameService()->checkGame($subGameIdentifier); |
|
63 | } |
|
64 | ||
65 | if (!$this->game->isPlayable($subGame, $entry)) { |
|
66 | // this subgame is not playable |
|
67 | $this->flashMessenger()->addMessage('No game found'); |
|
68 | ||
69 | return $this->redirect()->toUrl( |
|
70 | $this->frontendUrl()->fromRoute( |
|
71 | 'mission', |
|
72 | array('id' => $this->game->getIdentifier()) |
|
73 | ) |
|
74 | ); |
|
75 | } |
|
76 | ||
77 | $socialLinkUrl = $this->frontendUrl()->fromRoute( |
|
78 | 'mission', |
@@ 25-35 (lines=11) @@ | ||
22 | } |
|
23 | ||
24 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
25 | if (!$entry) { |
|
26 | // the user has already taken part of this game and the participation limit has been reached |
|
27 | $this->flashMessenger()->addMessage('Vous avez déjà participé!'); |
|
28 | ||
29 | return $this->redirect()->toUrl( |
|
30 | $this->frontendUrl()->fromRoute( |
|
31 | $this->game->getClassType() . '/result', |
|
32 | array('id' => $this->game->getIdentifier()) |
|
33 | ) |
|
34 | ); |
|
35 | } |
|
36 | ||
37 | $reply = $this->getGameService()->getQuizReplyMapper()->getLastGameReply($entry); |
|
38 | $userAnswers = array(); |
|
@@ 196-204 (lines=9) @@ | ||
193 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
194 | ||
195 | $lastEntry = $this->getGameService()->findLastEntry($this->game, $this->user); |
|
196 | if (!$lastEntry) { |
|
197 | return $this->redirect()->toUrl( |
|
198 | $this->frontendUrl()->fromRoute( |
|
199 | 'quiz', |
|
200 | array('id' => $this->game->getIdentifier()), |
|
201 | array('force_canonical' => true) |
|
202 | ) |
|
203 | ); |
|
204 | } |
|
205 | ||
206 | // je compte les bonnes réponses et le ratio |
|
207 | $maxCorrectAnswers = $this->game->getMaxCorrectAnswers(); |
@@ 156-164 (lines=9) @@ | ||
153 | { |
|
154 | $entry = $this->getGameService()->findLastActiveEntry($this->game, $this->user); |
|
155 | ||
156 | if (!$entry) { |
|
157 | // the user has already taken part of this game and the participation limit has been reached |
|
158 | return $this->redirect()->toUrl( |
|
159 | $this->frontendUrl()->fromRoute( |
|
160 | 'postvote/'.$this->game->nextStep('preview'), |
|
161 | array('id' => $this->game->getIdentifier()) |
|
162 | ) |
|
163 | ); |
|
164 | } |
|
165 | ||
166 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
167 | $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $entry, 'status' => 0)); |
|
@@ 228-235 (lines=8) @@ | ||
225 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
226 | $post = $this->getGameService()->getPostVotePostMapper()->findById($postId); |
|
227 | ||
228 | if (! $post || $post->getStatus() === 9) { |
|
229 | return $this->redirect()->toUrl( |
|
230 | $this->frontendUrl()->fromRoute( |
|
231 | 'postvote', |
|
232 | array('id' => $this->game->getIdentifier()) |
|
233 | ) |
|
234 | ); |
|
235 | } |
|
236 | ||
237 | $formModeration = new Form(); |
|
238 | $formModeration->setAttribute('method', 'post'); |
|
@@ 169-176 (lines=8) @@ | ||
166 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
167 | $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $entry, 'status' => 0)); |
|
168 | ||
169 | if (! $post) { |
|
170 | return $this->redirect()->toUrl( |
|
171 | $this->frontendUrl()->fromRoute( |
|
172 | 'postvote', |
|
173 | array('id' => $this->game->getIdentifier()) |
|
174 | ) |
|
175 | ); |
|
176 | } |
|
177 | ||
178 | if ($this->getRequest()->isPost()) { |
|
179 | $post = $this->getGameService()->confirmPost($this->game, $this->user); |
@@ 543-550 (lines=8) @@ | ||
540 | // Has the user finished the game ? |
|
541 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
542 | ||
543 | if ($lastEntry === null) { |
|
544 | return $this->redirect()->toUrl( |
|
545 | $this->frontendUrl()->fromRoute( |
|
546 | $this->game->getClassType(), |
|
547 | array('id' => $this->game->getIdentifier()) |
|
548 | ) |
|
549 | ); |
|
550 | } |
|
551 | } |
|
552 | ||
553 | $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form'); |