<?php

namespace App\Presenters;

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


class SecondPresenter extends SecureBasePresenter
{

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


    public function actionDefault()
    {
        $stage = $this->GameM->GetStage($this->user->id);

        if ($stage != 2) {
            $this->flashMessage("You must try to solve the case first.");
            $this->redirect('First:Default');
        }
    }


    public function renderDefault()
    {
        $result = $this->GameM->GetResult($this->user->id);
        $this->template->result = $result;

        if ($result == 1){
            $this->template->video = 'https://www.youtube.com/embed/8sL0-OUyfTA';
        }
        if ($result == 2) {
            $this->template->video = 'https://www.youtube.com/embed/FDRNT3NOOrs';
        }
        if ($result == 3) {
            $this->template->video = 'https://www.youtube.com/embed/CI9YrPPjg3w';
        }
        if ($result == 4) {
            $this->template->video = 'https://www.youtube.com/embed/VHs7rC98uHE';
        }

    }

}
