<?php

include_once(dirname(__FILE__).'/Module.php');

class Controller extends Module
{
  function OnAccessDenied($Action, $Id)
  {
    return($this->System->Output->SystemMessage('Nemáte oprávnění provést akci "'.$Action.'" modulu "'.substr(get_class($this), 0, -10).'" na položce "'.$Id.'"'));
  }
  
  function Process()
  {
    if(array_key_exists('A', $_GET)) $Action = $_GET['A'];
      else $Action = 'Show';
    if(method_exists($this, $Action))
    {
      if(array_key_exists('Id', $_GET)) $Id = $_GET['Id'];
        else $Id = '';
      if($this->System->Modules['Permission']->Check(substr(get_class($this), 0, -10), $Action, $Id))
        return($this->$Action());
        else return($this->OnAccessDenied($Action, $Id));
    } else return($this->System->Output->SystemMessage('Metoda "'.$Action.'" modulu "'.get_class($this).'" nenalezena.'));
  }

  function RequireParameter($Name)
  {
    //if(!array_key_exists($Name, $_GET)) return($this->System->SystemMessage('Přístup zamítnut.');
  }
}

?>
