<?php

namespace App\Presenters;

use Nette;
use App\Model;
use App\Forms;


class ResultPresenter extends SecureBasePresenter
{

    public function renderDefault()
    {
        $this->template->anyVariable = 'any value';
    }

    public $playerID;

    /**
     * @inject
     * @var \App\Model\GameManager
     */
    public $GameM;

    public function actionDefault()
    {
        $this->template->people = $this->GameM->GetPopulation($this->user->id);

        $stage = $this->GameM->GetStage($this->user->id);

        if ($stage != 23) {
            $stageslibary = array("", "First:default", "First:outcome", "Second:default", "Second:outcome", "Third:default",
                "Third:outcome", "Fourth:default", "Fourth:outcome", "Fifth:default", "Fifth:outcome", "Sixth:default", "Sixth:outcome",
                "Seventh:default", "Seventh:outcome", "Eighth:default", "Eighth:outcome", "Ninth:default", "Ninth:outcome",
                "Tenth:default", "Tenth:outcome", "Eleventh:default", "Eleventh:outcome");
            $newstage = $stageslibary[$stage];
            $this->flashMessage("The form has already been filled in. You've been redirected to a different page.");
            $this->redirect($newstage);
        }

        $plague = $this->GameM->GetPlague($this->user->id);

        if($plague>=4)
            $this->template->video = 'https://www.youtube.com/embed/5e0F3b0stIk';
        else
            $this->template->video = 'https://www.youtube.com/embed/hmyIeI7QccA';
    }

}