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

アーカイブの一覧に戻る

Minahito minah****@users*****
2006年 2月 4日 (土) 18:06:52 JST


Index: xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php
diff -u xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php:1.1.2.1 xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php:1.1.2.2
--- xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php:1.1.2.1	Thu Jan 19 21:06:03 2006
+++ xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php	Sat Feb  4 18:06:52 2006
@@ -2,6 +2,7 @@
 
 require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php";
 require_once XOOPS_MODULE_PATH."/user/admin/class/XoopsGroupEx.class.php";
+require_once XOOPS_MODULE_PATH."/user/admin/forms/GroupMemberEditForm.class.php";
 
 /**
  *
@@ -22,11 +23,22 @@
 	 */
 	var $mNoUsers = array();
 	var $mNoPageNavi = null;
+	
+	var $mActionForm = null;
 
 	function isSecure()
 	{
 		return true;
 	}
+	
+	function prepare(&$controller, &$xoopsUser, $moduleConfig)
+	{
+		//
+		// TODO Because this action has two form, we should prepare two action forms.
+		//
+		$this->mActionForm =& new User_GroupMemberEditForm();
+		$this->mActionForm->prepare();
+	}
 
 	function getDefaultView(&$controller, &$xoopsUser)
 	{
@@ -74,17 +86,22 @@
 		if (!is_object($this->mGroup)) {
 			return USER_FRAME_VIEW_ERROR;
 		}
+		
+		$this->mActionForm->fetch();
+		$this->mActionForm->validate();
+		
+		if ($this->mActionForm->hasError()) {
+			return $this->getDefaultView($controller, $xoopsUser);
+		}
 
 		$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);
-				}
+		foreach($this->mActionForm->get('uid') as $uid => $value) {
+			if ($value==1) {
+				$memberHandler->addUserToGroup($this->mGroup->getVar('groupid'), $uid);
+			}
+			elseif ($value==2) {
+				$memberHandler->removeUserFromGroup($this->mGroup->getVar('groupid'), $uid);
 			}
 		}
 		
@@ -94,7 +111,7 @@
 	function _loadGroup()
 	{
 		if (!is_object($this->mGroup)) {
-			$groupId = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0;
+			$groupId = xoops_getrequest('groupid');
 
 			$groupHandler =& xoops_gethandler('group');
 			$group =& $groupHandler->get($groupId);
@@ -114,6 +131,8 @@
 
 		$render->setAttribute("noUsers",$this->mNoUsers);
 		$render->setAttribute("noPageNavi",$this->mNoPageNavi);
+		
+		$render->setAttribute("actionForm",$this->mActionForm);
 	}
 }
 


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