/**
  * Run action
  * Called from @see module_router::route()
  * 
  * params
  * ------
  * action
  * section
  * template
  * file          - file _ parsed to /
  * _file         - raw file
  * 
  */
 function run($route, $params = null)
 {
     $this->_action = $route['action'];
     $this->_params = new aregistry($params);
     $this->_section = @$route['section'];
     $this->_title = @$route['title'];
     $this->_layout = @$route['layout'];
     $section_path = '';
     // $section_path = isset($route['section']) ? "{$route['section']}/" : '';
     // append section and module name
     $this->_template = !empty($route['template']) ? $this->get_context()->get_name() . '/' . $section_path . $route['template'] : false;
     // run section
     if (!empty($this->_section)) {
         $this->run_section($this->_section, $route, $params);
     }
     // run action
     if ($route['type'] == 'inline') {
         // closure
         call_user_func($this->_action, $this);
     } else {
         if ($route['type'] == 'method') {
             // method in controller.file
             if (!empty($this->_action)) {
                 $method = 'action_' . $this->_action;
                 if (!method_exists($this, $method)) {
                     throw new router_exception('Action method not found ' . $this->_action . ' | ' . $method);
                 }
                 call_user_func(array($this, $method));
             }
         } else {
             if ($route['type'] == 'class') {
                 // external actions/file
                 $class_file = isset($route['file']) ? $route['file'] : $this->_action;
                 $class_file = $section_path . $class_file;
                 $_action = array('action' => $this->_action, 'file' => $class_file);
                 if (isset($route['_file'])) {
                     $_action['_file'] = $route['_file'];
                 }
                 $this->run_file_action($_action);
             }
         }
     }
     core::dprint(array("controller::run(%s) type: %s", $this->action_name, $route['type']));
     // set title
     if (!empty($this->_title)) {
         $this->renderer->set_page_title($this->_title);
     }
     // set body template
     $this->renderer->set_main_template($this->get_template());
     // page layout
     if (!empty($this->_layout)) {
         $this->renderer->set_page_template('pages/' . $this->_layout);
     }
 }