| @@ 473-493 (lines=21) @@ | ||
| 470 | return $viewModel; |
|
| 471 | } |
|
| 472 | ||
| 473 | public function fbshareAction() |
|
| 474 | { |
|
| 475 | $result = parent::fbshareAction(); |
|
| 476 | $bonusEntry = false; |
|
| 477 | ||
| 478 | if ($result->getVariable('success')) { |
|
| 479 | // Improve this thing |
|
| 480 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 481 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 482 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 483 | } |
|
| 484 | } |
|
| 485 | ||
| 486 | $response = $this->getResponse(); |
|
| 487 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 488 | 'success' => $result, |
|
| 489 | 'playBonus' => $bonusEntry |
|
| 490 | ))); |
|
| 491 | ||
| 492 | return $response; |
|
| 493 | } |
|
| 494 | ||
| 495 | public function fbrequestAction() |
|
| 496 | { |
|
| @@ 495-514 (lines=20) @@ | ||
| 492 | return $response; |
|
| 493 | } |
|
| 494 | ||
| 495 | public function fbrequestAction() |
|
| 496 | { |
|
| 497 | $result = parent::fbrequestAction(); |
|
| 498 | $bonusEntry = false; |
|
| 499 | ||
| 500 | if ($result->getVariable('success')) { |
|
| 501 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 502 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 503 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 504 | } |
|
| 505 | } |
|
| 506 | ||
| 507 | $response = $this->getResponse(); |
|
| 508 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 509 | 'success' => $result, |
|
| 510 | 'playBonus' => $bonusEntry |
|
| 511 | ))); |
|
| 512 | ||
| 513 | return $response; |
|
| 514 | } |
|
| 515 | ||
| 516 | public function tweetAction() |
|
| 517 | { |
|
| @@ 516-535 (lines=20) @@ | ||
| 513 | return $response; |
|
| 514 | } |
|
| 515 | ||
| 516 | public function tweetAction() |
|
| 517 | { |
|
| 518 | $result = parent::tweetAction(); |
|
| 519 | $bonusEntry = false; |
|
| 520 | ||
| 521 | if ($result->getVariable('success')) { |
|
| 522 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 523 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 524 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 525 | } |
|
| 526 | } |
|
| 527 | ||
| 528 | $response = $this->getResponse(); |
|
| 529 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 530 | 'success' => $result, |
|
| 531 | 'playBonus' => $bonusEntry |
|
| 532 | ))); |
|
| 533 | ||
| 534 | return $response; |
|
| 535 | } |
|
| 536 | ||
| 537 | public function googleAction() |
|
| 538 | { |
|
| @@ 537-556 (lines=20) @@ | ||
| 534 | return $response; |
|
| 535 | } |
|
| 536 | ||
| 537 | public function googleAction() |
|
| 538 | { |
|
| 539 | $result = parent::googleAction(); |
|
| 540 | $bonusEntry = false; |
|
| 541 | ||
| 542 | if ($result->getVariable('success')) { |
|
| 543 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 544 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 545 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 546 | } |
|
| 547 | } |
|
| 548 | ||
| 549 | $response = $this->getResponse(); |
|
| 550 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 551 | 'success' => $result, |
|
| 552 | 'playBonus' => $bonusEntry |
|
| 553 | ))); |
|
| 554 | ||
| 555 | return $response; |
|
| 556 | } |
|
| 557 | ||
| 558 | public function getGameService() |
|
| 559 | { |
|