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

Back to archive index

Minahito minah****@users*****
2006年 10月 10日 (火) 19:55:22 JST


Index: xoops2jp/html/modules/base/kernel/Legacy_BlockProcedure.class.php
diff -u xoops2jp/html/modules/base/kernel/Legacy_BlockProcedure.class.php:1.1.2.1.2.2 xoops2jp/html/modules/base/kernel/Legacy_BlockProcedure.class.php:1.1.2.1.2.3
--- xoops2jp/html/modules/base/kernel/Legacy_BlockProcedure.class.php:1.1.2.1.2.2	Thu Oct  5 18:08:50 2006
+++ xoops2jp/html/modules/base/kernel/Legacy_BlockProcedure.class.php	Tue Oct 10 19:55:22 2006
@@ -1,7 +1,7 @@
 <?php
 /**
  * @package Legacy
- * @version $Id: Legacy_BlockProcedure.class.php,v 1.1.2.1.2.2 2006/10/05 09:08:50 minahito Exp $
+ * @version $Id: Legacy_BlockProcedure.class.php,v 1.1.2.1.2.3 2006/10/10 10:55:22 minahito Exp $
  */
 
 if (!defined('XOOPS_ROOT_PATH')) die();
@@ -22,6 +22,10 @@
 	{
 	}
 	
+	/**
+	 * Preparation. If it's in exception case, returns false.
+	 * @return bool
+	 */
 	function prepare()
 	{
 		return true;
@@ -62,10 +66,18 @@
 		return $this->mRender;
 	}
 
+	/**
+	 * Gets a number as ID.
+	 * @return int
+	 */
 	function getId()
 	{
 	}
-	
+
+	/**
+	 * Gets a name of this block.
+	 * @return string
+	 */	
 	function getName()
 	{
 	}
@@ -86,21 +98,34 @@
 	{
 	}
 
+	/**
+	 * Gets a title of this block.
+	 * @return string
+	 */
 	function getTitle()
 	{
 		return $this->_mBlock->get('title');
 	}
 	
+	/**
+	 * Gets a column index of this block.
+	 * @return int
+	 */
 	function getEntryIndex()
 	{
 	}
 	
+	/**
+	 * Gets a weight of this block.
+	 * @return int
+	 */
 	function getWeight()
 	{
 	}
 
 	/**
 	 * Gets a value indicating whether this block nees to display its content.
+	 * @return bool
 	 */
 	function isDisplay()
 	{
@@ -108,6 +133,11 @@
 	}
 }
 
+/**
+ * This class extends the base class to exchange of information with the
+ * controller. And, it has a XoopsBlock instance, and some public methods for
+ * the public side and the control panel side.
+ */
 class Legacy_BlockProcedure extends Legacy_AbstractBlockProcedure
 {
 	/**
@@ -164,6 +194,14 @@
 	{
 		return $this->_mBlock->get('weight');
 	}
+	
+	/**
+	 * Gets rendered HTML buffer for the option form of the control panel.
+	 * @return string
+	 */
+	function getOptionForm()
+	{
+	}
 }
 
 /**
@@ -205,6 +243,75 @@
 	{
 		return $this->_mDisplayFlag;
 	}
+
+	function getOptionForm()
+	{
+		if ($this->_mBlock->get('func_file') && $this->_mBlock->get('edit_func')) {
+			$func_file = XOOPS_MODULE_PATH . "/" . $this->_mBlock->get('dirname') . "/blocks/" . $this->_mBlock->get('func_file');
+			if (file_exists($func_file)) {
+				require $func_file;
+				$edit_func = $this->_mBlock->get('edit_func');
+				
+				$options = explode('|', $this->_mBlock->get('options'));
+				
+				if (function_exists($edit_func)) {
+					//
+					// load language file.
+					//
+					$root =& XCube_Root::getSingleton();
+					$langManager =& $root->getLanguageManager();
+					$langManager->loadBlockMessageCatalog($this->_mBlock->get('dirname'));
+					
+					return call_user_func($edit_func, $options);
+				}
+			}
+		}
+		
+		return null;
+	}
+}
+
+/**
+ * Static method collection for blocks in the public side.
+ */
+class Legacy_BlockUtils
+{
+	/**
+	 * Creates a instance of the block procedure with the generating convention.
+	 * And, returns it.
+	 * @static
+	 * @return Legacy_BlockProcedure
+	 */
+	function createBlockProcedure(&$block)
+	{
+		//
+		// IMPORTANT CONVENTION
+		//
+		$retBlock = null;
+		$func = $block->get('show_func');
+		if (substr($func, 0, 4) == 'cl::') {
+			$className = substr($func, 4);
+			if (!class_exists($className)) {
+				$filePath = XOOPS_ROOT_PATH . '/modules/' . $block->get('dirname') . '/blocks/' . $block->get('func_file');
+				if (!file_exists($filePath)) {
+					continue;
+				}
+				
+				require_once $filePath;
+				
+				if (!class_exists($className)) {
+					continue;
+				}
+			}
+				
+			$retBlock =& new $className($block);
+		}
+		else {
+			$retBlock =& new Legacy_BlockProcedureAdapter($block);
+		}
+		
+		return $retBlock;
+	}
 }
 
 ?>
\ No newline at end of file


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