Minahito
minah****@users*****
2006年 10月 6日 (金) 18:48:22 JST
Index: xoops2jp/html/modules/base/kernel/Legacy_Module.class.php diff -u /dev/null xoops2jp/html/modules/base/kernel/Legacy_Module.class.php:1.1.2.1 --- /dev/null Fri Oct 6 18:48:22 2006 +++ xoops2jp/html/modules/base/kernel/Legacy_Module.class.php Fri Oct 6 18:48:22 2006 @@ -0,0 +1,127 @@ +<?php +/** + * @package Legacy + * @version $Id: Legacy_Module.class.php,v 1.1.2.1 2006/10/06 09:48:22 minahito Exp $ + */ + +class Legacy_Module +{ + /** + * @access public + * @var XoopsModule + */ + var $mXoopsModule = null; + + /** + * @access public + * @var array + */ + var $mModuleConfig = array(); + + var $mCacheInfo = null; + + var $mRender = null; + + function &getCacheInfo() + { + if (!is_object($this->mCacheInfo)) { + $this->_createCacheInfo(); + } + + return $this->mCacheInfo; + } + + function _createCacheInfo() + { + $this->mCacheInfo =& new Legacy_ModuleCacheInformation(); + $this->mCacheInfo->mURL = xoops_getenv('REQUEST_URI'); + $this->mCacheInfo->setModule($this->mXoopsModule); + } + + function &getRenderBuffer() + { + if ($this->mRender == null) { + $this->_createRenderBuffer(); + } + + return $this->mRender; + } + + function _createRenderBuffer() + { + $this->mRender =& new XCube_RenderTarget(); + $this->mRender->setType(XCUBE_RENDER_TARGET_TYPE_MAIN); + if ($this->mXoopsModule != null) { + $this->mRender->setModuleName($this->mXoopsModule->get('dirname')); + } + } + + function getRenderSystemName() + { + $root =& XCube_Root::getSingleton(); + return $root->mContext->mBaseRenderSystemName; + } + + function isActive() + { + return $this->mXoopsModule->get('isactive') ? true : false; + } + + function setupLanguage() + { + $root =& XCube_Root::getSingleton(); + $root->mLanguageManager->loadModuleMessageCatalog($this->mXoopsModule->getVar('dirname')); + } + + /** + * Gets a value indicating whether the current module has a option of + * configurations to use the cache system. + * @return bool + */ + function hasCacheConfig() + { + if (xoops_getenv('REQUEST_METHOD') == 'POST') { + return false; + } + + $root =& XCube_Root::getSingleton(); + + return is_object($this->mXoopsModule) && !empty($root->mController->mConfig['module_cache'][$this->mXoopsModule->get('mid')]); + } + + /** + * Initializes a cache information object, and returns it. + * @return Legacy_ModuleCacheInformation + */ + function &createCacheInfo() + { + $this->mCacheInfo =& new Legacy_ModuleCacheInformation(); + $this->mCacheInfo->mURL = xoops_getenv('REQUEST_URI'); + $this->mCacheInfo->setModule($xoopsModule); + + return $this->mCacheInfo; + } +} + +class Legacy_AdminModule extends Legacy_Module +{ + function setupLanguage() + { + $root =& XCube_Root::getSingleton(); + + $this->mXoopsModule->loadInfo($this->mXoopsModule->get('dirname')); + + if (isset($this->mXoopsModule->modinfo['cube_style']) && $this->mXoopsModule->modinfo['cube_style'] != false) { + $root->mLanguageManager->loadModuleMessageCatalog($this->mXoopsModule->get('dirname')); + } + $root->mLanguageManager->loadModuleAdminMessageCatalog($this->mXoopsModule->get('dirname')); + $root->mLanguageManager->loadModinfoMessageCatalog($this->mXoopsModule->get('dirname')); + } + + function hasCacheConfig() + { + return false; + } +} + +?> \ No newline at end of file