<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace FrontModule;
use \Nette\Application\UI\Form;
use \Nette\Utils\Image;

 
class PsiPresenter extends BasePresenter {
    
    private $psiModel;
    private $zkouskyModel;
    private $fotkyModel;
    private $strankyModel;
    private $urlList = "psi/list";
 
    public function __construct(\PsiModel $psiModel,  \ZkouskyModel $zkouskyModel, \FotkyPsuModel $fotkyModel, \StrankyModel $strankyModel) {
    $this->psiModel = $psiModel;
    $this->zkouskyModel = $zkouskyModel;
    $this->fotkyModel = $fotkyModel;
    $this->strankyModel = $strankyModel;
    }
    
    public function beforeRender() {
        $this->template->title = 'Databáze chovných psů a fen';
        $this->template->description = "Databáze chovných jedinců plemene velššpringršpaněl.";
    }
    
   
    
    public function renderList() {
      
       // if ($this->rok == null) { $this->rok=date('Y'); } // aktualni rok
        $this->template->text = $this->strankyModel->getStrankaByUrl($this->urlList);
        $this->template->psi = $this->psiModel->getAktivniPsy(); 
        $this->template->feny = $this->psiModel->getAktivniFeny();
        //$this->template->form = $this->createComponentAddPesForm();
        //$this->template->nahled = $this->fotkyModel->getFotkyByPesId($id);
        
 }
 
  public function renderArchiv() {
      
       // if ($this->rok == null) { $this->rok=date('Y'); } // aktualni rok
     
        $this->template->psi = $this->psiModel->getVyrazenePsy(); 
        $this->template->feny = $this->psiModel->getVyrazeneFeny();
        
        
 }
  /*  public function renderEdit($id) {
    }
    
    public function renderEditZkousky($id) {
        $this->template->zkousky = $this->zkouskyModel->getVysledkyByIdPsa($id);
    }
     */
    
    public function renderFoto($id) {
        $this->template->fotky = $this->fotkyModel->getFotkyByPesId($id);
       $this->template->pes = $this->psiModel->getPesById($id);
    }
    
   
    
    public function renderKarta($id) {
        $this->template->pes = $this->psiModel->getPesById($id);
        $this->template->zkousky = $this->zkouskyModel->getVysledkyByIdPsa($id);
    }
    

        
       
       
}
