| @@ 448-483 (lines=36) @@ | ||
| 445 | } |
|
| 446 | $playError = null; |
|
| 447 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 448 | if (!$entry) { |
|
| 449 | $reason = ""; |
|
| 450 | if ($playError === -1) { |
|
| 451 | // the user has already taken part to this game and the participation limit has been reached |
|
| 452 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 453 | $reason = '?playLimitReached=1'; |
|
| 454 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 455 | $this->game->getClassType().'/result', |
|
| 456 | array( |
|
| 457 | 'id' => $this->game->getIdentifier(), |
|
| 458 | ) |
|
| 459 | ) .$reason; |
|
| 460 | } elseif ($playError === -2) { |
|
| 461 | // the user has not accepted the mandatory rules of the game |
|
| 462 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 463 | $reason = '?NoOptin=1'; |
|
| 464 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 465 | $this->game->getClassType(), |
|
| 466 | array( |
|
| 467 | 'id' => $this->game->getIdentifier(), |
|
| 468 | ) |
|
| 469 | ) .$reason; |
|
| 470 | } elseif ($playError === -3) { |
|
| 471 | // the user has enough points to buy an entry to this game |
|
| 472 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 473 | $reason = '?NotPaid=1'; |
|
| 474 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 475 | $this->game->getClassType(), |
|
| 476 | array( |
|
| 477 | 'id' => $this->game->getIdentifier(), |
|
| 478 | ) |
|
| 479 | ) .$reason; |
|
| 480 | } |
|
| 481 | ||
| 482 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 483 | } |
|
| 484 | } else { |
|
| 485 | // I'm looking for an entry without anonymousIdentifier (the active entry in fact). |
|
| 486 | $entry = $this->getGameService()->findLastEntry($this->game, $this->user); |
|
| @@ 23-58 (lines=36) @@ | ||
| 20 | if ($this->game->getOccurrenceType()=='datetime') { |
|
| 21 | $playError = null; |
|
| 22 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 23 | if (!$entry) { |
|
| 24 | $reason = ""; |
|
| 25 | if ($playError === -1) { |
|
| 26 | // the user has already taken part to this game and the participation limit has been reached |
|
| 27 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 28 | $reason = '?playLimitReached=1'; |
|
| 29 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 30 | $this->game->getClassType().'/result', |
|
| 31 | array( |
|
| 32 | 'id' => $this->game->getIdentifier(), |
|
| 33 | ) |
|
| 34 | ) .$reason; |
|
| 35 | } elseif ($playError === -2) { |
|
| 36 | // the user has not accepted the mandatory rules of the game |
|
| 37 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 38 | $reason = '?NoOptin=1'; |
|
| 39 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 40 | $this->game->getClassType(), |
|
| 41 | array( |
|
| 42 | 'id' => $this->game->getIdentifier(), |
|
| 43 | ) |
|
| 44 | ) .$reason; |
|
| 45 | } elseif ($playError === -3) { |
|
| 46 | // the user has enough points to buy an entry to this game |
|
| 47 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 48 | $reason = '?NotPaid=1'; |
|
| 49 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 50 | $this->game->getClassType(), |
|
| 51 | array( |
|
| 52 | 'id' => $this->game->getIdentifier(), |
|
| 53 | ) |
|
| 54 | ) .$reason; |
|
| 55 | } |
|
| 56 | ||
| 57 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 58 | } |
|
| 59 | ||
| 60 | // update the winner attribute in entry. |
|
| 61 | $occurrence = $this->getGameService()->IsInstantWinner($this->game, $this->user); |
|
| @@ 22-57 (lines=36) @@ | ||
| 19 | { |
|
| 20 | $playError = null; |
|
| 21 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 22 | if (!$entry) { |
|
| 23 | $reason = ""; |
|
| 24 | if ($playError === -1) { |
|
| 25 | // the user has already taken part to this game and the participation limit has been reached |
|
| 26 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 27 | $reason = '?playLimitReached=1'; |
|
| 28 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 29 | $this->game->getClassType().'/result', |
|
| 30 | array( |
|
| 31 | 'id' => $this->game->getIdentifier(), |
|
| 32 | ) |
|
| 33 | ) .$reason; |
|
| 34 | } elseif ($playError === -2) { |
|
| 35 | // the user has not accepted the mandatory rules of the game |
|
| 36 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 37 | $reason = '?NoOptin=1'; |
|
| 38 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 39 | $this->game->getClassType(), |
|
| 40 | array( |
|
| 41 | 'id' => $this->game->getIdentifier(), |
|
| 42 | ) |
|
| 43 | ) .$reason; |
|
| 44 | } elseif ($playError === -3) { |
|
| 45 | // the user has enough points to buy an entry to this game |
|
| 46 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 47 | $reason = '?NotPaid=1'; |
|
| 48 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 49 | $this->game->getClassType(), |
|
| 50 | array( |
|
| 51 | 'id' => $this->game->getIdentifier(), |
|
| 52 | ) |
|
| 53 | ) .$reason; |
|
| 54 | } |
|
| 55 | ||
| 56 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 57 | } |
|
| 58 | ||
| 59 | $entry = $this->getGameService()->subscribeToLottery($this->game, $this->user, $entry); |
|
| 60 | ||
| @@ 22-57 (lines=36) @@ | ||
| 19 | { |
|
| 20 | $playError = null; |
|
| 21 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 22 | if (!$entry) { |
|
| 23 | $reason = ""; |
|
| 24 | if ($playError === -1) { |
|
| 25 | // the user has already taken part to this game and the participation limit has been reached |
|
| 26 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 27 | $reason = '?playLimitReached=1'; |
|
| 28 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 29 | $this->game->getClassType().'/result', |
|
| 30 | array( |
|
| 31 | 'id' => $this->game->getIdentifier(), |
|
| 32 | ) |
|
| 33 | ) .$reason; |
|
| 34 | } elseif ($playError === -2) { |
|
| 35 | // the user has not accepted the mandatory rules of the game |
|
| 36 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 37 | $reason = '?NoOptin=1'; |
|
| 38 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 39 | $this->game->getClassType(), |
|
| 40 | array( |
|
| 41 | 'id' => $this->game->getIdentifier(), |
|
| 42 | ) |
|
| 43 | ) .$reason; |
|
| 44 | } elseif ($playError === -3) { |
|
| 45 | // the user has enough points to buy an entry to this game |
|
| 46 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 47 | $reason = '?NotPaid=1'; |
|
| 48 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 49 | $this->game->getClassType(), |
|
| 50 | array( |
|
| 51 | 'id' => $this->game->getIdentifier(), |
|
| 52 | ) |
|
| 53 | ) .$reason; |
|
| 54 | } |
|
| 55 | ||
| 56 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 57 | } |
|
| 58 | ||
| 59 | if ($this->getRequest()->isPost()) { |
|
| 60 | $data = $this->getRequest()->getPost()->toArray(); |
|
| @@ 50-85 (lines=36) @@ | ||
| 47 | $subGameIdentifier = $this->getEvent()->getRouteMatch()->getParam('gameId'); |
|
| 48 | $playError = null; |
|
| 49 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 50 | if (!$entry) { |
|
| 51 | $reason = ""; |
|
| 52 | if ($playError === -1) { |
|
| 53 | // the user has already taken part to this game and the participation limit has been reached |
|
| 54 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 55 | $reason = '?playLimitReached=1'; |
|
| 56 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 57 | $this->game->getClassType().'/result', |
|
| 58 | array( |
|
| 59 | 'id' => $this->game->getIdentifier(), |
|
| 60 | ) |
|
| 61 | ) .$reason; |
|
| 62 | } elseif ($playError === -2) { |
|
| 63 | // the user has not accepted the mandatory rules of the game |
|
| 64 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 65 | $reason = '?NoOptin=1'; |
|
| 66 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 67 | $this->game->getClassType(), |
|
| 68 | array( |
|
| 69 | 'id' => $this->game->getIdentifier(), |
|
| 70 | ) |
|
| 71 | ) .$reason; |
|
| 72 | } elseif ($playError === -3) { |
|
| 73 | // the user has enough points to buy an entry to this game |
|
| 74 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 75 | $reason = '?NotPaid=1'; |
|
| 76 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 77 | $this->game->getClassType(), |
|
| 78 | array( |
|
| 79 | 'id' => $this->game->getIdentifier(), |
|
| 80 | ) |
|
| 81 | ) .$reason; |
|
| 82 | } |
|
| 83 | ||
| 84 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 85 | } |
|
| 86 | ||
| 87 | if (!$subGameIdentifier) { |
|
| 88 | $subGame = $this->game->getNextPlayableGame($entry); |
|
| @@ 261-296 (lines=36) @@ | ||
| 258 | } |
|
| 259 | $playError = null; |
|
| 260 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 261 | if (!$entry) { |
|
| 262 | $reason = ""; |
|
| 263 | if ($playError === -1) { |
|
| 264 | // the user has already taken part to this game and the participation limit has been reached |
|
| 265 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 266 | $reason = '?playLimitReached=1'; |
|
| 267 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 268 | $this->game->getClassType().'/result', |
|
| 269 | array( |
|
| 270 | 'id' => $this->game->getIdentifier(), |
|
| 271 | ) |
|
| 272 | ) .$reason; |
|
| 273 | } elseif ($playError === -2) { |
|
| 274 | // the user has not accepted the mandatory rules of the game |
|
| 275 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 276 | $reason = '?NoOptin=1'; |
|
| 277 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 278 | $this->game->getClassType(), |
|
| 279 | array( |
|
| 280 | 'id' => $this->game->getIdentifier(), |
|
| 281 | ) |
|
| 282 | ) .$reason; |
|
| 283 | } elseif ($playError === -3) { |
|
| 284 | // the user has enough points to buy an entry to this game |
|
| 285 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 286 | $reason = '?NotPaid=1'; |
|
| 287 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 288 | $this->game->getClassType(), |
|
| 289 | array( |
|
| 290 | 'id' => $this->game->getIdentifier(), |
|
| 291 | ) |
|
| 292 | ) .$reason; |
|
| 293 | } |
|
| 294 | ||
| 295 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 296 | } |
|
| 297 | } |
|
| 298 | } |
|
| 299 | ||
| @@ 92-127 (lines=36) @@ | ||
| 89 | { |
|
| 90 | $playError = null; |
|
| 91 | $entry = $this->getGameService()->play($this->game, $this->user, $playError); |
|
| 92 | if (!$entry) { |
|
| 93 | $reason = ""; |
|
| 94 | if ($playError === -1) { |
|
| 95 | // the user has already taken part to this game and the participation limit has been reached |
|
| 96 | $this->flashMessenger()->addMessage('Vous avez déjà participé'); |
|
| 97 | $reason = '?playLimitReached=1'; |
|
| 98 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 99 | $this->game->getClassType().'/result', |
|
| 100 | array( |
|
| 101 | 'id' => $this->game->getIdentifier(), |
|
| 102 | ) |
|
| 103 | ) .$reason; |
|
| 104 | } elseif ($playError === -2) { |
|
| 105 | // the user has not accepted the mandatory rules of the game |
|
| 106 | $this->flashMessenger()->addMessage('Vous devez accepter le réglement'); |
|
| 107 | $reason = '?NoOptin=1'; |
|
| 108 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 109 | $this->game->getClassType(), |
|
| 110 | array( |
|
| 111 | 'id' => $this->game->getIdentifier(), |
|
| 112 | ) |
|
| 113 | ) .$reason; |
|
| 114 | } elseif ($playError === -3) { |
|
| 115 | // the user has enough points to buy an entry to this game |
|
| 116 | $this->flashMessenger()->addMessage("Vous ne pouvez pas acheter la partie"); |
|
| 117 | $reason = '?NotPaid=1'; |
|
| 118 | $noEntryRedirect = $this->frontendUrl()->fromRoute( |
|
| 119 | $this->game->getClassType(), |
|
| 120 | array( |
|
| 121 | 'id' => $this->game->getIdentifier(), |
|
| 122 | ) |
|
| 123 | ) .$reason; |
|
| 124 | } |
|
| 125 | ||
| 126 | return $this->redirect()->toUrl($noEntryRedirect); |
|
| 127 | } |
|
| 128 | $viewModel = $this->buildView($this->game); |
|
| 129 | $booster = null; |
|
| 130 | if ($entry) { |
|