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

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 1月 28日 (土) 23:50:29 JST


Index: xoops2jp/html/class/XCube_ActionForm.class.php
diff -u xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.25 xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.26
--- xoops2jp/html/class/XCube_ActionForm.class.php:1.1.2.25	Fri Jan 27 17:02:42 2006
+++ xoops2jp/html/class/XCube_ActionForm.class.php	Sat Jan 28 23:50:29 2006
@@ -144,7 +144,14 @@
 		
 		foreach(array_keys($this->mFormProperties) as $name) {
 			if(isset($this->mFieldProperties[$name])) {
-				$this->mFieldProperties[$name]->validate($this->mFormProperties[$name]);
+				if ($this->mFormProperties[$name]->isArray()) {
+					foreach (array_keys($this->mFormProperties[$name]->mProperties) as $_name) {
+						$this->mFieldProperties[$name]->validate($this->mFormProperties[$name]->mProperties[$_name]);
+					}
+				}
+				else {
+					$this->mFieldProperties[$name]->validate($this->mFormProperties[$name]);
+				}
 			}
 		}
 
@@ -225,7 +232,7 @@
 	function fetch($key = null)
 	{
 		$value = null;
-		
+
 		if ($key != null && is_array($_REQUEST[$this->mName]) && isset($_REQUEST[$this->mName][$key])) {
 			$value = $_REQUEST[$this->mName][$key];
 		}
@@ -279,7 +286,7 @@
 		if (isset($_REQUEST[$this->mName]) && is_array($_REQUEST[$this->mName])) {
 			foreach ($_REQUEST[$this->mName] as $_key => $_val) {
 				$this->mProperties[$_key] =& new $this->mPropertyClassName($this->mName);
-				$this->mPropertyClassName->fetch($_key);
+				$this->mProperties[$_key]->fetch($_key);
 			}
 		}
 	}
@@ -291,10 +298,17 @@
 
 	function getValue($index=null)
 	{
-		if($index==null)
-			return $this->mValue;
+		if($index==null) {
+			$ret = array();
+			
+			foreach ($this->mProperties as $name => $value) {
+				$ret[$name] = $value;
+			}
+
+			return $ret;
+		}
 
-		return isset($this->mValue[$index]) ? $this->mValue[$index] : null;
+		return isset($this->mProperties[$index]) ? $this->mProperties[$index]->getValue() : null;
 	}
 	
 	function isArray()
@@ -305,9 +319,9 @@
 
 class XCube_BoolProperty extends XCube_AbstractProperty
 {
-	function fetch()
+	function fetch($key = null)
 	{
-		parent::fetch();
+		parent::fetch($key);
 		if (strlen(trim($this->mValue)) > 0) {
 			$this->mValue = (intval($this->mValue)>0) ? 1 : 0;
 		}
@@ -324,9 +338,9 @@
 
 class XCube_IntProperty extends XCube_AbstractProperty
 {
-	function fetch()
+	function fetch($key = null)
 	{
-		parent::fetch();
+		parent::fetch($key);
 		if (strlen(trim($this->mValue)) > 0) {
 			$this->mValue = intval($this->mValue);
 		}
@@ -343,9 +357,9 @@
 
 class XCube_FloatProperty extends XCube_AbstractProperty
 {
-	function fetch()
+	function fetch($key = null)
 	{
-		parent::fetch();
+		parent::fetch($key);
 		if (strlen(trim($this->mValue)) > 0) {
 			$this->mValue = floatval($this->mValue);
 		}
@@ -357,7 +371,7 @@
 
 class XCube_FloatArrayProperty extends XCube_AbstractArrayProperty
 {
-	var $mPropertyClassName = "XCube_FloatArrayProperty";
+	var $mPropertyClassName = "XCube_FloatProperty";
 }
 
 /**
@@ -366,9 +380,9 @@
  */
 class XCube_StringProperty extends XCube_AbstractProperty
 {
-	function fetch()
+	function fetch($key = null)
 	{
-		parent::fetch();
+		parent::fetch($key);
 		if (preg_match_all("/[\\x00-\\x1f]/", $this->mValue, $matches, PREG_PATTERN_ORDER)) {
 			foreach ($matches[0] as $match) {
 				die("Get control code :" . ord($match));
@@ -384,7 +398,7 @@
 
 class XCube_StringArrayProperty extends XCube_AbstractArrayProperty
 {
-	var $mPropertyClassName = "XCube_StringArrayProperty";
+	var $mPropertyClassName = "XCube_StringProperty";
 }
 
 /**
@@ -393,9 +407,9 @@
  */
 class XCube_TextProperty extends XCube_AbstractProperty
 {
-	function fetch()
+	function fetch($key = null)
 	{
-		parent::fetch();
+		parent::fetch($key);
 		$matches = array();
 		$allow_codes = array(9,10,13);
 
@@ -415,7 +429,7 @@
 
 class XCube_TextArrayProperty extends XCube_AbstractArrayProperty
 {
-	var $mPropertyClassName = "XCube_TextArrayProperty";
+	var $mPropertyClassName = "XCube_TextProperty";
 }
 
 class XCube_FileProperty extends XCube_AbstractProperty
@@ -426,7 +440,7 @@
 		$this->mValue =& new XCube_FormFile($name);
 	}
 	
-	function fetch()
+	function fetch($key = null)
 	{
 		if (!is_object($this->mValue)) {
 			return false;


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