parent
1af6b8cf20
commit
e4bd324801
|
@ -21,12 +21,12 @@ function mail_shift_change($old_shift, $new_shift) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_shift["start"] != $new_shift["start"]) {
|
if ($old_shift["start"] != $new_shift["start"]) {
|
||||||
$message .= sprintf(_("* Shift Start changed from %s to %s"), date("y-m-d H:i", $old_shift["start"]), date("y-m-d H:i", $new_shift["start"])) . "\n";
|
$message .= sprintf(_("* Shift Start changed from %s to %s"), date("Y-m-d H:i", $old_shift["start"]), date("Y-m-d H:i", $new_shift["start"])) . "\n";
|
||||||
$noticable_changes = true;
|
$noticable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($old_shift["end"] != $new_shift["end"]) {
|
if ($old_shift["end"] != $new_shift["end"]) {
|
||||||
$message .= sprintf(_("* Shift End changed from %s to %s"), date("y-m-d H:i", $old_shift["end"]), date("y-m-d H:i", $new_shift["end"])) . "\n";
|
$message .= sprintf(_("* Shift End changed from %s to %s"), date("Y-m-d H:i", $old_shift["end"]), date("Y-m-d H:i", $new_shift["end"])) . "\n";
|
||||||
$noticable_changes = true;
|
$noticable_changes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ function mail_shift_change($old_shift, $new_shift) {
|
||||||
|
|
||||||
$message .= $new_shift["name"] . "\n";
|
$message .= $new_shift["name"] . "\n";
|
||||||
$message .= $new_shift["title"] . "\n";
|
$message .= $new_shift["title"] . "\n";
|
||||||
$message .= date("y-m-d H:i", $new_shift["start"]) . " - " . date("H:i", $new_shift["end"]) . "\n";
|
$message .= date("Y-m-d H:i", $new_shift["start"]) . " - " . date("H:i", $new_shift["end"]) . "\n";
|
||||||
$message .= $new_room["Name"] . "\n";
|
$message .= $new_room["Name"] . "\n";
|
||||||
|
|
||||||
foreach ($users as $user)
|
foreach ($users as $user)
|
||||||
|
@ -61,7 +61,7 @@ function mail_shift_delete($shift) {
|
||||||
|
|
||||||
$message .= $shift["name"] . "\n";
|
$message .= $shift["name"] . "\n";
|
||||||
$message .= $new_shift["title"] . "\n";
|
$message .= $new_shift["title"] . "\n";
|
||||||
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
||||||
$message .= $room["Name"] . "\n";
|
$message .= $room["Name"] . "\n";
|
||||||
|
|
||||||
foreach ($users as $user)
|
foreach ($users as $user)
|
||||||
|
@ -76,7 +76,7 @@ function mail_shift_assign($user, $shift) {
|
||||||
$message = _("You have been assigned to a Shift:") . "\n";
|
$message = _("You have been assigned to a Shift:") . "\n";
|
||||||
$message .= $shift["name"] . "\n";
|
$message .= $shift["name"] . "\n";
|
||||||
$message .= $shift["title"] . "\n";
|
$message .= $shift["title"] . "\n";
|
||||||
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
||||||
$message .= $room["Name"] . "\n";
|
$message .= $room["Name"] . "\n";
|
||||||
|
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Assigned to Shift"), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _("Assigned to Shift"), $message, true);
|
||||||
|
@ -90,7 +90,7 @@ function mail_shift_removed($user, $shift) {
|
||||||
$message = _("You have been removed from a Shift:") . "\n";
|
$message = _("You have been removed from a Shift:") . "\n";
|
||||||
$message .= $shift["name"] . "\n";
|
$message .= $shift["name"] . "\n";
|
||||||
$message .= $shift["title"] . "\n";
|
$message .= $shift["title"] . "\n";
|
||||||
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
$message .= date("Y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
|
||||||
$message .= $room["Name"] . "\n";
|
$message .= $room["Name"] . "\n";
|
||||||
|
|
||||||
engelsystem_email_to_user($user, '[engelsystem] ' . _("Removed from Shift"), $message, true);
|
engelsystem_email_to_user($user, '[engelsystem] ' . _("Removed from Shift"), $message, true);
|
||||||
|
|
|
@ -68,7 +68,7 @@ function user_myshifts() {
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
engelsystem_error('Unable to update shift entr.');
|
engelsystem_error('Unable to update shift entr.');
|
||||||
|
|
||||||
engelsystem_log("Updated " . User_Nick_render($user_source) . "'s shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']) . " with comment " . $comment . ". Freeloaded: " . ($freeloaded ? "YES Comment: " . $freeload_comment : "NO"));
|
engelsystem_log("Updated " . User_Nick_render($user_source) . "'s shift " . $shift['name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end']) . " with comment " . $comment . ". Freeloaded: " . ($freeloaded ? "YES Comment: " . $freeload_comment : "NO"));
|
||||||
success(_("Shift saved."));
|
success(_("Shift saved."));
|
||||||
redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
|
redirect(page_link_to('users') . '&action=view&user_id=' . $shifts_user['UID']);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ function user_myshifts() {
|
||||||
$angeltype = AngelType($shift['TID']);
|
$angeltype = AngelType($shift['TID']);
|
||||||
$shifttype = ShiftType($shift['shifttype_id']);
|
$shifttype = ShiftType($shift['shifttype_id']);
|
||||||
|
|
||||||
engelsystem_log("Deleted own shift: " . $shifttype['name'] . " at " . $room['Name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']) . " as " . $angeltype['name']);
|
engelsystem_log("Deleted own shift: " . $shifttype['name'] . " at " . $room['Name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end']) . " as " . $angeltype['name']);
|
||||||
success(_("You have been signed off from the shift."));
|
success(_("You have been signed off from the shift."));
|
||||||
} else
|
} else
|
||||||
error(_("It's too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so."));
|
error(_("It's too late to sign yourself off the shift. If neccessary, ask the dispatcher to do so."));
|
||||||
|
|
|
@ -6,40 +6,40 @@ function shifts_title() {
|
||||||
|
|
||||||
function user_shifts() {
|
function user_shifts() {
|
||||||
global $user, $privileges, $max_freeloadable_shifts;
|
global $user, $privileges, $max_freeloadable_shifts;
|
||||||
|
|
||||||
if (User_is_freeloader($user))
|
if (User_is_freeloader($user))
|
||||||
redirect(page_link_to('user_myshifts'));
|
redirect(page_link_to('user_myshifts'));
|
||||||
|
|
||||||
// Locations laden
|
// Locations laden
|
||||||
$rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
|
$rooms = sql_select("SELECT * FROM `Room` WHERE `show`='Y' ORDER BY `Name`");
|
||||||
$room_array = array();
|
$room_array = array();
|
||||||
foreach ($rooms as $room)
|
foreach ($rooms as $room)
|
||||||
$room_array[$room['RID']] = $room['Name'];
|
$room_array[$room['RID']] = $room['Name'];
|
||||||
|
|
||||||
// Löschen einzelner Schicht-Einträge (Also Belegung einer Schicht von Engeln) durch Admins
|
// Löschen einzelner Schicht-Einträge (Also Belegung einer Schicht von Engeln) durch Admins
|
||||||
if (isset($_REQUEST['entry_id']) && in_array('user_shifts_admin', $privileges)) {
|
if (isset($_REQUEST['entry_id']) && in_array('user_shifts_admin', $privileges)) {
|
||||||
if (isset($_REQUEST['entry_id']) && test_request_int('entry_id'))
|
if (isset($_REQUEST['entry_id']) && test_request_int('entry_id'))
|
||||||
$entry_id = $_REQUEST['entry_id'];
|
$entry_id = $_REQUEST['entry_id'];
|
||||||
else
|
else
|
||||||
redirect(page_link_to('user_shifts'));
|
redirect(page_link_to('user_shifts'));
|
||||||
|
|
||||||
$shift_entry_source = sql_select("
|
$shift_entry_source = sql_select("
|
||||||
SELECT `User`.`Nick`, `ShiftEntry`.`Comment`, `ShiftEntry`.`UID`, `ShiftTypes`.`name`, `Shifts`.*, `Room`.`Name`, `AngelTypes`.`name` as `angel_type`
|
SELECT `User`.`Nick`, `ShiftEntry`.`Comment`, `ShiftEntry`.`UID`, `ShiftTypes`.`name`, `Shifts`.*, `Room`.`Name`, `AngelTypes`.`name` as `angel_type`
|
||||||
FROM `ShiftEntry`
|
FROM `ShiftEntry`
|
||||||
JOIN `User` ON (`User`.`UID`=`ShiftEntry`.`UID`)
|
JOIN `User` ON (`User`.`UID`=`ShiftEntry`.`UID`)
|
||||||
JOIN `AngelTypes` ON (`ShiftEntry`.`TID` = `AngelTypes`.`id`)
|
JOIN `AngelTypes` ON (`ShiftEntry`.`TID` = `AngelTypes`.`id`)
|
||||||
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
JOIN `Shifts` ON (`ShiftEntry`.`SID` = `Shifts`.`SID`)
|
||||||
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
JOIN `ShiftTypes` ON (`ShiftTypes`.`id` = `Shifts`.`shifttype_id`)
|
||||||
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
JOIN `Room` ON (`Shifts`.`RID` = `Room`.`RID`)
|
||||||
WHERE `ShiftEntry`.`id`='" . sql_escape($entry_id) . "'");
|
WHERE `ShiftEntry`.`id`='" . sql_escape($entry_id) . "'");
|
||||||
if (count($shift_entry_source) > 0) {
|
if (count($shift_entry_source) > 0) {
|
||||||
$shift_entry_source = $shift_entry_source[0];
|
$shift_entry_source = $shift_entry_source[0];
|
||||||
|
|
||||||
$result = ShiftEntry_delete($entry_id);
|
$result = ShiftEntry_delete($entry_id);
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
engelsystem_error('Unable to delete shift entry.');
|
engelsystem_error('Unable to delete shift entry.');
|
||||||
|
|
||||||
engelsystem_log("Deleted " . User_Nick_render($shift_entry_source) . "'s shift: " . $shift_entry_source['name'] . " at " . $shift_entry_source['Name'] . " from " . date("y-m-d H:i", $shift_entry_source['start']) . " to " . date("y-m-d H:i", $shift_entry_source['end']) . " as " . $shift_entry_source['angel_type']);
|
engelsystem_log("Deleted " . User_Nick_render($shift_entry_source) . "'s shift: " . $shift_entry_source['name'] . " at " . $shift_entry_source['Name'] . " from " . date("Y-m-d H:i", $shift_entry_source['start']) . " to " . date("Y-m-d H:i", $shift_entry_source['end']) . " as " . $shift_entry_source['angel_type']);
|
||||||
success(_("Shift entry deleted."));
|
success(_("Shift entry deleted."));
|
||||||
} else
|
} else
|
||||||
error(_("Entry not found."));
|
error(_("Entry not found."));
|
||||||
|
@ -161,8 +161,8 @@ function user_shifts() {
|
||||||
sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`='" . sql_escape($shift_id) . "', `angel_type_id`='" . sql_escape($type_id) . "', `count`='" . sql_escape($count) . "'");
|
sql_query("INSERT INTO `NeededAngelTypes` SET `shift_id`='" . sql_escape($shift_id) . "', `angel_type_id`='" . sql_escape($type_id) . "', `count`='" . sql_escape($count) . "'");
|
||||||
$needed_angel_types_info[] = $angel_types[$type_id]['name'] . ": " . $count;
|
$needed_angel_types_info[] = $angel_types[$type_id]['name'] . ": " . $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
engelsystem_log("Updated shift '" . $name . "' from " . date("y-m-d H:i", $start) . " to " . date("y-m-d H:i", $end) . " with angel types " . join(", ", $needed_angel_types_info));
|
engelsystem_log("Updated shift '" . $name . "' from " . date("Y-m-d H:i", $start) . " to " . date("Y-m-d H:i", $end) . " with angel types " . join(", ", $needed_angel_types_info));
|
||||||
success(_("Shift updated."));
|
success(_("Shift updated."));
|
||||||
|
|
||||||
redirect(shift_link([
|
redirect(shift_link([
|
||||||
|
@ -294,7 +294,7 @@ function user_shifts() {
|
||||||
sql_query("INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES ('" . sql_escape($user_id) . "', '" . sql_escape($selected_type_id) . "')");
|
sql_query("INSERT INTO `UserAngelTypes` (`user_id`, `angeltype_id`) VALUES ('" . sql_escape($user_id) . "', '" . sql_escape($selected_type_id) . "')");
|
||||||
|
|
||||||
$user_source = User($user_id);
|
$user_source = User($user_id);
|
||||||
engelsystem_log("User " . User_Nick_render($user_source) . " signed up for shift " . $shift['name'] . " from " . date("y-m-d H:i", $shift['start']) . " to " . date("y-m-d H:i", $shift['end']));
|
engelsystem_log("User " . User_Nick_render($user_source) . " signed up for shift " . $shift['name'] . " from " . date("Y-m-d H:i", $shift['start']) . " to " . date("Y-m-d H:i", $shift['end']));
|
||||||
success(_("You are subscribed. Thank you!") . ' <a href="' . page_link_to('user_myshifts') . '">' . _("My shifts") . ' »</a>');
|
success(_("You are subscribed. Thank you!") . ' <a href="' . page_link_to('user_myshifts') . '">' . _("My shifts") . ' »</a>');
|
||||||
redirect(shift_link($shift));
|
redirect(shift_link($shift));
|
||||||
}
|
}
|
||||||
|
@ -530,7 +530,7 @@ function view_user_shifts() {
|
||||||
$thistime = $first + ($i * 15 * 60);
|
$thistime = $first + ($i * 15 * 60);
|
||||||
if ($thistime % (24 * 60 * 60) == 23 * 60 * 60 && $endtime - $starttime > 24 * 60 * 60) {
|
if ($thistime % (24 * 60 * 60) == 23 * 60 * 60 && $endtime - $starttime > 24 * 60 * 60) {
|
||||||
$shifts_table .= "<tr class=\"row-day\"><th class=\"row-header\">";
|
$shifts_table .= "<tr class=\"row-day\"><th class=\"row-header\">";
|
||||||
$shifts_table .= date('y-m-d<b\r />H:i', $thistime);
|
$shifts_table .= date('Y-m-d<b\r />H:i', $thistime);
|
||||||
} elseif ($thistime % (60 * 60) == 0) {
|
} elseif ($thistime % (60 * 60) == 0) {
|
||||||
$shifts_table .= "<tr class=\"row-hour\"><th>";
|
$shifts_table .= "<tr class=\"row-hour\"><th>";
|
||||||
$shifts_table .= date("H:i", $thistime);
|
$shifts_table .= date("H:i", $thistime);
|
||||||
|
|
|
@ -87,7 +87,7 @@ function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source,
|
||||||
div('col-sm-3 col-xs-6', [
|
div('col-sm-3 col-xs-6', [
|
||||||
'<h4>' . _('Start') . '</h4>',
|
'<h4>' . _('Start') . '</h4>',
|
||||||
'<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">',
|
'<p class="lead' . (time() >= $shift['start'] ? ' text-success' : '') . '">',
|
||||||
glyph('calendar') . date('y-m-d', $shift['start']),
|
glyph('calendar') . date('Y-m-d', $shift['start']),
|
||||||
'<br />',
|
'<br />',
|
||||||
glyph('time') . date('H:i', $shift['start']),
|
glyph('time') . date('H:i', $shift['start']),
|
||||||
'</p>'
|
'</p>'
|
||||||
|
@ -95,7 +95,7 @@ function Shift_view($shift, $shifttype, $room, $shift_admin, $angeltypes_source,
|
||||||
div('col-sm-3 col-xs-6', [
|
div('col-sm-3 col-xs-6', [
|
||||||
'<h4>' . _('End') . '</h4>',
|
'<h4>' . _('End') . '</h4>',
|
||||||
'<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">',
|
'<p class="lead' . (time() >= $shift['end'] ? ' text-success' : '') . '">',
|
||||||
glyph('calendar') . date('y-m-d', $shift['end']),
|
glyph('calendar') . date('Y-m-d', $shift['end']),
|
||||||
'<br />',
|
'<br />',
|
||||||
glyph('time') . date('H:i', $shift['end']),
|
glyph('time') . date('H:i', $shift['end']),
|
||||||
'</p>'
|
'</p>'
|
||||||
|
|
Loading…
Reference in New Issue