<?php

namespace App\Presenters;

use Nette;
use App\Model;


/**
 * Base presenter for all application presenters.
 */
abstract class BasePresenter extends Nette\Application\UI\Presenter
{

	/**
	 * @inject
	 * @var \App\Model\GameManager
	 */
	public $GameM;
	
	public function beforeRender()
	{
            $this->template->start_time = '';

            $allgames = $this->GameM->getNumberOfGames();
            $wingames = $this->GameM->getNumberOfWinGames();
            $lostgames = ($allgames-$wingames);

            $this->template->lostgames = $lostgames;
            $this->template->allgames = $allgames;
            $this->template->wingames = $wingames;
            $this->getMenu();

        }
	
	function getMenu()
	{
		$menu = array(  
				"Webs:" => "Instructions",
				"Webs:newspaper" => "Newspapers",
				"Webs:report" => "Photos & Reports",
				"Webs:testimony" => "Testimonies",
				"Webs:vocab" => "Vocabulary",
				"Homepage:default" => "Play!");
		
		$playArray = array( "FirstPresenter", "SecondPresenter", "HomepagePresenter" );
		
		$action = ($this->getAction() == "default") ? "" : $this->getAction();
		
		$presenterName = get_class($this);
		$this->template->presenterName = $presenterName;
		
		$this->template->playArray = $playArray;
		$this->template->action = $action;
		$this->template->menu = $menu;
		
		
	}
	
}
