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

Back to archive index

Minahito minah****@users*****
2006年 7月 10日 (月) 19:57:40 JST


Index: xoops2jp/html/modules/base/kernel/handler.php
diff -u xoops2jp/html/modules/base/kernel/handler.php:1.1.2.18 xoops2jp/html/modules/base/kernel/handler.php:1.1.2.19
--- xoops2jp/html/modules/base/kernel/handler.php:1.1.2.18	Mon Jul 10 19:01:49 2006
+++ xoops2jp/html/modules/base/kernel/handler.php	Mon Jul 10 19:57:40 2006
@@ -60,13 +60,13 @@
 	 * 
 	 * @return array
 	 */
-	function &getObjects($criteria = null, $param1 = false, $param2 = false, $param3 = false)
+	function &getObjects($criteria = null, $limit = null, $start = null, $id_as_key = false)
 	{
 		$ret = array();
 
+		$sql = "SELECT * FROM " . $this->mTable;
+
 		if($criteria !== null && is_a($criteria, 'CriteriaElement')) {
-			$sql = "SELECT * FROM " . $this->mTable;
-			
 			$where = $this->_makeCriteria4sql($criteria);
 			
 			if (trim($where)) {
@@ -81,33 +81,45 @@
 				$sql .= " ORDER BY " . implode(',', $sorts);
 			}
 			
-			$limit = $criteria->getLimit();
-			$start = $criteria->getStart();
-			
-			$result = $this->db->query($sql, $limit, $start);
-
-			if (!$result) {
-				return $ret;
+			if ($limit === null) {
+				$limit = $criteria->getLimit();
 			}
-
-			while($row = $this->db->fetchArray($result)) {
-				$obj =& new $this->mClass();
-				$obj->assignVars($row);
-				$obj->unsetNew();
 			
-				if ($id_as_key)	{
-					$ret[$obj->get($this->mPrimary)] =& $obj;
-				}
-				else {
-					$ret[]=&$obj;
-				}
+			if ($start === null) {
+				$start = $criteria->getStart();
+			}
+		}
+		else {
+			if ($limit === null) {
+				$limit = 0;
+			}
 			
-				unset($obj);
+			if ($start === null) {
+				$start = 0;
 			}
-		
+		}
+
+		$result = $this->db->query($sql, $limit, $start);
+
+		if (!$result) {
 			return $ret;
 		}
+
+		while($row = $this->db->fetchArray($result)) {
+			$obj =& new $this->mClass();
+			$obj->assignVars($row);
+			$obj->unsetNew();
+			
+			if ($id_as_key)	{
+				$ret[$obj->get($this->mPrimary)] =& $obj;
+			}
+			else {
+				$ret[]=&$obj;
+			}
 		
+			unset($obj);
+		}
+	
 		return $ret;
 	}
 	


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