[xoops-cvslog 4777] CVS update: xoops2jp/html/modules/base/kernel

Back to archive index

Minahito minah****@users*****
2006年 10月 5日 (木) 18:08:22 JST


Index: xoops2jp/html/modules/base/kernel/Legacy_HttpContext.class.php
diff -u /dev/null xoops2jp/html/modules/base/kernel/Legacy_HttpContext.class.php:1.1.2.1
--- /dev/null	Thu Oct  5 18:08:22 2006
+++ xoops2jp/html/modules/base/kernel/Legacy_HttpContext.class.php	Thu Oct  5 18:08:21 2006
@@ -0,0 +1,169 @@
+<?php
+/**
+ * @package Legacy
+ * @version $Id: Legacy_HttpContext.class.php,v 1.1.2.1 2006/10/05 09:08:21 minahito Exp $
+ */
+
+if (!defined('XOOPS_ROOT_PATH')) exit();
+
+/**
+ * The context class for Legacy which extends to keep Legacy-module-specific
+ * informations.
+ */
+class Legacy_HttpContext extends XCube_HttpContext
+{
+	/**
+	 * The current user profile object.
+	 * @var XoopsUser
+	 */
+	var $mXoopsUser = null;
+
+	/**
+	 * The current module instance.
+	 */	
+	var $mModule = null;
+	
+	/**
+	 * The current Xoops Module object. This is a shortcut to mModule->mXoopsModule.
+	 * @access public
+	 * @var XoopsModule
+	 */
+	var $mXoopsModule = null;
+	
+	/**
+	 * The array for Xoops, which is configured in the preference of the base.
+	 * This property and $xoopsConfig (X2) is the same.
+	 */
+	var $mXoopsConfig = array();
+	
+	/**
+	 * The array for Xoops Module Config. This is a short cut to mModule->mConfig.
+	 * @access public
+	 * @var array
+	 */
+	var $mModuleConfig = array();
+	
+	/**
+	 * A name of the render system used by the controller strategy.
+	 */
+	var $mBaseRenderSystemName = "";
+}
+
+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();
+		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


xoops-cvslog メーリングリストの案内
Back to archive index