| @@ 40-50 (lines=11) @@ | ||
| 37 | ||
| 38 | if ($this->game->getOccurrenceType()=='datetime') { |
|
| 39 | $entry = $this->getGameService()->play($this->game, $user); |
|
| 40 | if (!$entry) { |
|
| 41 | // the user has already taken part of this game and the participation limit has been reached |
|
| 42 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 43 | ||
| 44 | return $this->redirect()->toUrl( |
|
| 45 | $this->frontendUrl()->fromRoute( |
|
| 46 | 'instantwin/result', |
|
| 47 | array('id' => $this->game->getIdentifier()) |
|
| 48 | ) |
|
| 49 | ); |
|
| 50 | } |
|
| 51 | ||
| 52 | // update the winner attribute in entry. |
|
| 53 | $occurrence = $this->getGameService()->IsInstantWinner($this->game, $user); |
|
| @@ 111-119 (lines=9) @@ | ||
| 108 | $user = $this->zfcUserAuthentication()->getIdentity(); |
|
| 109 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $user); |
|
| 110 | ||
| 111 | if (!$lastEntry) { |
|
| 112 | return $this->redirect()->toUrl( |
|
| 113 | $this->frontendUrl()->fromRoute( |
|
| 114 | 'instantwin', |
|
| 115 | array('id' => $this->game->getIdentifier(), ), |
|
| 116 | array('force_canonical' => true) |
|
| 117 | ) |
|
| 118 | ); |
|
| 119 | } |
|
| 120 | $winner = $lastEntry->getWinner(); |
|
| 121 | $occurrence = null; |
|
| 122 | ||
| @@ 38-48 (lines=11) @@ | ||
| 35 | } |
|
| 36 | ||
| 37 | $entry = $this->getGameService()->play($this->game, $user); |
|
| 38 | if (!$entry) { |
|
| 39 | // the user has already taken part of this game and the participation limit has been reached |
|
| 40 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 41 | ||
| 42 | return $this->redirect()->toUrl( |
|
| 43 | $this->frontendUrl()->fromRoute( |
|
| 44 | 'lottery/result', |
|
| 45 | array('id' => $this->game->getIdentifier()) |
|
| 46 | ) |
|
| 47 | ); |
|
| 48 | } |
|
| 49 | ||
| 50 | // Every entry is eligible to draw |
|
| 51 | $entry->setDrawable(true); |
|
| @@ 77-85 (lines=9) @@ | ||
| 74 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
| 75 | ||
| 76 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $user); |
|
| 77 | if (!$lastEntry) { |
|
| 78 | return $this->redirect()->toUrl( |
|
| 79 | $this->frontendUrl()->fromRoute( |
|
| 80 | 'lottery', |
|
| 81 | array('id' => $this->game->getIdentifier()), |
|
| 82 | array('force_canonical' => true) |
|
| 83 | ) |
|
| 84 | ); |
|
| 85 | } |
|
| 86 | ||
| 87 | if (!$user && !$this->game->getAnonymousAllowed()) { |
|
| 88 | $redirect = urlencode( |
|
| @@ 186-194 (lines=9) @@ | ||
| 183 | $user = $this->zfcUserAuthentication()->getIdentity(); |
|
| 184 | $entry = $this->getGameService()->findLastActiveEntry($this->game, $user); |
|
| 185 | ||
| 186 | if (!$entry) { |
|
| 187 | // the user has already taken part of this game and the participation limit has been reached |
|
| 188 | return $this->redirect()->toUrl( |
|
| 189 | $this->frontendUrl()->fromRoute( |
|
| 190 | 'postvote/'.$this->game->nextStep('preview'), |
|
| 191 | array('id' => $this->game->getIdentifier()) |
|
| 192 | ) |
|
| 193 | ); |
|
| 194 | } |
|
| 195 | ||
| 196 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
| 197 | $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $entry, 'status' => 0)); |
|
| @@ 259-266 (lines=8) @@ | ||
| 256 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
| 257 | $post = $this->getGameService()->getPostVotePostMapper()->findById($postId); |
|
| 258 | ||
| 259 | if (! $post || $post->getStatus() === 9) { |
|
| 260 | return $this->redirect()->toUrl( |
|
| 261 | $this->frontendUrl()->fromRoute( |
|
| 262 | 'postvote', |
|
| 263 | array('id' => $this->game->getIdentifier()) |
|
| 264 | ) |
|
| 265 | ); |
|
| 266 | } |
|
| 267 | ||
| 268 | $formModeration = new Form(); |
|
| 269 | $formModeration->setAttribute('method', 'post'); |
|
| @@ 202-210 (lines=9) @@ | ||
| 199 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
| 200 | ||
| 201 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $user); |
|
| 202 | if (!$lastEntry) { |
|
| 203 | return $this->redirect()->toUrl( |
|
| 204 | $this->frontendUrl()->fromRoute( |
|
| 205 | 'quiz', |
|
| 206 | array('id' => $this->game->getIdentifier()), |
|
| 207 | array('force_canonical' => true) |
|
| 208 | ) |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | ||
| 212 | // je compte les bonnes réponses et le ratio |
|
| 213 | $maxCorrectAnswers = $this->game->getMaxCorrectAnswers(); |
|