<?php
	/* 
		*** pracovna verzia ***
		zmeny oproti povodnej verzii (iba v triede cPage)
		- polia $_POST a $_GET je predavane ako paramater konstruktoru
		- v konstruktore nie je vytvarane ziadne implicitne menu
		- bLoggedIn nie je nastavovana v kontruktore, pretoze sa zmenila funkcia LoggedAsAdmin na LoggedAs($userType) a kazdy si to musi naimplementovat sam
		- v metode Draw() nie je implicitne nastavene, ze ktory template sa ma nacitat
	*/

  abstract class cPage
  {
	  protected $db;
    protected $smarty;
    protected $action;
    protected $bLoggedIn;
		protected $menu;
		public $postParams = array();
    public $getParams = array();
   
    function __construct( $smarty, $db, $action, $postParams, $getParams )
    {
      $this->db = $db;
    	$this->smarty = $smarty;
    	$this->action = $action;
    	$this->postParams = $postParams;
    	$this->getParams = $getParams;
    }

    public function LoggedAs($userType)
    {
      return isset( $_SESSION["userType"]) && ($_SESSION["userType"] === $userType);
    }
    
    public function SayError()
    {
      $this->smarty->assign("error",$this->error);
      $this->smarty->display("error.tpl");
    } 

    abstract protected function Process();
    
    abstract protected function Draw();
    
  }
?>
