Minahito
minah****@users*****
2005年 12月 22日 (木) 20:24:47 JST
Index: xoops2jp/html/modules/user/admin/actions/UserGroupDeleteAction.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/actions/UserGroupDeleteAction.class.php:1.1.2.1 --- /dev/null Thu Dec 22 20:24:47 2005 +++ xoops2jp/html/modules/user/admin/actions/UserGroupDeleteAction.class.php Thu Dec 22 20:24:47 2005 @@ -0,0 +1,42 @@ +<?php + +require_once XOOPS_MODULE_PATH . "/user/class/AbstractDeleteAction.class.php"; + +class UserGroupDeleteAction extends User_AbstractDeleteAction +{ + function &getHandler() + { + $handler =& xoops_gethandler('group'); + return $handler; + } + + function getId() + { + $id = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0; + + // KICK + if ($id <= XOOPS_GROUP_ANONYMOUS) + $id = 0; + + return $id; + } + + function executeViewInput(&$controller, &$xoopsUser, &$renderSystem) + { + $renderSystem->setTemplateName("group_delete_confirm.html"); + $renderSystem->setAttribute("group", $this->mObject); + } + + function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("?action=GroupList",1,"*SUCCESS*"); + } + + function executeViewError(&$controller, &$xoopsUser, &$renderSystem) + { + XCube_Utils::redirectHeader("?action=GroupList", 1, "*DELETE ERROR*"); + } + +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php:1.1.2.1 --- /dev/null Thu Dec 22 20:24:47 2005 +++ xoops2jp/html/modules/user/admin/actions/UserGroupPermAction.class.php Thu Dec 22 20:24:47 2005 @@ -0,0 +1,98 @@ +<?php + +require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php"; +require_once XOOPS_MODULE_PATH."/user/admin/class/Permission.class.php"; + +class UserGroupPermAction extends UserAction +{ + var $mGroup; + var $mPermissions; + var $mBlockPermissions; + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + $groupId = isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0; + + $groupHandler =& xoops_gethandler('group'); + $this->mGroup =& $groupHandler->get($groupId); + + if (!is_object($this->mGroup)) { + return USER_FRAME_VIEW_ERROR; + } + + $gpermHandler =& xoops_gethandler('groupperm'); + $criteria =& new CriteriaCompo(); + $criteria->add(new Criteria('gperm_groupid', $this->mGroup->getVar('groupid'))); + $criteria->add(new Criteria('gperm_modid', 1)); +// $this->mPermissions =& $gpermHandler->getObjects($criteria); + + // + // W [XgðÐÁÏé¶å + // + $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); + } + + // + // ubNðøÁ£é¶å + // + 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->getAllBlocksByGroup($this->mGroup->getVar('groupid'), true, $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 executeViewIndex(&$controller,&$xoopsUser,&$render) + { + $render->setTemplateName("group_perm.html"); + $render->setAttribute("group",$this->mGroup); + $render->setAttribute("modulePermissions",$this->mPermissions); + $render->setAttribute("blockPermissions",$this->mBlockPermissions); + + $moduleOptions = array ( + USER_PERMISSION_NONE => "*NONE*", + USER_PERMISSION_READ => "*READ*", + USER_PERMISSION_ADMIN => "*ADMIN*", + USER_PERMISSION_READ | USER_PERMISSION_ADMIN => "*ADMIN/READ*" + ); + + $render->setAttribute("moduleOptions", $moduleOptions); + + $blockOptions = array ( + USER_PERMISSION_NONE => "*NONE*", + USER_PERMISSION_READ => "*READ*" + ); + + $render->setAttribute("blockOptions", $blockOptions); + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/user/admin/actions/UserGroupEditAction.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/actions/UserGroupEditAction.class.php:1.1.2.1 --- /dev/null Thu Dec 22 20:24:47 2005 +++ xoops2jp/html/modules/user/admin/actions/UserGroupEditAction.class.php Thu Dec 22 20:24:47 2005 @@ -0,0 +1,81 @@ +<?php + +require_once XOOPS_ROOT_PATH."/modules/user/admin/forms/GroupEditForm.class.php"; + +class UserGroupEditAction extends UserAction +{ + var $mGroup = null; + var $mGroupHandler = null; + var $mActionForm=null; + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + $this->_proccessActionForm(); + $this->_proccessObject($controller); + + $this->mActionForm->load($this->mGroup); + + return USER_FRAME_VIEW_INPUT; + } + + function execute(&$controller,&$xoopsUser) + { + $this->_proccessActionForm(); + $this->_proccessObject($controller); + + // + // If image is no, the data has to continue to keep his value. + // + $this->mActionForm->load($this->mGroup); + + $this->mActionForm->fetch(); + $this->mActionForm->validate(); + + if($this->mActionForm->hasError()) + return USER_FRAME_VIEW_INPUT; + + $this->mActionForm->update($this->mGroup); + + return $this->mGroupHandler->insert($this->mGroup) ? USER_FRAME_VIEW_SUCCESS + : USER_FRAME_VIEW_ERROR; + } + + function _proccessObject(&$controller) + { + $groupId=isset($_REQUEST['groupid']) ? intval($_REQUEST['groupid']) : 0; + $this->mGroupHandler =& xoops_gethandler('group'); + $this->mGroup =& $this->mGroupHandler->get($groupId); + if (!is_object($this->mGroup)) { + $this->mGroup =& $this->mGroupHandler->create(); + } + } + + function _proccessActionForm() + { + $this->mActionForm =& new User_GroupEditForm(); + $this->mActionForm->prepare(); + } + + function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) + { + $renderSystem->setTemplateName("group_edit.html"); + $renderSystem->setAttribute("actionForm",$this->mActionForm); + } + + function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("index.php?action=GroupList", 1, "*SUCCESS*"); + } + + function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + { + XCube_Utils::redirectHeader("index.php?action=GroupList", 1, "*ERROR*"); + } +} + +?> \ No newline at end of file Index: xoops2jp/html/modules/user/admin/actions/UserGroupListAction.class.php diff -u /dev/null xoops2jp/html/modules/user/admin/actions/UserGroupListAction.class.php:1.1.2.1 --- /dev/null Thu Dec 22 20:24:47 2005 +++ xoops2jp/html/modules/user/admin/actions/UserGroupListAction.class.php Thu Dec 22 20:24:47 2005 @@ -0,0 +1,65 @@ +<?php + +require_once XOOPS_ROOT_PATH."/class/XCube_PageNavigator.class.php"; +require_once XOOPS_ROOT_PATH."/modules/user/admin/forms/UserActionFilterForm.class.php"; + +/** + * This extends XoopsGroup to that user group list can get count of users. + */ +class XoopsGroupEx extends XoopsGroup +{ + /** + * $group is used for initialize. This class is no adapter pattern. + * @param $group XoopsGroup + */ + function XoopsGroupEx($group = null) + { + parent::XoopsGroup(); + $this->initVar('user_count', XOBJ_DTYPE_INT, null, false); + + $this->setVar('groupid', $group->getVar('groupid')); + $this->setVar('name', $group->getVar('name')); + $this->setVar('description', $group->getVar('description')); + $this->setVar('group_type', $group->getVar('group_type')); + + if (is_object($group)) { + $memberHandler =& xoops_gethandler('member'); + + $this->setVar('user_count', $memberHandler->getUserCountByGroup($this->getVar('groupid'))); + } + } +} + +class UserGroupListAction extends UserAction +{ + var $mGroupObjects = array(); + var $mUserCount = array(); + + function isSecure() + { + return true; + } + + function getDefaultView(&$controller,&$xoopsUser) + { + $groupHandler =& xoops_gethandler('group'); + $this->mGroupObjects =& $groupHandler->getObjects(); + + + return USER_FRAME_VIEW_INDEX; + } + + function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) + { + $groups = array(); + foreach ($this->mGroupObjects as $_group) { + $groups[] =& new XoopsGroupEx($_group); + } + + $renderSystem->setTemplateName("group_list.html"); + $renderSystem->setAttribute("groups", $groups); + // $renderSystem->setAttribute("pageNavi",$this->mPageNavi); + } +} + +?> \ No newline at end of file