示例#1
0
 private function _processRoute(ZRoute &$a_route, &$a_code, &$a_message)
 {
     $ctl = null;
     $mod = null;
     if ($a_route->module) {
         $mod = new ZModule($this, $a_route->module . 'Module');
         $mod->setBaseDir($this->fromBaseDir(Zoombi::config('path.module', 'module')) . Zoombi::DS . $a_route->module);
     }
     if (!$a_route->controller) {
         $a_route->controller = $this->getConfig()->getValue('controller.default_name', 'index');
     }
     if (!$a_route->action) {
         $a_route->action = $this->getConfig()->getValue('controller.default_action', 'index');
     }
     if (!$mod) {
         $mod =& $this;
     }
     try {
         $ctl = $mod->load->controller($a_route->getController());
     } catch (ZControllerException $e) {
         $a_code = $e->getCode();
         $a_message = $e->getMessage();
         return false;
     }
     if (!$ctl) {
         return false;
     }
     $this->setController($ctl);
     return true;
 }
示例#2
0
 protected final function fixroute($a_route)
 {
     $r = new ZRoute($a_route);
     if (!$r->getModule()) {
         $r->setModule($this->getConfig()->getValue('module.default_name', self::DEFAULT_MODULE_NAME));
     }
     if (!$r->getController()) {
         $r->setController($this->getConfig()->getValue('controller.default_name', self::DEFAULT_CONTROLLER_NAME));
     }
     if (!$r->getAction()) {
         $r->setAction($this->getConfig()->getValue('controller.default_action', self::DEFAULT_ACTION_NAME));
     }
     $o = (string) $r;
     unset($r);
     return $o;
 }
示例#3
0
 private function _processRoute(ZRoute &$a_route, &$a_code, &$a_message)
 {
     $ctl = null;
     if (!$a_route->controller) {
         $a_route->controller = $this->m_config->getValue('controller.default_name', 'index');
     }
     if (!$a_route->action) {
         $a_route->action = $this->m_config->getValue('controller.default_action', 'index');
     }
     try {
         $ctl = ZLoader::controller($a_route->getController());
     } catch (ZControllerException $e) {
         $a_code = $e->getCode();
         $a_message = $e->getMessage();
         return false;
     }
     if (!$ctl) {
         return false;
     }
     $this->setController($ctl);
     return true;
 }