コード例 #1
0
 /**
  * @see com_salamon_interface_controlers::run
  */
 public function run(&$event, &$setting, $routes, $module, $db)
 {
     $controlerstring = $event->getControler();
     $controlerarray = explode('.', $controlerstring);
     $controlername = $controlerarray[0] . '_controler';
     $actionname = $controlerarray[1];
     try {
         if (class_exists($controlername)) {
             $controler = new $controlername($event, $setting, $routes, $module, $db);
             if (method_exists($controler, $actionname)) {
                 $controler->{$actionname}();
             } else {
                 throw new Exception("Cannot find method {$controlername}.{$actionname}", 404);
             }
         }
     } catch (Exception $e) {
         com_salamon_controlers::defualtError($e->getMessage());
     }
 }
コード例 #2
0
 /**
  * @see com_salamon_interface_views::renderView()
  */
 public function renderView($viewname)
 {
     $path = 'views/' . $this->getNamespace() . '/views/' . $viewname . '.php';
     try {
         if (file_exists($path)) {
             include $path;
         } else {
             throw new Exception("Cannot find view '{$path}'", 404);
         }
     } catch (Exception $e) {
         if (!headers_sent()) {
             com_salamon_controlers::defualtError($e->getMessage());
         }
     }
 }