$msg->addError('SELECT_ONE_ITEM'); } else { if (isset($_GET['edit'], $_GET['id'])) { header('Location: user_group_create_edit.php?id=' . $_GET['id'][0]); exit; } else { if (isset($_GET['delete'], $_GET['id'])) { // cannot delete "admin" and "user" groups foreach ($_GET['id'] as $id) { if ($id == TR_USER_GROUP_ADMIN || $id == TR_USER_GROUP_USER) { $msg->addError('USER_GROUP_CANNOT_DELETE'); break; } } if (!$msg->containsErrors()) { $ids = implode(',', $_GET['id']); header('Location: user_group_delete.php?id=' . $ids); exit; } } else { if (isset($_GET['edit']) || isset($_GET['delete'])) { $msg->addError('NO_ITEM_SELECTED'); } } } } $userGroupsDAO = new UserGroupsDAO(); $privilegesDAO = new PrivilegesDAO(); $savant->assign('user_group_rows', $userGroupsDAO->getAll()); $savant->assign('privilegesDAO', $privilegesDAO); $savant->display('user/user_group.tmpl.php');
exit; } } } else { if ($usersDAO->Update($_GET['id'], $_POST['user_group_id'], $_POST['login'], $_POST['email'], $_POST['first_name'], $_POST['last_name'], $_POST['status'])) { $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: index.php'); exit; } } } } } // end of handle submit // initialize page $userGroupsDAO = new UserGroupsDAO(); if (isset($_GET['id'])) { $usersDAO = new UsersDAO(); $savant->assign('user_row', $usersDAO->getUserByID($_GET['id'])); $savant->assign('show_password', false); } else { $savant->assign('show_password', true); } /*****************************/ /* template starts down here */ global $onload; $onload = 'document.form.login.focus();'; $savant->assign('show_user_group', true); $savant->assign('show_status', true); $savant->assign('all_user_groups', $userGroupsDAO->getAll()); $savant->assign('title', _AC('create_edit_user'));
/************************************************************************/ /* AChecker */ /************************************************************************/ /* Copyright (c) 2008 - 2011 */ /* Inclusive Design Institute */ /* */ /* This program is free software. You can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation. */ /************************************************************************/ // $Id$ define('AC_INCLUDE_PATH', '../include/'); include AC_INCLUDE_PATH . 'vitals.inc.php'; include_once AC_INCLUDE_PATH . 'classes/DAO/UserGroupsDAO.class.php'; $userGroupsDAO = new UserGroupsDAO(); $ids = explode(',', $_REQUEST['id']); if (isset($_POST['submit_no'])) { $msg->addFeedback('CANCELLED'); header('Location: user_group.php'); exit; } else { if (isset($_POST['submit_yes'])) { foreach ($ids as $id) { $userGroupsDAO->Delete($id); } $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY'); header('Location: user_group.php'); exit; } }
/* This program is free software. You can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation. */ /************************************************************************/ // $Id$ define('AC_INCLUDE_PATH', '../include/'); include AC_INCLUDE_PATH . 'vitals.inc.php'; include_once AC_INCLUDE_PATH . 'classes/DAO/UserGroupsDAO.class.php'; include_once AC_INCLUDE_PATH . 'classes/DAO/UserGroupPrivilegeDAO.class.php'; include_once AC_INCLUDE_PATH . 'classes/DAO/PrivilegesDAO.class.php'; unset($id); // clean up the temporary id values set by vitals.inc.php if (isset($_GET["id"])) { $id = intval($_GET["id"]); } $userGroupsDAO = new UserGroupsDAO(); // handle submits if (isset($_POST['cancel'])) { $msg->addFeedback('CANCELLED'); header('Location: user_group.php'); exit; } else { if (isset($_POST['save'])) { $title = trim($_POST['title']); if ($title == '') { $msg->addError(array('EMPTY_FIELDS', _AC('title'))); } if (!$msg->containsErrors()) { if (isset($id)) { $userGroupsDAO->update($id, $title, trim($_POST['description'])); } else {
<?php /************************************************************************/ /* AContent */ /************************************************************************/ /* Copyright (c) 2010 */ /* Inclusive Design Institute */ /* */ /* This program is free software. You can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation. */ /************************************************************************/ define('TR_INCLUDE_PATH', '../include/'); include TR_INCLUDE_PATH . 'vitals.inc.php'; include_once TR_INCLUDE_PATH . 'classes/DAO/UserGroupsDAO.class.php'; if (isset($_POST['field'])) { $userGroupsDAO = new UserGroupsDAO(); // Format of $_POST['field']: [fieldName]|[user_id] $pieces = explode('-', $_POST['field']); $status = $userGroupsDAO->UpdateField($pieces[1], $pieces[0], $_POST['value']); if (is_array($status)) { $rtn['status'] = 'fail'; foreach ($status as $err) { $rtn['error'][] = $err; } } else { $rtn['status'] = 'success'; $rtn['success'][] = _AT('TR_FEEDBACK_ACTION_COMPLETED_SUCCESSFULLY'); } } echo json_encode($rtn);