[xoops-cvslog 1847] CVS update: xoops2jp/html/modules/user/admin/actions

Back to archive index

Minahito minah****@users*****
2006年 1月 19日 (木) 21:06:03 JST


Index: xoops2jp/html/modules/user/admin/actions/UserGroupMemberAction.class.php
diff -u xoops2jp/html/modules/user/admin/actions/UserGroupMemberAction.class.php:1.1.2.1 xoops2jp/html/modules/user/admin/actions/UserGroupMemberAction.class.php:removed
--- xoops2jp/html/modules/user/admin/actions/UserGroupMemberAction.class.php:1.1.2.1	Sun Dec 25 19:53:54 2005
+++ xoops2jp/html/modules/user/admin/actions/UserGroupMemberAction.class.php	Thu Jan 19 21:06:03 2006
@@ -1,120 +0,0 @@
-<?php
-
-require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php";
-require_once XOOPS_MODULE_PATH."/user/admin/class/XoopsGroupEx.class.php";
-
-/**
- *
- * This function keeps difficult problems that this depens on the column's block of X2 theme format.
- */
-class UserGroupMemberAction extends UserAction
-{
-	var $mGroup = null;
-	
-	/**
-	 * group member list.
-	 */
-	var $mUsers = array();
-	var $mPageNavi = null;
-
-	/**
-	 * No group member list.
-	 */
-	var $mNoUsers = array();
-	var $mNoPageNavi = null;
-
-	function isSecure()
-	{
-		return true;
-	}
-
-	function getDefaultView(&$controller, &$xoopsUser)
-	{
-		$this->_loadGroup();
-		if (!is_object($this->mGroup)) {
-			return USER_FRAME_VIEW_ERROR;
-		}
-
-		$memberHandler =& xoops_gethandler('member');
-		$groupid = $this->mGroup->getVar('groupid');
-
-		//
-		// Get member list
-		//
-		$total = $memberHandler->getUserCountByGroup($groupid);
-
-		$this->mPageNavi=new XCube_PageNavigator("./index.php?action=GroupMember", $total, XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);	// TODO get controller->getUrl() ?
-		$this->mPageNavi->addExtra('groupid', $groupid);
-		$this->mPageNavi->setPerpage(5);
-
-		$this->mPageNavi->fetch();
-		
-		$this->mUsers =& $memberHandler->getUsersByGroup($groupid, true, $this->mPageNavi->getPerpage(), $this->mPageNavi->getStart());
-
-		//
-		// Get no member list
-		//
-		$total = $memberHandler->getUserCountByNoGroup($groupid);
-
-		$this->mNoPageNavi=new XCube_PageNavigator("./index.php?action=GroupMember", $total, XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);	// TODO get controller->getUrl() ?
-		$this->mNoPageNavi->addExtra('groupid', $groupid);
-		$this->mNoPageNavi->setPrefix("no");
-		$this->mNoPageNavi->setPerpage(5);
-
-		$this->mNoPageNavi->fetch();
-		
-		$this->mNoUsers =& $memberHandler->getUsersByNoGroup($groupid, true, $this->mNoPageNavi->getPerpage(), $this->mNoPageNavi->getStart());
-
-		return USER_FRAME_VIEW_INDEX;
-	}
-
-	function execute(&$controller, &$xoopsUser)
-	{
-		$this->_loadGroup();
-		if (!is_object($this->mGroup)) {
-			return USER_FRAME_VIEW_ERROR;
-		}
-
-		$memberHandler =& xoops_gethandler('member');
-		
-		if (isset($_POST['uid']) && is_array($_POST['uid'])) {
-			foreach($_POST['uid'] as $uid => $value) {
-				if ($value==1) {
-					$memberHandler->addUserToGroup($this->mGroup->getVar('groupid'), $uid);
-				}
-				elseif ($value==2) {
-					$memberHandler->removeUserFromGroup($this->mGroup->getVar('groupid'), $uid);
-				}
-			}
-		}
-		
-		return $this->getDefaultView($controller, $xoopsUser);
-	}
-
-	function _loadGroup()
-	{
-		if (!is_object($this->mGroup)) {
-			$groupId = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0;
-
-			$groupHandler =& xoops_gethandler('group');
-			$group =& $groupHandler->get($groupId);
-			if (is_object($group)) {
-				$this->mGroup =& new XoopsGroupEx($group);
-			}
-		}
-	}
-
-	function executeViewIndex(&$controller, &$xoopsUser, &$render)
-	{
-		$render->setTemplateName("group_member.html");
-		$render->setAttribute("group",$this->mGroup);
-
-		$render->setAttribute("users",$this->mUsers);
-		$render->setAttribute("pageNavi",$this->mPageNavi);
-
-		$render->setAttribute("noUsers",$this->mNoUsers);
-		$render->setAttribute("noPageNavi",$this->mNoPageNavi);
-	}
-}
-
-?>
\ No newline at end of file
Index: xoops2jp/html/modules/user/admin/actions/GroupPropertyAction.class.php
diff -u /dev/null xoops2jp/html/modules/user/admin/actions/GroupPropertyAction.class.php:1.1.2.1
--- /dev/null	Thu Jan 19 21:06:03 2006
+++ xoops2jp/html/modules/user/admin/actions/GroupPropertyAction.class.php	Thu Jan 19 21:06:03 2006
@@ -0,0 +1,129 @@
+<?php
+
+require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php";
+require_once XOOPS_MODULE_PATH."/user/admin/class/Permission.class.php";
+require_once XOOPS_MODULE_PATH."/user/admin/class/XoopsGroupEx.class.php";
+
+/**
+ *
+ * This function keeps difficult problems that this depens on the column's block of X2 theme format.
+ */
+class User_GroupPropertyAction extends User_Action
+{
+	var $mGroup;
+	var $mPermissions;
+	var $mSystemPermissions;
+	var $mBlockPermissions;
+	
+	var $mUsers;
+	var $mPageNavi;
+
+	function isSecure()
+	{
+		return true;
+	}
+
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$this->_loadGroup();
+
+		if (!is_object($this->mGroup)) {
+			return USER_FRAME_VIEW_ERROR;
+		}
+
+		$root =& XCube_Root::getSingleton();
+		$root->mLanguageManager->loadModuleAdminLanguage("system");
+		$root->mLanguageManager->loadManifestoLanguage("system");
+
+		//
+		// Get member list
+		//
+		$memberHandler =& xoops_gethandler('member');
+
+		$total = $memberHandler->getUserCountByGroup($this->mGroup->getVar('groupid'));
+		$this->mPageNavi=new XCube_PageNavigator("./index.php?action=RankList",$total,XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);	// TODO get controller->getUrl() ?
+
+		$this->mPageNavi->fetch();
+		
+		$this->mUsers =& $memberHandler->getUsersByGroup($this->mGroup->getVar('groupid'), true, $this->mPageNavi->getPerPage(), $this->mPageNavi->getStart());
+
+		//
+		// Get...
+		//
+		require_once XOOPS_ROOT_PATH . "/modules/system/constants.php";
+		$fileHandler = opendir(XOOPS_ROOT_PATH . "/modules/system/admin");
+		while ($file = readdir($fileHandler)) {
+			$infoFile = XOOPS_ROOT_PATH . "/modules/system/admin/" . $file . "/xoops_version.php";
+			if (file_exists($infoFile)) {
+				require_once $infoFile;
+				if (!empty($modversion['category'])) {
+					$item =& new User_PermissionSystemAdminItem($modversion['category'], $modversion['name']);
+					$this->mSystemPermissions[] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+
+					unset($item);
+				}
+				unset($modversion);
+			}
+		}
+
+		//
+		// Get module list
+		//
+		$moduleHandler =& xoops_gethandler('module');
+		$modules =& $moduleHandler->getObjects();
+		
+		foreach ($modules as $module) {
+			$item =& new User_PermissionModuleItem($module);
+			$this->mPermissions[] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+
+			unset($module);
+			unset($item);
+		}
+
+		//
+		// Get block list
+		//
+		require_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
+
+		$blockHandler = new XoopsBlock();
+		
+		$idx = 0;
+		foreach (array(0, 1, 3, 4, 5) as $side) {
+			$this->mBlockPermissions[$idx] = array();
+			$blocks =& $blockHandler->getAllBlocks("object", $side, null);
+
+			foreach ($blocks as $block) {
+				$item =& new User_PermissionBlockItem($block);
+				$this->mBlockPermissions[$idx][] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+
+				unset($block);
+			}
+			
+			$idx++;
+		}
+
+		return USER_FRAME_VIEW_INDEX;
+	}
+
+	function _loadGroup()
+	{
+		$groupId = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0;
+
+		$groupHandler =& xoops_gethandler('group');
+		$group =& $groupHandler->get($groupId);
+		$this->mGroup =& new XoopsGroupEx($group);
+	}
+
+	function executeViewIndex(&$controller,&$xoopsUser,&$render)
+	{
+		$render->setTemplateName("group_property.html");
+		$render->setAttribute("group",$this->mGroup);
+		$render->setAttribute("modulePermissions",$this->mPermissions);
+		$render->setAttribute("blockPermissions",$this->mBlockPermissions);
+		$render->setAttribute("systemPermissions",$this->mSystemPermissions);
+		$render->setAttribute("users",$this->mUsers);
+		$render->setAttribute("pageNavi",$this->mPageNavi);
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/modules/user/admin/actions/GroupPermAction.class.php
diff -u /dev/null xoops2jp/html/modules/user/admin/actions/GroupPermAction.class.php:1.1.2.1
--- /dev/null	Thu Jan 19 21:06:03 2006
+++ xoops2jp/html/modules/user/admin/actions/GroupPermAction.class.php	Thu Jan 19 21:06:03 2006
@@ -0,0 +1,114 @@
+<?php
+
+require_once XOOPS_MODULE_PATH."/user/admin/actions/GroupPropertyAction.class.php";
+
+/**
+ *
+ * This function keeps difficult problems that this depens on the column's block of X2 theme format.
+ */
+class User_GroupPermAction extends User_GroupPropertyAction
+{
+	/**
+	 * This function don't use actionform, now.
+	 * I (minahito) must remove code-clone.
+	 */
+	function execute(&$controller, &$xoopsUser)
+	{
+		$this->_loadGroup();
+
+		if (!is_object($this->mGroup)) {
+			return USER_FRAME_VIEW_ERROR;
+		}
+
+		//
+		// Reset group permission
+		//
+		$gpermHandler =& xoops_gethandler('groupperm');
+		$gpermHandler->deleteBasicPermission($this->mGroup->getVar('groupid'));
+		
+		if (isset($_POST['system']) && is_array($_POST['system'])) {
+			foreach ($_POST['system'] as $sid => $value)
+			{
+				$item =& new User_PermissionSystemAdminItem($sid, null);
+				$perm =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+			
+				$perm->save();
+
+				unset($perm);
+			}
+		}
+		
+		$moduleHandler =& xoops_gethandler('module');
+		$modPerms = array();
+
+		if (isset($_POST['module']) && is_array($_POST['module'])) {
+			foreach ($_POST['module'] as $mid => $value)
+			{
+				$module =& $moduleHandler->get($mid);
+				if (is_object($module)) {
+					$item =& new User_PermissionModuleItem($module);
+					$modPerms[$mid] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+
+					if (isset($_POST['module_admin']) && isset($_POST['module_admin'][$mid])) {
+						$value |= $_POST['module_admin'][$mid];
+					}
+
+					$modPerms[$mid]->setValue($value);
+					
+					$modPerms[$mid]->save();
+				}
+			}
+		}
+
+		if (isset($_POST['module_admin']) && is_array($_POST['module_admin'])) {
+			foreach ($_POST['module_admin'] as $mid => $value)
+			{
+				$module =& $moduleHandler->get($mid);
+				if (is_object($module)) {
+					if (!isset($modPerms[$mid])) {
+						$item =& new User_PermissionModuleItem($module);
+						$modPerms[$mid] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+						$modPerms[$mid]->setValue($value);
+
+						$modPerms[$mid]->save();
+					}
+				}
+			}
+		}
+
+		$blockHandler =& xoops_gethandler('block');
+
+		if (isset($_POST['block']) && is_array($_POST['block'])) {
+			foreach ($_POST['block'] as $bid => $value)
+			{
+				$block =& $blockHandler->get($bid);
+				if (is_object($block)) {
+					$item =& new User_PermissionBlockItem($block);
+					$perm =& new User_Permission($this->mGroup->getVar('groupid'), $item);
+					$perm->setValue($value);
+					$perm->save();
+					
+					unset($perm);
+				}
+			}
+		}
+		
+		return USER_FRAME_VIEW_SUCCESS;
+	}
+	
+	function executeViewIndex(&$controller,&$xoopsUser,&$render)
+	{
+		$render->setTemplateName("group_perm.html");
+		$render->setAttribute("group",$this->mGroup);
+		$render->setAttribute("modulePermissions",$this->mPermissions);
+		$render->setAttribute("blockPermissions",$this->mBlockPermissions);
+		$render->setAttribute("systemPermissions",$this->mSystemPermissions);
+	}
+
+	function executeViewSuccess(&$controller,&$xoopsUser,&$render)
+	{
+		XCube_Utils::redirectHeader("index.php?action=GroupPerm&amp;groupid=" . $this->mGroup->getVar('groupid'), 1, "*SUCCESS*");
+	}
+}
+
+?>
\ No newline at end of file
Index: xoops2jp/html/modules/user/admin/actions/UserGroupPropertyAction.class.php
diff -u xoops2jp/html/modules/user/admin/actions/UserGroupPropertyAction.class.php:1.1.2.1 xoops2jp/html/modules/user/admin/actions/UserGroupPropertyAction.class.php:removed
--- xoops2jp/html/modules/user/admin/actions/UserGroupPropertyAction.class.php:1.1.2.1	Sun Dec 25 19:54:43 2005
+++ xoops2jp/html/modules/user/admin/actions/UserGroupPropertyAction.class.php	Thu Jan 19 21:06:03 2006
@@ -1,129 +0,0 @@
-<?php
-
-require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php";
-require_once XOOPS_MODULE_PATH."/user/admin/class/Permission.class.php";
-require_once XOOPS_MODULE_PATH."/user/admin/class/XoopsGroupEx.class.php";
-
-/**
- *
- * This function keeps difficult problems that this depens on the column's block of X2 theme format.
- */
-class UserGroupPropertyAction extends UserAction
-{
-	var $mGroup;
-	var $mPermissions;
-	var $mSystemPermissions;
-	var $mBlockPermissions;
-	
-	var $mUsers;
-	var $mPageNavi;
-
-	function isSecure()
-	{
-		return true;
-	}
-
-	function getDefaultView(&$controller, &$xoopsUser)
-	{
-		$this->_loadGroup();
-
-		if (!is_object($this->mGroup)) {
-			return USER_FRAME_VIEW_ERROR;
-		}
-
-		$root =& XCube_Root::getSingleton();
-		$root->mLanguageManager->loadModuleAdminLanguage("system");
-		$root->mLanguageManager->loadManifestoLanguage("system");
-
-		//
-		// Get member list
-		//
-		$memberHandler =& xoops_gethandler('member');
-
-		$total = $memberHandler->getUserCountByGroup($this->mGroup->getVar('groupid'));
-		$this->mPageNavi=new XCube_PageNavigator("./index.php?action=RankList",$total,XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);	// TODO get controller->getUrl() ?
-
-		$this->mPageNavi->fetch();
-		
-		$this->mUsers =& $memberHandler->getUsersByGroup($this->mGroup->getVar('groupid'), true, $this->mPageNavi->getPerPage(), $this->mPageNavi->getStart());
-
-		//
-		// Get...
-		//
-		require_once XOOPS_ROOT_PATH . "/modules/system/constants.php";
-		$fileHandler = opendir(XOOPS_ROOT_PATH . "/modules/system/admin");
-		while ($file = readdir($fileHandler)) {
-			$infoFile = XOOPS_ROOT_PATH . "/modules/system/admin/" . $file . "/xoops_version.php";
-			if (file_exists($infoFile)) {
-				require_once $infoFile;
-				if (!empty($modversion['category'])) {
-					$item =& new User_PermissionSystemAdminItem($modversion['category'], $modversion['name']);
-					$this->mSystemPermissions[] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-
-					unset($item);
-				}
-				unset($modversion);
-			}
-		}
-
-		//
-		// Get module list
-		//
-		$moduleHandler =& xoops_gethandler('module');
-		$modules =& $moduleHandler->getObjects();
-		
-		foreach ($modules as $module) {
-			$item =& new User_PermissionModuleItem($module);
-			$this->mPermissions[] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-
-			unset($module);
-			unset($item);
-		}
-
-		//
-		// Get block list
-		//
-		require_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
-
-		$blockHandler = new XoopsBlock();
-		
-		$idx = 0;
-		foreach (array(0, 1, 3, 4, 5) as $side) {
-			$this->mBlockPermissions[$idx] = array();
-			$blocks =& $blockHandler->getAllBlocks("object", $side, null);
-
-			foreach ($blocks as $block) {
-				$item =& new User_PermissionBlockItem($block);
-				$this->mBlockPermissions[$idx][] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-
-				unset($block);
-			}
-			
-			$idx++;
-		}
-
-		return USER_FRAME_VIEW_INDEX;
-	}
-
-	function _loadGroup()
-	{
-		$groupId = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0;
-
-		$groupHandler =& xoops_gethandler('group');
-		$group =& $groupHandler->get($groupId);
-		$this->mGroup =& new XoopsGroupEx($group);
-	}
-
-	function executeViewIndex(&$controller,&$xoopsUser,&$render)
-	{
-		$render->setTemplateName("group_property.html");
-		$render->setAttribute("group",$this->mGroup);
-		$render->setAttribute("modulePermissions",$this->mPermissions);
-		$render->setAttribute("blockPermissions",$this->mBlockPermissions);
-		$render->setAttribute("systemPermissions",$this->mSystemPermissions);
-		$render->setAttribute("users",$this->mUsers);
-		$render->setAttribute("pageNavi",$this->mPageNavi);
-	}
-}
-
-?>
\ No newline at end of file
Index: xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php
diff -u xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php:1.1.2.5 xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php:removed
--- xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php:1.1.2.5	Sun Dec 25 19:54:27 2005
+++ xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php	Thu Jan 19 21:06:03 2006
@@ -1,114 +0,0 @@
-<?php
-
-require_once XOOPS_MODULE_PATH."/user/admin/actions/UserGroupPropertyAction.class.php";
-
-/**
- *
- * This function keeps difficult problems that this depens on the column's block of X2 theme format.
- */
-class UserGroupPermAction extends UserGroupPropertyAction
-{
-	/**
-	 * This function don't use actionform, now.
-	 * I (minahito) must remove code-clone.
-	 */
-	function execute(&$controller, &$xoopsUser)
-	{
-		$this->_loadGroup();
-
-		if (!is_object($this->mGroup)) {
-			return USER_FRAME_VIEW_ERROR;
-		}
-
-		//
-		// Reset group permission
-		//
-		$gpermHandler =& xoops_gethandler('groupperm');
-		$gpermHandler->deleteBasicPermission($this->mGroup->getVar('groupid'));
-		
-		if (isset($_POST['system']) && is_array($_POST['system'])) {
-			foreach ($_POST['system'] as $sid => $value)
-			{
-				$item =& new User_PermissionSystemAdminItem($sid, null);
-				$perm =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-			
-				$perm->save();
-
-				unset($perm);
-			}
-		}
-		
-		$moduleHandler =& xoops_gethandler('module');
-		$modPerms = array();
-
-		if (isset($_POST['module']) && is_array($_POST['module'])) {
-			foreach ($_POST['module'] as $mid => $value)
-			{
-				$module =& $moduleHandler->get($mid);
-				if (is_object($module)) {
-					$item =& new User_PermissionModuleItem($module);
-					$modPerms[$mid] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-
-					if (isset($_POST['module_admin']) && isset($_POST['module_admin'][$mid])) {
-						$value |= $_POST['module_admin'][$mid];
-					}
-
-					$modPerms[$mid]->setValue($value);
-					
-					$modPerms[$mid]->save();
-				}
-			}
-		}
-
-		if (isset($_POST['module_admin']) && is_array($_POST['module_admin'])) {
-			foreach ($_POST['module_admin'] as $mid => $value)
-			{
-				$module =& $moduleHandler->get($mid);
-				if (is_object($module)) {
-					if (!isset($modPerms[$mid])) {
-						$item =& new User_PermissionModuleItem($module);
-						$modPerms[$mid] =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-						$modPerms[$mid]->setValue($value);
-
-						$modPerms[$mid]->save();
-					}
-				}
-			}
-		}
-
-		$blockHandler =& xoops_gethandler('block');
-
-		if (isset($_POST['block']) && is_array($_POST['block'])) {
-			foreach ($_POST['block'] as $bid => $value)
-			{
-				$block =& $blockHandler->get($bid);
-				if (is_object($block)) {
-					$item =& new User_PermissionBlockItem($block);
-					$perm =& new User_Permission($this->mGroup->getVar('groupid'), $item);
-					$perm->setValue($value);
-					$perm->save();
-					
-					unset($perm);
-				}
-			}
-		}
-		
-		return USER_FRAME_VIEW_SUCCESS;
-	}
-	
-	function executeViewIndex(&$controller,&$xoopsUser,&$render)
-	{
-		$render->setTemplateName("group_perm.html");
-		$render->setAttribute("group",$this->mGroup);
-		$render->setAttribute("modulePermissions",$this->mPermissions);
-		$render->setAttribute("blockPermissions",$this->mBlockPermissions);
-		$render->setAttribute("systemPermissions",$this->mSystemPermissions);
-	}
-
-	function executeViewSuccess(&$controller,&$xoopsUser,&$render)
-	{
-		XCube_Utils::redirectHeader("index.php?action=GroupPerm&amp;groupid=" . $this->mGroup->getVar('groupid'), 1, "*SUCCESS*");
-	}
-}
-
-?>
\ No newline at end of file
Index: xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php
diff -u /dev/null xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php:1.1.2.1
--- /dev/null	Thu Jan 19 21:06:03 2006
+++ xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php	Thu Jan 19 21:06:03 2006
@@ -0,0 +1,120 @@
+<?php
+
+require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php";
+require_once XOOPS_MODULE_PATH."/user/admin/class/XoopsGroupEx.class.php";
+
+/**
+ *
+ * This function keeps difficult problems that this depens on the column's block of X2 theme format.
+ */
+class User_GroupMemberAction extends User_Action
+{
+	var $mGroup = null;
+	
+	/**
+	 * group member list.
+	 */
+	var $mUsers = array();
+	var $mPageNavi = null;
+
+	/**
+	 * No group member list.
+	 */
+	var $mNoUsers = array();
+	var $mNoPageNavi = null;
+
+	function isSecure()
+	{
+		return true;
+	}
+
+	function getDefaultView(&$controller, &$xoopsUser)
+	{
+		$this->_loadGroup();
+		if (!is_object($this->mGroup)) {
+			return USER_FRAME_VIEW_ERROR;
+		}
+
+		$memberHandler =& xoops_gethandler('member');
+		$groupid = $this->mGroup->getVar('groupid');
+
+		//
+		// Get member list
+		//
+		$total = $memberHandler->getUserCountByGroup($groupid);
+
+		$this->mPageNavi=new XCube_PageNavigator("./index.php?action=GroupMember", $total, XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);	// TODO get controller->getUrl() ?
+		$this->mPageNavi->addExtra('groupid', $groupid);
+		$this->mPageNavi->setPerpage(5);
+
+		$this->mPageNavi->fetch();
+		
+		$this->mUsers =& $memberHandler->getUsersByGroup($groupid, true, $this->mPageNavi->getPerpage(), $this->mPageNavi->getStart());
+
+		//
+		// Get no member list
+		//
+		$total = $memberHandler->getUserCountByNoGroup($groupid);
+
+		$this->mNoPageNavi=new XCube_PageNavigator("./index.php?action=GroupMember", $total, XCUBE_PAGENAVI_START | XCUBE_PAGENAVI_PERPAGE);	// TODO get controller->getUrl() ?
+		$this->mNoPageNavi->addExtra('groupid', $groupid);
+		$this->mNoPageNavi->setPrefix("no");
+		$this->mNoPageNavi->setPerpage(5);
+
+		$this->mNoPageNavi->fetch();
+		
+		$this->mNoUsers =& $memberHandler->getUsersByNoGroup($groupid, true, $this->mNoPageNavi->getPerpage(), $this->mNoPageNavi->getStart());
+
+		return USER_FRAME_VIEW_INDEX;
+	}
+
+	function execute(&$controller, &$xoopsUser)
+	{
+		$this->_loadGroup();
+		if (!is_object($this->mGroup)) {
+			return USER_FRAME_VIEW_ERROR;
+		}
+
+		$memberHandler =& xoops_gethandler('member');
+		
+		if (isset($_POST['uid']) && is_array($_POST['uid'])) {
+			foreach($_POST['uid'] as $uid => $value) {
+				if ($value==1) {
+					$memberHandler->addUserToGroup($this->mGroup->getVar('groupid'), $uid);
+				}
+				elseif ($value==2) {
+					$memberHandler->removeUserFromGroup($this->mGroup->getVar('groupid'), $uid);
+				}
+			}
+		}
+		
+		return $this->getDefaultView($controller, $xoopsUser);
+	}
+
+	function _loadGroup()
+	{
+		if (!is_object($this->mGroup)) {
+			$groupId = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0;
+
+			$groupHandler =& xoops_gethandler('group');
+			$group =& $groupHandler->get($groupId);
+			if (is_object($group)) {
+				$this->mGroup =& new XoopsGroupEx($group);
+			}
+		}
+	}
+
+	function executeViewIndex(&$controller, &$xoopsUser, &$render)
+	{
+		$render->setTemplateName("group_member.html");
+		$render->setAttribute("group",$this->mGroup);
+
+		$render->setAttribute("users",$this->mUsers);
+		$render->setAttribute("pageNavi",$this->mPageNavi);
+
+		$render->setAttribute("noUsers",$this->mNoUsers);
+		$render->setAttribute("noPageNavi",$this->mNoPageNavi);
+	}
+}
+
+?>
\ No newline at end of file


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