[xoops-cvslog 2903] CVS update: xoops2jp/html/modules/user/class

Back to archive index

Minahito minah****@users*****
2006年 4月 27日 (木) 19:26:39 JST


Index: xoops2jp/html/modules/user/class/users.php
diff -u xoops2jp/html/modules/user/class/users.php:1.1.2.2 xoops2jp/html/modules/user/class/users.php:1.1.2.3
--- xoops2jp/html/modules/user/class/users.php:1.1.2.2	Tue Mar 28 22:32:03 2006
+++ xoops2jp/html/modules/user/class/users.php	Thu Apr 27 19:26:39 2006
@@ -74,6 +74,56 @@
 			}
 		}
 	}
+
+	/**
+	 * Return the array which consists of an integer as the uid. This member function is more speedy than getObjects().
+	 * @return Array
+	 */
+	function &getUids($criteria = null, $param1 = false, $param2 = false, $param3 = false)
+	{
+		$ret = array();
+
+		$sql = "SELECT uid FROM " . $this->mTable;
+		
+		$limit = 0;
+		$start = 0;
+
+		if($criteria !== null && is_a($criteria, 'CriteriaElement')) {
+			$where = $this->_makeCriteria4sql($criteria);
+			
+			if (trim($where)) {
+				$sql .= " WHERE ".$where;
+			}
+			
+			$sorts = array();
+			foreach ($criteria->getSorts() as $sort) {
+				$sorts[] = $sort['sort'] . ' ' . $sort['order'];
+			}
+			if ($criteria->getSort() != '') {
+				$sql .= " ORDER BY " . implode(',', $sorts);
+			}
+			
+			$limit=$criteria->getLimit();
+			$start=$criteria->getStart();
+			
+			$ret =& $this->_getObjects($sql, $limit, $start, $param1);
+		}
+		else {
+			$limit = $param1;
+			$start = $param2;
+		}
+		
+		$result = $this->db->query($sql, $limit, $start);
+		if (!$result) {
+			return $ret;
+		}
+		
+		while ($row = $this->db->fetchArray($result)) {
+			$ret[] = $row['uid'];
+		}
+		
+		return $ret;
+	}
 	
 	function insert(&$user, $force = false)
 	{


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