| @@ 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'); |
|
| @@ 167-175 (lines=9) @@ | ||
| 164 | $user = $this->zfcUserAuthentication()->getIdentity(); |
|
| 165 | $entry = $this->getGameService()->findLastActiveEntry($this->game, $user); |
|
| 166 | ||
| 167 | if (!$entry) { |
|
| 168 | // the user has already taken part of this game and the participation limit has been reached |
|
| 169 | return $this->redirect()->toUrl( |
|
| 170 | $this->frontendUrl()->fromRoute( |
|
| 171 | 'postvote/'.$this->game->nextStep('preview'), |
|
| 172 | array('id' => $this->game->getIdentifier()) |
|
| 173 | ) |
|
| 174 | ); |
|
| 175 | } |
|
| 176 | ||
| 177 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
| 178 | $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $entry, 'status' => 0)); |
|
| @@ 240-247 (lines=8) @@ | ||
| 237 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
| 238 | $post = $this->getGameService()->getPostVotePostMapper()->findById($postId); |
|
| 239 | ||
| 240 | if (! $post || $post->getStatus() === 9) { |
|
| 241 | return $this->redirect()->toUrl( |
|
| 242 | $this->frontendUrl()->fromRoute( |
|
| 243 | 'postvote', |
|
| 244 | array('id' => $this->game->getIdentifier()) |
|
| 245 | ) |
|
| 246 | ); |
|
| 247 | } |
|
| 248 | ||
| 249 | $formModeration = new Form(); |
|
| 250 | $formModeration->setAttribute('method', 'post'); |
|
| @@ 182-190 (lines=9) @@ | ||
| 179 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
| 180 | ||
| 181 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 182 | if (!$lastEntry) { |
|
| 183 | return $this->redirect()->toUrl( |
|
| 184 | $this->frontendUrl()->fromRoute( |
|
| 185 | 'quiz', |
|
| 186 | array('id' => $this->game->getIdentifier()), |
|
| 187 | array('force_canonical' => true) |
|
| 188 | ) |
|
| 189 | ); |
|
| 190 | } |
|
| 191 | ||
| 192 | // je compte les bonnes réponses et le ratio |
|
| 193 | $maxCorrectAnswers = $this->game->getMaxCorrectAnswers(); |
|