22 public $mActionForm =
null;
24 public function prepare(&$controller, &$xoopsUser, $moduleConfig)
27 $this->mActionForm->prepare();
30 public function execute(&$controller, &$xoopsUser)
34 if (!is_object($this->mGroup)) {
35 return USER_FRAME_VIEW_ERROR;
38 $this->mActionForm->fetch();
39 $this->mActionForm->validate();
41 if ($this->mActionForm->hasError()) {
42 return $this->getDefaultView($controller, $xoopsUser);
48 $gpermHandler =& xoops_gethandler(
'groupperm');
51 $criteria->add(
new Criteria(
'gperm_groupid', $this->mGroup->get(
'groupid')));
52 $criteria->add(
new Criteria(
'gperm_modid', 1));
53 $criteria->add(
new Criteria(
'gperm_name',
'system_admin'));
54 $gpermHandler->deleteAll($criteria);
56 foreach ($this->mActionForm->get(
'system') as $sid => $value) {
66 $moduleHandler =& xoops_gethandler(
'module');
72 $this->_loadActiveModules();
73 foreach ($this->_mActiveModules as $module) {
74 $value = $this->mActionForm->get(
'module', $module->get(
'mid'));
76 $gpermHandler->addRight(
'module_read', $module->get(
'mid'), $this->mGroup->get(
'groupid'));
78 $gpermHandler->removeRight(
'module_read', $module->get(
'mid'), $this->mGroup->get(
'groupid'));
82 foreach ($this->_mActiveModules as $module) {
83 $value = $this->mActionForm->get(
'module_admin', $module->get(
'mid'));
85 $gpermHandler->addRight(
'module_admin', $module->get(
'mid'), $this->mGroup->get(
'groupid'));
87 $gpermHandler->removeRight(
'module_admin', $module->get(
'mid'), $this->mGroup->get(
'groupid'));
91 $blockHandler =& xoops_gethandler(
'block');
93 $this->_loadActiveBlocks();
94 foreach ($this->_mActiveBlocks as $side => $blocks) {
95 foreach ($blocks as $block) {
96 $value = $this->mActionForm->get(
'block', $block->get(
'bid'));
98 $gpermHandler->addRight(
'block_read', $block->get(
'bid'), $this->mGroup->get(
'groupid'));
99 } elseif (is_object($block) && !$value) {
100 $gpermHandler->removeRight(
'block_read', $block->get(
'bid'), $this->mGroup->get(
'groupid'));
105 return USER_FRAME_VIEW_SUCCESS;
108 public function executeViewIndex(&$controller, &$xoopsUser, &$render)
110 $render->setTemplateName(
'group_perm.html');
111 $render->setAttribute(
'group', $this->mGroup);
112 $render->setAttribute(
'actionForm', $this->mActionForm);
113 $render->setAttribute(
'modulePermissions', $this->mPermissions);
114 $render->setAttribute(
'blockPermissions', $this->mBlockPermissions);
115 $render->setAttribute(
'systemPermissions', $this->mSystemPermissions);
118 public function executeViewSuccess(&$controller, &$xoopsUser, &$render)
120 $controller->executeForward(
'index.php?action=GroupPerm&groupid=' . $this->mGroup->getVar(
'groupid'));