38 $op =
$system->cleanVars($_REQUEST,
'op',
'list',
'string');
44 $xoops->header(
'admin:system/system_groups.tpl');
52 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
54 $xoops->theme()->addScript(
'media/jquery/plugins/jquery.tablesorter.js');
55 $xoops->theme()->addScript(
'modules/system/js/admin.js');
76 $groups_count = count($groups_arr);
78 $xoops->tpl()->assign(
'groups_count', $groups_count);
80 foreach ($groups_arr as $group) {
81 $groups_id = $group->getVar(
"groupid");
82 $groups[
'groups_id'] = $groups_id;
83 $groups[
'name'] = $group->getVar(
"name");
84 $groups[
'description'] = $group->getVar(
"description");
86 if ($groups_id != 3) {
87 $group_id_arr[0] = $groups_id;
88 $nb_users_by_groups =
$member_handler->getUserCountByGroupLink($group_id_arr);
91 $groups[
'nb_users_by_groups'] =
'';
93 $edit_delete =
'<a href="admin.php?fct=groups&op=groups_edit&groups_id=' . $groups_id .
'">'
96 if (!in_array($group->getVar(
"groupid"), array(FixedGroups::ADMIN, FixedGroups::USERS, FixedGroups::ANONYMOUS))
99 $edit_delete .=
'<a href="admin.php?fct=groups&op=groups_delete&groups_id=' . $groups_id .
'">'
103 $groups[
'edit_delete'] = $edit_delete;
110 $xoops->tpl()->assign(
'nav_menu', $nav->renderNav(4));
117 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
136 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
146 $groups_id =
$system->cleanVars($_REQUEST,
'groups_id', 0,
'int');
147 if ($groups_id > 0) {
158 case 'groups_save_add':
159 if (!
$xoops->security()->check()) {
160 $xoops->redirect(
'admin.php?fct=groups', 3, implode(
'<br />',
$xoops->security()->getErrors()));
162 $system_catids =
$system->cleanVars($_POST,
'system_catids', array(),
'array');
163 $admin_mids =
$system->cleanVars($_POST,
'admin_mids', array(),
'array');
164 $read_mids =
$system->cleanVars($_POST,
'read_mids', array(),
'array');
165 $read_bids =
$system->cleanVars($_POST,
'read_bids', array(),
'array');
169 $group->setVar(
'name', $_POST[
"name"]);
170 $group->setVar(
'description', $_POST[
"desc"]);
171 if (count($system_catids) > 0) {
172 $group->setVar(
'group_type',
'Admin');
176 echo
$xoops->alert(
'error', $group->getHtmlErrors());
179 $xoops->db()->beginTransaction();
180 $groupid = $group->getVar(
'groupid');
182 if (count($system_catids) > 0) {
183 array_push($admin_mids, 1);
184 foreach ($system_catids as $s_cid) {
186 $sysperm->setVar(
'gperm_groupid', $groupid);
187 $sysperm->setVar(
'gperm_itemid', $s_cid);
188 $sysperm->setVar(
'gperm_name',
'system_admin');
189 $sysperm->setVar(
'gperm_modid', 1);
193 foreach ($admin_mids as $a_mid) {
195 $modperm->setVar(
'gperm_groupid', $groupid);
196 $modperm->setVar(
'gperm_itemid', $a_mid);
197 $modperm->setVar(
'gperm_name',
'module_admin');
198 $modperm->setVar(
'gperm_modid', 1);
201 array_push($read_mids, 1);
202 foreach ($read_mids as $r_mid) {
204 $modperm->setVar(
'gperm_groupid', $groupid);
205 $modperm->setVar(
'gperm_itemid', $r_mid);
206 $modperm->setVar(
'gperm_name',
'module_read');
207 $modperm->setVar(
'gperm_modid', 1);
210 foreach ($read_bids as $r_bid) {
212 $blockperm->setVar(
'gperm_groupid', $groupid);
213 $blockperm->setVar(
'gperm_itemid', $r_bid);
214 $blockperm->setVar(
'gperm_name',
'block_read');
215 $blockperm->setVar(
'gperm_modid', 1);
224 case 'groups_save_update':
225 if (!
$xoops->security()->check()) {
226 $xoops->redirect(
'admin.php?fct=groups', 3, implode(
'<br />',
$xoops->security()->getErrors()));
228 $system_catids =
$system->cleanVars($_POST,
'system_catids', array(),
'array');
229 $admin_mids =
$system->cleanVars($_POST,
'admin_mids', array(),
'array');
230 $read_mids =
$system->cleanVars($_POST,
'read_mids', array(),
'array');
231 $read_bids =
$system->cleanVars($_POST,
'read_bids', array(),
'array');
234 $gid =
$system->cleanVars($_POST,
'g_id', 0,
'int');
237 $group->setVar(
'name', $_POST[
"name"]);
238 $group->setVar(
'description', $_POST[
"desc"]);
240 if (!in_array($group->getVar(
'groupid'), array(FixedGroups::ADMIN, FixedGroups::USERS, FixedGroups::ANONYMOUS))
242 if (count($system_catids) > 0) {
243 $group->setVar(
'group_type',
'Admin');
245 $group->setVar(
'group_type',
'');
250 echo $group->getHtmlErrors();
253 $xoops->db()->beginTransaction();
254 $groupid = $group->getVar(
'groupid');
264 if (count($system_catids) > 0) {
265 array_push($admin_mids, 1);
266 foreach ($system_catids as $s_cid) {
268 $sysperm->setVar(
'gperm_groupid', $groupid);
269 $sysperm->setVar(
'gperm_itemid', $s_cid);
270 $sysperm->setVar(
'gperm_name',
'system_admin');
271 $sysperm->setVar(
'gperm_modid', 1);
275 foreach ($admin_mids as $a_mid) {
277 $modperm->setVar(
'gperm_groupid', $groupid);
278 $modperm->setVar(
'gperm_itemid', $a_mid);
279 $modperm->setVar(
'gperm_name',
'module_admin');
280 $modperm->setVar(
'gperm_modid', 1);
283 array_push($read_mids, 1);
284 foreach ($read_mids as $r_mid) {
286 $modperm->setVar(
'gperm_groupid', $groupid);
287 $modperm->setVar(
'gperm_itemid', $r_mid);
288 $modperm->setVar(
'gperm_name',
'module_read');
289 $modperm->setVar(
'gperm_modid', 1);
292 foreach ($read_bids as $r_bid) {
294 $blockperm->setVar(
'gperm_groupid', $groupid);
295 $blockperm->setVar(
'gperm_itemid', $r_bid);
296 $blockperm->setVar(
'gperm_name',
'block_read');
297 $blockperm->setVar(
'gperm_modid', 1);
309 case 'groups_delete':
316 $groups_id =
$system->cleanVars($_REQUEST,
'groups_id', 0,
'int');
317 if ($groups_id > 0) {
319 if (isset($_POST[
"ok"]) && $_POST[
"ok"] == 1) {
320 if (!
$xoops->security()->check()) {
321 $xoops->redirect(
"admin.php?fct=groups", 3, implode(
",",
$xoops->security()->getErrors()));
323 if ($groups_id > 0 && !in_array($groups_id, array(
326 FixedGroups::ANONYMOUS
340 $xoops->theme()->addStylesheet(
'modules/system/css/admin.css');
349 "groups_id" => $_REQUEST[
"groups_id"],
350 "op" =>
"groups_delete"
352 'admin.php?fct=groups',
364 if (isset($_REQUEST[
'edit_group'])) {
365 if (isset($_REQUEST[
'edit_group'])
366 && $_REQUEST[
'edit_group'] ==
'add_group'
367 && isset($_REQUEST[
'selgroups'])
369 foreach ($_REQUEST[
'memberslist_id'] as
$uid) {
374 if (isset($_REQUEST[
'edit_group'])
375 && $_REQUEST[
'edit_group'] ==
'delete_group'
376 && isset($_REQUEST[
'selgroups'])
378 $member_handler->removeUsersFromGroup($_REQUEST[
'selgroups'], $_REQUEST[
'memberslist_id']);
const Q_ARE_YOU_SURE_DELETE_THIS_GROUP
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
static getInstance($fct= '')
system_adminVersion($version, $value= '')
const E_YOU_CANNOT_REMOVE_THIS_GROUP
const E_NO_ACCESS_PERMISSION
if(!$xoops->isUser()||!$xoops->isModule()||!$xoops->user->isAdmin($xoops->module->mid())) $nb_group
const E_DATABASE_NOT_UPDATED