12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /*
- * Base action class
- *
- * */
- session_start();
- class Action extends Smarty{
-
- protected $actionName;
- protected $lang;
-
- public function __construct(){
- parent::__construct();
- $this->smartyInit();
- $this->assign('uname',$_SESSION['mds_user']);
- }
-
-
-
- public function run($action){
- $this->actionName = $action;
- $this->requestRoute();
- }
-
- public function display($template = null, $cache_id = null, $compile_id = null, $parent = null){
- if(strpos($template,'/')){
- $this->fetch($template, $cache_id, $compile_id, $parent, true);
- }else{
- // display template
- $this->fetch(strtolower($this->actionName).'/'.$template, $cache_id, $compile_id, $parent, true);
- }
- }
-
-
- private function smartyInit(){
-
- $this->template_dir = ONU_ROOT . "application/module/view";
- $this->config_dir = ONU_ROOT . "config";
- $this->cache_dir = ONU_ROOT . "application/cache";
- $this->compile_dir = ONU_ROOT . "application/compile";
-
- $this->left_delimiter = "<{";
- $this->right_delimiter = "}>";
-
- $this->caching = false;
- $this->cache_lifetime = "3000";
- }
-
- private function requestRoute(){
- $m = isset($_GET["m"])?$_GET["m"]:"index";
- if(method_exists($this,$m)){
- $this->$m();
- }
- else{
- die("Module '{$m}' Not Exists!");
- }
- }
-
-
-
- }
|