source: branches/mvc/Base/Controller.php

Last change on this file was 59, checked in by chronos, 10 years ago
  • Moved trunk as mvc branch.
File size: 1.0 KB
Line 
1<?php
2
3include_once(dirname(__FILE__).'/Module.php');
4
5class Controller extends Module
6{
7 function OnAccessDenied($Action, $Id)
8 {
9 return($this->System->Output->SystemMessage('Nemáte oprávnění provést akci "'.
10 $Action.'" modulu "'.substr(get_class($this), 0, -10).'" na položce "'.$Id.'"'));
11 }
12
13 function Process()
14 {
15 if(array_key_exists('A', $_GET)) $Action = $_GET['A'];
16 else $Action = 'Show';
17 if(method_exists($this, $Action))
18 {
19 if(array_key_exists('Id', $_GET)) $Id = $_GET['Id'];
20 else $Id = '';
21 if($this->System->Modules['Permission']->Check(substr(get_class($this), 0, -10), $Action, $Id))
22 return($this->$Action());
23 else return($this->OnAccessDenied($Action, $Id));
24 } else return($this->System->Output->SystemMessage('Metoda "'.$Action.'" modulu "'.get_class($this).'" nenalezena.'));
25 }
26
27 function RequireParameter($Name)
28 {
29 //if(!array_key_exists($Name, $_GET)) return($this->System->SystemMessage('Přístup zamítnut.');
30 }
31}
Note: See TracBrowser for help on using the repository browser.