2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2010 */
\r
6 /* Inclusive Design Institute */
\r
8 /* This program is free software. You can redistribute it and/or */
\r
9 /* modify it under the terms of the GNU General Public License */
\r
10 /* as published by the Free Software Foundation. */
\r
11 /************************************************************************/
\r
13 define('TR_INCLUDE_PATH', '../include/');
\r
14 include_once(TR_INCLUDE_PATH.'vitals.inc.php');
\r
15 include_once(TR_INCLUDE_PATH.'classes/DAO/UserGroupsDAO.class.php');
\r
16 include_once(TR_INCLUDE_PATH.'classes/DAO/PrivilegesDAO.class.php');
\r
19 if ( isset($_GET['edit']) && isset($_GET['id']) && count($_GET['id']) > 1) {
\r
20 $msg->addError('SELECT_ONE_ITEM');
\r
21 } else if (isset($_GET['edit'], $_GET['id'])) {
\r
22 header('Location: user_group_create_edit.php?id='.$_GET['id'][0]);
\r
24 } else if ( isset($_GET['delete'], $_GET['id'])) {
\r
25 // cannot delete "admin" and "user" groups
\r
26 foreach ($_GET['id'] as $id)
\r
28 if ($id == TR_USER_GROUP_ADMIN || $id == TR_USER_GROUP_USER)
\r
30 $msg->addError('USER_GROUP_CANNOT_DELETE');
\r
35 if (!$msg->containsErrors())
\r
37 $ids = implode(',', $_GET['id']);
\r
38 header('Location: user_group_delete.php?id='.$ids);
\r
41 } else if (isset($_GET['edit']) || isset($_GET['delete']) ) {
\r
42 $msg->addError('NO_ITEM_SELECTED');
\r
45 $userGroupsDAO = new UserGroupsDAO();
\r
46 $privilegesDAO = new PrivilegesDAO();
\r
48 $savant->assign('user_group_rows', $userGroupsDAO->getAll());
\r
49 $savant->assign('privilegesDAO', $privilegesDAO);
\r
51 $savant->display('user/user_group.tmpl.php');
\r