| @@ 329-349 (lines=21) @@ | ||
| 326 | return $viewModel; |
|
| 327 | } |
|
| 328 | ||
| 329 | public function fbshareAction() |
|
| 330 | { |
|
| 331 | $result = parent::fbshareAction(); |
|
| 332 | $bonusEntry = false; |
|
| 333 | ||
| 334 | if ($result->getVariable('success')) { |
|
| 335 | // Improve this thing |
|
| 336 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 337 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 338 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 339 | } |
|
| 340 | } |
|
| 341 | ||
| 342 | $response = $this->getResponse(); |
|
| 343 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 344 | 'success' => $result, |
|
| 345 | 'playBonus' => $bonusEntry |
|
| 346 | ))); |
|
| 347 | ||
| 348 | return $response; |
|
| 349 | } |
|
| 350 | ||
| 351 | public function fbrequestAction() |
|
| 352 | { |
|
| @@ 351-370 (lines=20) @@ | ||
| 348 | return $response; |
|
| 349 | } |
|
| 350 | ||
| 351 | public function fbrequestAction() |
|
| 352 | { |
|
| 353 | $result = parent::fbrequestAction(); |
|
| 354 | $bonusEntry = false; |
|
| 355 | ||
| 356 | if ($result->getVariable('success')) { |
|
| 357 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 358 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 359 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 360 | } |
|
| 361 | } |
|
| 362 | ||
| 363 | $response = $this->getResponse(); |
|
| 364 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 365 | 'success' => $result, |
|
| 366 | 'playBonus' => $bonusEntry |
|
| 367 | ))); |
|
| 368 | ||
| 369 | return $response; |
|
| 370 | } |
|
| 371 | ||
| 372 | public function tweetAction() |
|
| 373 | { |
|
| @@ 372-391 (lines=20) @@ | ||
| 369 | return $response; |
|
| 370 | } |
|
| 371 | ||
| 372 | public function tweetAction() |
|
| 373 | { |
|
| 374 | $result = parent::tweetAction(); |
|
| 375 | $bonusEntry = false; |
|
| 376 | ||
| 377 | if ($result->getVariable('success')) { |
|
| 378 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 379 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 380 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 381 | } |
|
| 382 | } |
|
| 383 | ||
| 384 | $response = $this->getResponse(); |
|
| 385 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 386 | 'success' => $result, |
|
| 387 | 'playBonus' => $bonusEntry |
|
| 388 | ))); |
|
| 389 | ||
| 390 | return $response; |
|
| 391 | } |
|
| 392 | ||
| 393 | public function googleAction() |
|
| 394 | { |
|
| @@ 393-412 (lines=20) @@ | ||
| 390 | return $response; |
|
| 391 | } |
|
| 392 | ||
| 393 | public function googleAction() |
|
| 394 | { |
|
| 395 | $result = parent::googleAction(); |
|
| 396 | $bonusEntry = false; |
|
| 397 | ||
| 398 | if ($result->getVariable('success')) { |
|
| 399 | $lastEntry = $this->getGameService()->findLastInactiveEntry($this->game, $this->user); |
|
| 400 | if ($lastEntry && $lastEntry->getWinner()) { |
|
| 401 | $bonusEntry = $this->getGameService()->addAnotherChance($this->game, $this->user, 1); |
|
| 402 | } |
|
| 403 | } |
|
| 404 | ||
| 405 | $response = $this->getResponse(); |
|
| 406 | $response->setContent(\Zend\Json\Json::encode(array( |
|
| 407 | 'success' => $result, |
|
| 408 | 'playBonus' => $bonusEntry |
|
| 409 | ))); |
|
| 410 | ||
| 411 | return $response; |
|
| 412 | } |
|
| 413 | ||
| 414 | public function getGameService() |
|
| 415 | { |
|