/** * 返回该模块的模块名 * * @return string */ function moduleName() { return $this->_module->moduleName(); }
/** * 构造函数 * * @param QApplication_Module $module */ protected function __construct(QApplication_Module $module) { $module_name = $module->moduleName(); $appid = $module->APPID(); self::$_instances[$appid][$module_name] = $this; $this->_app = QApplication_Abstract::app($appid); $this->_module = $module; if ($module_name == QApplication_Module::DEFAULT_MODULE_NAME) { // 初始化应用程序默认的上下文对象 $this->_config = (require Q_DIR . '/_config/default_config.php'); $this->setIni($module->config()); } else { // 构造其他模块的上下文对象 $root = self::$_instances[$appid][QApplication_Module::DEFAULT_MODULE_NAME]; $this->module_name = $module_name; $this->namespace = $root->namespace; $this->controller_name = $root->controller_name; $this->action_name = $root->action_name; $this->_router = $root->router(); $this->_params = $root->_params; $this->_parent = $root; // 载入该模块的配置 $this->_config = $module->config(); $app_config = QApplication_Abstract::getAppConfig($appid); Q::import($app_config['ROOT_DIR'] . "/modules/{$module_name}/model"); Q::import($app_config['ROOT_DIR'] . "/modules/{$module_name}"); } $this->_name = $module_name; $this->_initOneTime(); $this->_prepare(); }