From dd4530d760b02693425d39ae579dff514c3e40b4 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Sun, 30 Dec 2012 17:58:23 +0100 Subject: User Nick function, enhanced log with some links --- includes/pages/admin_free.php | 107 ++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 55 deletions(-) (limited to 'includes/pages/admin_free.php') diff --git a/includes/pages/admin_free.php b/includes/pages/admin_free.php index 43b2e1a7..41f6c0e9 100644 --- a/includes/pages/admin_free.php +++ b/includes/pages/admin_free.php @@ -1,65 +1,62 @@ 'alle Typen'); - foreach ($angel_types_source as $angel_type) - $angel_types[$angel_type['id']] = $angel_type['name']; + $angel_types_source = sql_select("SELECT `id`, `name` FROM `AngelTypes` ORDER BY `name`"); + $angel_types = array('' => 'alle Typen'); + foreach ($angel_types_source as $angel_type) + $angel_types[$angel_type['id']] = $angel_type['name']; - $users = sql_select("SELECT `User`.* FROM `User` ${angeltypesearch} LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID` AND `Shifts`.`start` < " . sql_escape(time()) . " AND `Shifts`.`end` > " . sql_escape(time()) . ") WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL GROUP BY `User`.`UID` ORDER BY `Nick`"); + $users = sql_select("SELECT `User`.* FROM `User` ${angeltypesearch} LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` LEFT JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID` AND `Shifts`.`start` < " . sql_escape(time()) . " AND `Shifts`.`end` > " . sql_escape(time()) . ") WHERE `User`.`Gekommen` = 1 AND `Shifts`.`SID` IS NULL GROUP BY `User`.`UID` ORDER BY `Nick`"); - $table = ""; - if ($search == "") - $tokens = array (); - else - $tokens = explode(" ", $search); - foreach ($users as $usr) { - if (count($tokens) > 0) { - $match = false; - $index = join("", $usr); - foreach ($tokens as $t) - if (stristr($index, trim($t))) { - $match = true; - break; - } - if (!$match) - continue; - } - $table .= ''; - if (in_array('user_shifts_admin', $privileges)) - $table .= '' . $usr['Nick'] . ''; - else - $table .= '' . $usr['Nick'] . ''; - $table .= '' . $usr['DECT'] . ''; - $table .= '' . $usr['jabber'] . ''; - if (in_array('admin_user', $privileges)) - $table .= 'edit'; - else - $table .= '' . $usr['Nick'] . ''; + $table = ""; + if ($search == "") + $tokens = array (); + else + $tokens = explode(" ", $search); + foreach ($users as $usr) { + if (count($tokens) > 0) { + $match = false; + $index = join("", $usr); + foreach ($tokens as $t) + if (stristr($index, trim($t))) { + $match = true; + break; + } + if (!$match) + continue; + } + $table .= ''; + $table .= '' . User_Nick_render($usr) . ''; + $table .= '' . $usr['DECT'] . ''; + $table .= '' . $usr['jabber'] . ''; + if (in_array('admin_user', $privileges)) + $table .= 'edit'; + else + $table .= '' . User_Nick_render($usr) . ''; - $table .= ''; - } - return template_render('../templates/admin_free.html', array ( - 'search' => $search, - 'angeltypes' => html_select_key('angeltype', 'angeltype', $angel_types, $_REQUEST['angeltype']), - 'confirmed_only' => isset($_REQUEST['confirmed_only'])? 'checked' : '', - 'table' => $table, - 'link' => page_link_to('admin_free') - )); + $table .= ''; + } + return template_render('../templates/admin_free.html', array ( + 'search' => $search, + 'angeltypes' => html_select_key('angeltype', 'angeltype', $angel_types, $_REQUEST['angeltype']), + 'confirmed_only' => isset($_REQUEST['confirmed_only'])? 'checked' : '', + 'table' => $table, + 'link' => page_link_to('admin_free') + )); } ?> -- cgit v1.2.3-54-g00ecf