summaryrefslogtreecommitdiff
path: root/includes/controller
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-09-28 14:50:08 +0200
committerPhilip Häusler <msquare@notrademark.de>2014-09-28 14:50:08 +0200
commit1d9e1c467cf4d3920f9bcf0157481c7ca8ea6d5d (patch)
tree72e815859ba1fc37d82facdabe5ede76f3823ac4 /includes/controller
parent0f77edc4fb5581eacd0305ec9010b78afc489b55 (diff)
user list rewritten
Diffstat (limited to 'includes/controller')
-rw-r--r--includes/controller/angeltypes_controller.php2
-rw-r--r--includes/controller/users_controller.php41
2 files changed, 41 insertions, 2 deletions
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index 93c0e6bf..79ffcfb4 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -225,7 +225,7 @@ function angeltypes_list_controller() {
$angeltype['restricted'] = $angeltype['restricted'] ? '<img src="pic/icons/lock.png" alt="' . _("Restricted") . '" title="' . _("Restricted") . '">' : '';
$angeltype['name'] = '<a href="' . page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'] . '">' . $angeltype['name'] . '</a>';
- $angeltype['actions'] = buttons($actions);
+ $angeltype['actions'] = table_buttons($actions);
}
return array(
diff --git a/includes/controller/users_controller.php b/includes/controller/users_controller.php
index 1f3b3677..b1692e21 100644
--- a/includes/controller/users_controller.php
+++ b/includes/controller/users_controller.php
@@ -55,7 +55,46 @@ function user_controller() {
}
function users_list_controller() {
- redirect(page_link_to('admin_user'));
+ global $privileges;
+
+ if (! in_array('admin_user', $privileges))
+ redirect(page_link_to(''));
+
+ $order_by = 'Nick';
+ if (isset($_REQUEST['OrderBy']) && in_array($_REQUEST['OrderBy'], array(
+ 'Nick',
+ 'Name',
+ 'Vorname',
+ 'Alter',
+ 'DECT',
+ 'email',
+ 'Size',
+ 'Gekommen',
+ 'Aktiv',
+ 'force_active',
+ 'Tshirt',
+ 'lastLogIn'
+ )))
+ $order_by = $_REQUEST['OrderBy'];
+
+ $users = Users($order_by);
+ if ($users === false)
+ engelsystem_error('Unable to load users.');
+
+ foreach ($users as &$user) {
+ $user['freeloads'] = sql_select_single_cell("SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1 AND `UID` = " . sql_escape($user['UID']));
+ }
+
+ $arrived_count = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Gekommen` = 1");
+ $active_count = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Aktiv` = 1");
+ $force_active_count = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `force_active` = 1");
+ $freeloads_count = sql_select_single_cell("SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1");
+ $tshirts_count = sql_select_single_cell("SELECT COUNT(*) FROM `User` WHERE `Tshirt` = 1");
+
+ return array(
+ _('All users'),
+ Users_view($users, $order_by, $arrived_count, $active_count, $force_active_count, $freeloads_count, $tshirts_count)
+ );
}
/**