| @@ 28-38 (lines=11) @@ | ||
| 25 | ||
| 26 | if ($this->game->getOccurrenceType()=='datetime') { |
|
| 27 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
| 28 | if (!$entry) { |
|
| 29 | // the user has already taken part of this game and the participation limit has been reached |
|
| 30 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 31 | ||
| 32 | return $this->redirect()->toUrl( |
|
| 33 | $this->frontendUrl()->fromRoute( |
|
| 34 | 'instantwin/result', |
|
| 35 | array('id' => $this->game->getIdentifier()) |
|
| 36 | ) |
|
| 37 | ); |
|
| 38 | } |
|
| 39 | ||
| 40 | // update the winner attribute in entry. |
|
| 41 | $occurrence = $this->getGameService()->IsInstantWinner($this->game, $this->user); |
|
| @@ 98-106 (lines=9) @@ | ||
| 95 | { |
|
| 96 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 97 | ||
| 98 | if (!$lastEntry) { |
|
| 99 | return $this->redirect()->toUrl( |
|
| 100 | $this->frontendUrl()->fromRoute( |
|
| 101 | 'instantwin', |
|
| 102 | array('id' => $this->game->getIdentifier(), ), |
|
| 103 | array('force_canonical' => true) |
|
| 104 | ) |
|
| 105 | ); |
|
| 106 | } |
|
| 107 | $winner = $lastEntry->getWinner(); |
|
| 108 | $occurrence = null; |
|
| 109 | ||
| @@ 26-36 (lines=11) @@ | ||
| 23 | } |
|
| 24 | ||
| 25 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
| 26 | if (!$entry) { |
|
| 27 | // the user has already taken part of this game and the participation limit has been reached |
|
| 28 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 29 | ||
| 30 | return $this->redirect()->toUrl( |
|
| 31 | $this->frontendUrl()->fromRoute( |
|
| 32 | 'lottery/result', |
|
| 33 | array('id' => $this->game->getIdentifier()) |
|
| 34 | ) |
|
| 35 | ); |
|
| 36 | } |
|
| 37 | ||
| 38 | // Every entry is eligible to draw |
|
| 39 | $entry->setDrawable(true); |
|
| @@ 64-72 (lines=9) @@ | ||
| 61 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
| 62 | ||
| 63 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 64 | if (!$lastEntry) { |
|
| 65 | return $this->redirect()->toUrl( |
|
| 66 | $this->frontendUrl()->fromRoute( |
|
| 67 | 'lottery', |
|
| 68 | array('id' => $this->game->getIdentifier()), |
|
| 69 | array('force_canonical' => true) |
|
| 70 | ) |
|
| 71 | ); |
|
| 72 | } |
|
| 73 | ||
| 74 | $form = $this->getServiceLocator()->get('playgroundgame_sharemail_form'); |
|
| 75 | $form->setAttribute('method', 'post'); |
|
| @@ 49-59 (lines=11) @@ | ||
| 46 | { |
|
| 47 | $subGameIdentifier = $this->getEvent()->getRouteMatch()->getParam('gameId'); |
|
| 48 | $entry = $this->getGameService()->play($this->game, $this->user); |
|
| 49 | if (!$entry) { |
|
| 50 | // the user has already taken part of this game and the participation limit has been reached |
|
| 51 | $this->flashMessenger()->addMessage('You have already played'); |
|
| 52 | ||
| 53 | return $this->redirect()->toUrl( |
|
| 54 | $this->frontendUrl()->fromRoute( |
|
| 55 | 'mission/result', |
|
| 56 | array('id' => $this->game->getIdentifier()) |
|
| 57 | ) |
|
| 58 | ); |
|
| 59 | } |
|
| 60 | ||
| 61 | if (!$subGameIdentifier) { |
|
| 62 | $subGame = $this->game->getNextPlayableGame($entry); |
|
| @@ 162-170 (lines=9) @@ | ||
| 159 | { |
|
| 160 | $entry = $this->getGameService()->findLastActiveEntry($this->game, $this->user); |
|
| 161 | ||
| 162 | if (!$entry) { |
|
| 163 | // the user has already taken part of this game and the participation limit has been reached |
|
| 164 | return $this->redirect()->toUrl( |
|
| 165 | $this->frontendUrl()->fromRoute( |
|
| 166 | 'postvote/'.$this->game->nextStep('preview'), |
|
| 167 | array('id' => $this->game->getIdentifier()) |
|
| 168 | ) |
|
| 169 | ); |
|
| 170 | } |
|
| 171 | ||
| 172 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
| 173 | $post = $this->getGameService()->getPostVotePostMapper()->findOneBy(array('entry' => $entry, 'status' => 0)); |
|
| @@ 234-241 (lines=8) @@ | ||
| 231 | // Je recherche le post associé à entry + status == 0. Si non trouvé, je redirige vers home du jeu. |
|
| 232 | $post = $this->getGameService()->getPostVotePostMapper()->findById($postId); |
|
| 233 | ||
| 234 | if (! $post || $post->getStatus() === 9) { |
|
| 235 | return $this->redirect()->toUrl( |
|
| 236 | $this->frontendUrl()->fromRoute( |
|
| 237 | 'postvote', |
|
| 238 | array('id' => $this->game->getIdentifier()) |
|
| 239 | ) |
|
| 240 | ); |
|
| 241 | } |
|
| 242 | ||
| 243 | $formModeration = new Form(); |
|
| 244 | $formModeration->setAttribute('method', 'post'); |
|
| @@ 214-222 (lines=9) @@ | ||
| 211 | $socialLinkUrl = $this->shortenUrl()->shortenUrl($socialLinkUrl); |
|
| 212 | ||
| 213 | $lastEntry = $this->getGameService()->findLastEntry($this->game, $this->user); |
|
| 214 | if (!$lastEntry) { |
|
| 215 | return $this->redirect()->toUrl( |
|
| 216 | $this->frontendUrl()->fromRoute( |
|
| 217 | 'quiz', |
|
| 218 | array('id' => $this->game->getIdentifier()), |
|
| 219 | array('force_canonical' => true) |
|
| 220 | ) |
|
| 221 | ); |
|
| 222 | } |
|
| 223 | ||
| 224 | // je compte les bonnes réponses et le ratio |
|
| 225 | $maxCorrectAnswers = $this->game->getMaxCorrectAnswers(); |
|