protected function runControllers()
 {
     /**
      * Render
      */
     com_salamon_controllers::run($this->_Event, $this->_Setting, $this->_Routes, $this->thisAppNamescpace, $this->_db, $this->_T);
 }
 /**
  * @see com_salamon_interface_controllers::run
  */
 public function run(&$event, &$setting, $routes, $app_namespace, $db, $t)
 {
     $controllerstring = $event->getController();
     $controllerarray = explode('.', $controllerstring);
     //$validation = true;
     if (count($controllerarray) == 2) {
         $controllername = $controllerarray[0] . '_handler';
         $actionname = $controllerarray[1];
         $this->_modulname = '';
     } else {
         if (count($controllerarray) == 3) {
             $this->_modulname = $controllerarray[0];
             $controllername = $controllerarray[1] . '_' . $this->_modulname . '_handler';
             $actionname = $controllerarray[2];
         }
     }
     try {
         if (class_exists($controllername)) {
             $controller = new $controllername($event, $setting, $routes, $app_namespace, $db, $t, $this->_modulname);
             $reflector = new ReflectionClass($controllername);
             $parameters = $reflector->getMethod($actionname)->getParameters();
             $handlerOptions = com_salamon_controllers::getHandlerOptions($parameters, $controller);
             $controller->setAJAXCall($handlerOptions['AJAXCall']);
             $controller->setPID($handlerOptions['pageid']);
             $controller->setPremID($handlerOptions['premid']);
             if (is_array($handlerOptions['runBefore'])) {
                 for ($i = 0; $i < count($handlerOptions['runBefore']); $i++) {
                     $fnInterName = $handlerOptions['runBefore'][$i];
                     if (method_exists($controller, $fnInterName)) {
                         $validation = $controller->{$fnInterName}();
                     } else {
                         throw new Exception("Cannot find method {$controllername}.{$fnInterName}", 404);
                     }
                 }
                 if ($validation && method_exists($controller, $actionname)) {
                     $controller->{$actionname}();
                 } elseif (!method_exists($controller, $actionname)) {
                     throw new Exception("Cannot find method {$controllername}.{$actionname}", 404);
                 }
             } else {
                 if (method_exists($controller, $handlerOptions['runBefore'])) {
                     $validation = $controller->{$handlerOptions}['runBefore']();
                     if ($validation && method_exists($controller, $actionname)) {
                         $controller->{$actionname}();
                     }
                 } elseif (method_exists($controller, $actionname)) {
                     $controller->{$actionname}();
                 } else {
                     throw new Exception("Cannot find method {$controllername}.{$actionname}", 404);
                 }
             }
         }
     } catch (Exception $e) {
         $this->isError = true;
         $controller->setError();
         com_salamon_controllers::defualtError($e->getMessage());
     }
 }
 /**
  * @see com_salamon_interface_views::renderView()
  */
 public function renderView($viewname)
 {
     $path = $this->_folders['views'] . ($this->_without_namespace ? '' : $this->getNamespace()) . '/' . $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_controllers::missingError($e->getMessage());
         }
     }
 }