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