[xoops-cvslog 1635] CVS update: xoops2jp/html/class

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 1月 11日 (水) 00:38:16 JST


Index: xoops2jp/html/class/XCube_ActionForm.class.php
diff -u xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.13 xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.14
--- xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.13	Sun Jan  8 17:03:00 2006
+++ xoops2jp/html/class/XCube_ActionForm.class.php	Wed Jan 11 00:38:15 2006
@@ -36,13 +36,32 @@
 	{
 	}
 	
-	function setVar($key,$val)
+	function set()
 	{
-		//
-		// TODO Follow about array.
-		//
-		if(isset($this->mFormProperties[$key]))
-			$this->mFormProperties[$key]->setValue($val);
+		if(isset($this->mFormProperties[func_get_arg(0)])) {
+			if (func_num_args() == 2) {
+				$value = func_get_arg(2);
+				$this->mFormProperties[func_get_arg(0)]->setValue($value);
+			} elseif (func_num_args() == 3) {
+				$index = func_get_arg(1);
+				$value = func_get_arg(2);
+				$this->mFormProperties[func_get_arg(0)]->setValue($index, $value);
+			}
+		}
+	}
+
+	/**
+	 * @deprecated
+	 */	
+	function setVar()
+	{
+		if(isset($this->mFormProperties[func_get_arg(0)])) {
+			if (func_num_args() == 2) {
+					$this->mFormProperties[func_get_arg(0)]->setValue(func_get_arg(1));
+			} elseif (func_num_args() == 3) {
+					$this->mFormProperties[func_get_arg(0)]->setValue(func_get_arg(1), func_get_arg(2));
+			}
+		}
 	}
 	
 	function get($key,$index=null)
@@ -273,6 +292,11 @@
 			$this->mValue=array();
 	}
 
+	function setValue($index, $value)
+	{
+		$this->mValue[$index] = $value;
+	}
+
 	function getValue($index=null)
 	{
 		if($index==null)
@@ -283,6 +307,36 @@
 
 }
 
+class XCube_BoolProperty extends XCube_AbstractProperty
+{
+	function fetch()
+	{
+		parent::fetch();
+		if(strlen($this->mValue)>0) {
+			$this->mValue=(intval($this->mValue)>0) ? 1 : 0;
+		}
+		else {
+			$this->mValue=0;
+		}
+	}
+}
+
+class XCube_BoolArrayProperty extends XCube_AbstractArrayProperty
+{
+	function fetch()
+	{
+		parent::fetch();
+		foreach(array_keys($this->mValue) as $key) {
+			if(strlen($this->mValue[$key])>0) {
+				$this->mValue[$key]=(intval($this->mValue)>0) ? 1 : 0;
+			}
+			else {
+				$this->mValue[$key]=0;
+			}
+		}
+	}
+}
+
 class XCube_IntProperty extends XCube_AbstractProperty
 {
 	function fetch()
@@ -436,17 +490,19 @@
 	
 	function validate($val)
 	{
-		foreach($this->mDepends as $depend) {
-			if(!$depend->check($val,$this->mVariables)) {
-				// Error
-				// NOTICE: This is temporary until we will decide the method of managing error.
-				$this->mForm->mErrorFlag=true;
-				
-				// TEST!!
-				$this->mForm->addErrorMessage($this->renderMessage($depend->getName()));
-			}
-			else {
-				// OK
+		if(is_array($this->mDepends) && count($this->mDepends)>0) {
+			foreach($this->mDepends as $depend) {
+				if(!$depend->check($val,$this->mVariables)) {
+					// Error
+					// NOTICE: This is temporary until we will decide the method of managing error.
+					$this->mForm->mErrorFlag=true;
+					
+					// TEST!!
+					$this->mForm->addErrorMessage($this->renderMessage($depend->getName()));
+				}
+				else {
+					// OK
+				}
 			}
 		}
 	}


xoops-cvslog メーリングリストの案内
アーカイブの一覧に戻る