[xoops-cvslog 3153] CVS update: xoops2jp/html/modules/base/class

Back to archive index

Minahito minah****@users*****
2006年 5月 25日 (木) 18:31:35 JST


Index: xoops2jp/html/modules/base/class/imagecategory.php
diff -u xoops2jp/html/modules/base/class/imagecategory.php:1.1.2.2 xoops2jp/html/modules/base/class/imagecategory.php:1.1.2.3
--- xoops2jp/html/modules/base/class/imagecategory.php:1.1.2.2	Wed May 10 19:24:17 2006
+++ xoops2jp/html/modules/base/class/imagecategory.php	Thu May 25 18:31:34 2006
@@ -84,6 +84,23 @@
 		return $this->_mReadGroupsLoadedFlag;
 	}
 
+	/**
+	 * If $groups has the permission of reading this object, return true.
+	 */	
+	function hasReadPerm($groups)
+	{
+		$this->loadReadGroups();
+		foreach (array_keys($this->mReadGroups) as $key) {
+			foreach ($groups as $group) {
+				if ($this->mReadGroups[$key]->get('groupid') == $group) {
+					return true;
+				}
+			}
+		}
+		
+		return false;
+	}
+
 	function loadUploadGroups()
 	{
 		if ($this->_mUploadGroupsLoadedFlag) {
@@ -111,6 +128,20 @@
 	{
 		return $this->_mUploadGroupsLoadedFlag;
 	}
+
+	function hasUploadPerm($groups)
+	{
+		$this->loadUploadGroups();
+		foreach (array_keys($this->mUploadGroups) as $key) {
+			foreach ($groups as $group) {
+				if ($this->mUploadGroups[$key]->get('groupid') == $group) {
+					return true;
+				}
+			}
+		}
+		
+		return false;
+	}
 }
 
 class BaseImagecategoryHandler extends XoopsObjectGenericHandler
@@ -169,6 +200,27 @@
 		
 		return $returnFlag;
 	}
+	
+	function &getObjectsWithReadPerm($groups = array(), $display = null)
+	{
+		$criteria = new CriteriaCompo();
+		if ($display != null) {
+			$criteria->add(new Criteria('imgcat_display', $display));
+		}
+		$criteria->setSort('imgcat_weight');
+		$objs =& $this->getObjects($criteria);
+		unset($criteria);
+
+		$handler =& xoops_gethandler('groupperm');
+		$ret = array();
+		foreach (array_keys($objs) as $key) {
+			if ($objs[$key]->hasReadPerm($groups)) {
+				$ret[] =& $objs[$key];
+			}
+		}
+		
+		return $ret;
+	}
 
 	function delete(&$obj, $force = false)
 	{


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