summaryrefslogtreecommitdiff
path: root/includes/pages
diff options
context:
space:
mode:
Diffstat (limited to 'includes/pages')
-rw-r--r--includes/pages/admin_active.php12
-rw-r--r--includes/pages/user_shifts.php16
2 files changed, 20 insertions, 8 deletions
diff --git a/includes/pages/admin_active.php b/includes/pages/admin_active.php
index 576cdc49..f3a28061 100644
--- a/includes/pages/admin_active.php
+++ b/includes/pages/admin_active.php
@@ -58,7 +58,10 @@ function admin_active()
SELECT
`User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
- %s AS `shift_length`
+ (%s + (
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`User`.`UID`
+ AND `work_timestamp` < %s
+ )) AS `shift_length`
FROM `User`
LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID`
@@ -69,6 +72,7 @@ function admin_active()
%s
',
$shift_sum_formula,
+ time(),
$limit
));
$user_nicks = [];
@@ -140,7 +144,10 @@ function admin_active()
SELECT
`User`.*,
COUNT(`ShiftEntry`.`id`) AS `shift_count`,
- %s AS `shift_length`
+ (%s + (
+ SELECT COALESCE(SUM(`work_hours`) * 3600, 0) FROM `UserWorkLog` WHERE `user_id`=`User`.`UID`
+ AND `work_timestamp` < %s
+ )) AS `shift_length`
FROM `User` LEFT JOIN `ShiftEntry` ON `User`.`UID` = `ShiftEntry`.`UID`
LEFT JOIN `Shifts` ON `ShiftEntry`.`SID` = `Shifts`.`SID` '
. ($show_all_shifts ? '' : 'AND (`Shifts`.`end` < ' . time() . " OR `Shifts`.`end` IS NULL)") . '
@@ -150,6 +157,7 @@ function admin_active()
%s
',
$shift_sum_formula,
+ time(),
$limit
));
$matched_users = [];
diff --git a/includes/pages/user_shifts.php b/includes/pages/user_shifts.php
index 0be4aa67..81b405b1 100644
--- a/includes/pages/user_shifts.php
+++ b/includes/pages/user_shifts.php
@@ -313,11 +313,19 @@ function get_ids_from_array($array)
*/
function make_select($items, $selected, $name, $title = null, $additionalButtons = [])
{
+ $html = '';
$htmlItems = [];
if (isset($title)) {
- $htmlItems[] = '<h4>' . $title . '</h4>' . "\n";
+ $html .= '<h4>' . $title . '</h4>' . "\n";
}
+ $buttons = [];
+ $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All'));
+ $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None'));
+ $buttons = array_merge($buttons, $additionalButtons);
+
+ $html .= buttons($buttons);
+
foreach ($items as $i) {
$htmlItems[] = '<div class="checkbox">'
. '<label><input type="checkbox" name="' . $name . '[]" value="' . $i['id'] . '" '
@@ -326,13 +334,9 @@ function make_select($items, $selected, $name, $title = null, $additionalButtons
. (!isset($i['enabled']) || $i['enabled'] ? '' : glyph('lock'))
. '</div><br />';
}
- $html = '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
+ $html .= '<div id="selection_' . $name . '" class="selection ' . $name . '">' . "\n";
$html .= implode("\n", $htmlItems);
- $buttons = [];
- $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', true)', _('All'));
- $buttons[] = button('javascript: checkAll(\'selection_' . $name . '\', false)', _('None'));
- $buttons = array_merge($buttons, $additionalButtons);
$html .= buttons($buttons);
$html .= '</div>' . "\n";