/[scire]/scire/users.php
Gentoo

Contents of /scire/users.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 186 - (show annotations) (download)
Sat Mar 17 03:23:00 2007 UTC (11 years, 2 months ago) by codeman
File size: 5221 byte(s)
adding a line to grab/use the default value if none is already set.

1 <?php
2 include('.lib/common.php');
3
4 $smarty->assign('leftbar', "on");
5 $leftbar_menu = array();
6 $leftbar_submenu = array();
7 $template = "users.tpl";
8 $status = "";
9
10 ############################################
11 ## Deal with submitted forms first.
12 if ($_POST['addgroupname']) { #Adding a group.
13 $newgroup_id = $acl->add_group($_POST['addgroupname'], $_POST['addgroupname'], $_POST['parentgroup'], 'ARO');
14 $_GET['Action'] = "created";
15 $_GET['View'] = "groups";
16 $status = "User Group Created Successfully.";
17 }
18 if ($_POST['editgroupname']) {
19 $group_id = $acl->edit_group($_POST['groupid'], $_POST['editgroupname'], $_POST['editgroupname'], $_POST['parentgroup'], 'ARO');
20 $_GET['Action'] = "edited";
21 $_GET['View'] = "groups";
22 $status = "User Group Edited Successfully.";
23 }
24 if($_POST['delgroup_confirm']) {
25 #Check if the group has children.
26 $result = $acl->del_group($_POST['delgroup'],TRUE, 'ARO');
27 if ($result) {
28 $status = "Group deleted successfully.";
29 } else {
30 $status = "ERROR: Group could not be successfully deleted.";
31 }
32 $_GET['Action'] = "deleted";
33 $_GET['View'] = "groups";
34 }
35
36
37
38
39
40 $smarty->assign('desc', "View, create, edit, and delete users");
41
42
43 switch($_GET['View']) {
44 case "groups":
45 $template = "users_groups.tpl";
46 switch($_GET['Action']) {
47 case "create":
48 add_leftbar($leftbar_menu, "&#171;&#171;Cancel", "users.php?View=groups");
49 $smarty->assign('groups', $acl->format_groups($acl->sort_groups('aro'), TEXT));
50 break;
51 case "edit":
52 add_leftbar($leftbar_menu, "&#171;&#171;Cancel", "users.php?View=groups");
53 $smarty->assign('groups', $acl->format_groups($acl->sort_groups('aro'), TEXT));
54 $smarty->assign('groupid', $_GET['groupid']);
55 $smarty->assign('groupdata', $acl->get_group_data($_GET['groupid'], 'ARO'));
56 break;
57 case "delete":
58 add_leftbar($leftbar_menu, "&#171;&#171;Cancel", "users.php?View=groups");
59 $smarty->assign('groupid', $_GET['groupid']);
60 break;
61 default: #Show usergroups.
62 add_leftbar($leftbar_menu, "Users", "users.php");
63 add_leftbar($leftbar_menu, "Permissions", "users.php?View=permissions");
64 $smarty->assign('leftbar_submenu_title', "Actions");
65 add_leftbar($leftbar_submenu, "Create User Group", "users.php?View=groups&Action=create");
66
67
68 $groups = $acl->format_groups($acl->sort_groups('aro'), HTML);
69 $smarty->assign('groups', $groups);
70
71 break;
72 }
73 break;
74 case "permissions":
75 $smarty->assign('leftbar_submenu_title', "Actions");
76 add_leftbar($leftbar_submenu, "Assign Permission", "assign_permission.php");
77 $template = "permissions.tpl";
78 $smarty->assign('type','users');
79 $ugroups = $acl->format_groups($acl->sort_groups('aro'), 'ARRAY');
80 $smarty->assign('ugroups', $ugroups);
81 $cgroups = $acl->format_groups($acl->sort_groups('axo'), 'ARRAY');
82 $smarty->assign('cgroups', $cgroups);
83
84 #pre_var_dump($groups);
85
86 $acls = array();
87 #Format of search: aco_section, aco_value, aro_section, aro_value, aro_group_name, axo_section, axo_value, axo_group_name, return_value
88 $result_acl_ids = $acl->search_acl(FALSE,FALSE,
89 FALSE,FALSE,FALSE,
90 FALSE,FALSE,FALSE,FALSE);
91 foreach ($result_acl_ids as $acl_id) {
92 $this_acl = $acl->get_acl($acl_id);
93 if ($this_acl['aco']['scire_ui']) {
94 next;
95 } else {
96 array_push($acls, $this_acl);
97 }
98 }
99 #pre_var_dump($acls);
100 $smarty->assign('acls',$acls);
101 break;
102
103 default: #Show users.
104 add_leftbar($leftbar_menu, "Groups", "users.php?View=groups");
105 add_leftbar($leftbar_menu, "Permissions", "users.php?View=permissions");
106 $smarty->assign('leftbar_submenu_title', "Actions");
107 add_leftbar($leftbar_submenu, "Create User", "user.php?Action=create");
108
109 ############################################
110 ## Deal with sorting for the query.
111 if (!$_GET['sorton']) {
112 $_GET['sorton'] = $_SESSION['settings']['users_page_sorton'];
113 }
114 if (!$_GET['sortdir']) {
115 $_GET['sortdir'] = $_SESSION['settings']['users_page_sortdir'];
116 }
117 $smarty->assign('sorton', $_GET['sorton']);
118 $smarty->assign('sortdir', $_GET['sortdir']);
119
120 $users = get_scire_users($_GET['sorton'], $_GET['sort']);
121 foreach ($users as $key => $user) {
122 $id = $acl->get_object_id("users",$user['username'],'ARO');
123 $groups = $acl->get_object_groups($id,'ARO');
124 $group_string = "";
125 if ($groups) {
126 foreach ($groups as $group) {
127 $group_data = $acl->get_group_data($group, 'ARO');
128 $group_string .= $group_data[3]. " | ";
129 }
130 }
131 $users[$key]['groups'] = $group_string;
132 }
133
134 #Set information about the fields (display name, sortable)
135 $f_attr = get_users_fields();
136 $smarty->assign('f_attr', $f_attr);
137
138 #Grab the field list.
139 if ($_SESSION['settings']['users_page_fields']) {
140 $fields = explode(',', $_SESSION['settings']['users_page_fields']);
141 } else {
142 $fields = explode(',', get_default_users_fields());
143 }
144 $smarty->assign('fields',$fields);
145
146 $smarty->assign('users', $users);
147 break;
148 }
149
150 $smarty->assign('leftbar_menu', $leftbar_menu);
151 $smarty->assign('leftbar_submenu', $leftbar_submenu);
152 $smarty->assign('View', $_GET['View']);
153 $smarty->assign('Action', $_GET['Action']);
154 $smarty->assign('status', $status);
155 $smarty->display($template);
156 #var_dump($_POST);
157 ?>

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20