Minahito
minah****@users*****
2006年 7月 13日 (木) 19:44:19 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.3 xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php:1.1.2.4 --- xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php:1.1.2.3 Tue Mar 28 22:31:14 2006 +++ xoops2jp/html/modules/user/admin/actions/GroupMemberAction.class.php Thu Jul 13 19:44:19 2006 @@ -1,17 +1,27 @@ <?php +/** + * @package user + * @version $Id: GroupMemberAction.class.php,v 1.1.2.4 2006/07/13 10:44:19 minahito Exp $ + */ if (!defined('XOOPS_ROOT_PATH')) exit(); 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"; +define ('USER_GROUPMEMBER_DEFAULT_PERPAGE', 5); + /** - * - * This function keeps difficult problems that this depens on the column's block of X2 theme format. + * This function keeps difficult problems that this depens on the column's + * block of X2 theme format. */ class User_GroupMemberAction extends User_Action { + /** + * Target group object + * + * @var UserGroupsObject + */ var $mGroup = null; /** @@ -28,11 +38,6 @@ var $mActionForm = null; - function isSecure() - { - return true; - } - function prepare(&$controller, &$xoopsUser, $moduleConfig) { // @@ -57,9 +62,9 @@ // $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 =& 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->setPerpage(USER_GROUPMEMBER_DEFAULT_PERPAGE); $this->mPageNavi->fetch(); @@ -73,7 +78,7 @@ $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->setPerpage(USER_GROUPMEMBER_DEFAULT_PERPAGE); $this->mNoPageNavi->fetch(); @@ -97,13 +102,18 @@ } $memberHandler =& xoops_gethandler('member'); + $userHandler =& xoops_getmodulehandler('users'); 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); + $user =& $userHandler->get($uid); + + if (is_object($user)) { + if ($value == 1) { + $memberHandler->addUserToGroup($this->mGroup->get('groupid'), $uid); + } + elseif ($value == 2) { + $memberHandler->removeUserFromGroup($this->mGroup->get('groupid'), $uid); + } } } @@ -113,28 +123,25 @@ function _loadGroup() { if (!is_object($this->mGroup)) { - $groupId = xoops_getrequest('groupid'); + $id = xoops_getrequest('groupid'); - $groupHandler =& xoops_gethandler('group'); - $group =& $groupHandler->get($groupId); - if (is_object($group)) { - $this->mGroup =& new XoopsGroupEx($group); - } + $handler =& xoops_getmodulehandler('groups'); + $this->mGroup =& $handler->get($id); } } function executeViewIndex(&$controller, &$xoopsUser, &$render) { $render->setTemplateName("group_member.html"); - $render->setAttribute("group",$this->mGroup); + $render->setAttribute("group", $this->mGroup); - $render->setAttribute("users",$this->mUsers); - $render->setAttribute("pageNavi",$this->mPageNavi); + $render->setAttribute("users", $this->mUsers); + $render->setAttribute("pageNavi", $this->mPageNavi); - $render->setAttribute("noUsers",$this->mNoUsers); - $render->setAttribute("noPageNavi",$this->mNoPageNavi); + $render->setAttribute("noUsers", $this->mNoUsers); + $render->setAttribute("noPageNavi", $this->mNoPageNavi); - $render->setAttribute("actionForm",$this->mActionForm); + $render->setAttribute("actionForm", $this->mActionForm); } }