add possibility to show already done shifts in admin active view

main
Philip Häusler 9 years ago
parent 1c9a3fa89e
commit 34be996f22

@ -1,4 +1,5 @@
<?php <?php
function admin_active_title() { function admin_active_title() {
return _("Active angels"); return _("Active angels");
} }
@ -12,8 +13,12 @@ function admin_active() {
$count = $forced_count; $count = $forced_count;
$limit = ""; $limit = "";
$set_active = ""; $set_active = "";
if (isset($_REQUEST['search'])) if (isset($_REQUEST['search']))
$search = strip_request_item('search'); $search = strip_request_item('search');
$show_all_shifts = isset($_REQUEST['show_all_shifts']);
if (isset($_REQUEST['set_active'])) { if (isset($_REQUEST['set_active'])) {
$ok = true; $ok = true;
@ -98,6 +103,7 @@ function admin_active() {
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID` FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
WHERE `User`.`Gekommen` = 1 WHERE `User`.`Gekommen` = 1
" . ($show_all_shifts ? "" : "AND `Shifts`.`end` < " . time()) . "
GROUP BY `User`.`UID` GROUP BY `User`.`UID`
ORDER BY `force_active` DESC, `shift_length` DESC" . $limit); ORDER BY `force_active` DESC, `shift_length` DESC" . $limit);
@ -154,6 +160,7 @@ function admin_active() {
return page_with_title(admin_active_title(), array( return page_with_title(admin_active_title(), array(
form(array( form(array(
form_text('search', _("Search angel:"), $search), form_text('search', _("Search angel:"), $search),
form_checkbox('show_all_shifts', _("Show all shifts"), $show_all_shifts),
form_submit('submit', _("Search")) form_submit('submit', _("Search"))
)), )),
$set_active == "" ? form(array( $set_active == "" ? form(array(

Loading…
Cancel
Save