mailer functions for shift delete,assign,remove

main
Felix Favre 10 years ago
parent 5b3e5750eb
commit 8f918422f4

@ -6,9 +6,6 @@ function mail_shift_change($old_shift, $new_shift) {
$old_room = Room($old_shift["RID"]);
$new_room = Room($new_shift["RID"]);
foreach ($users as $user) {
if ($user["email_shiftinfo"]) {
$noticable_changes = false;
$message = _("A Shift you are registered on has changed:");
@ -34,7 +31,7 @@ function mail_shift_change($old_shift, $new_shift) {
$noticable_changes = true;
}
if (!noticable_changes) {
if (!$noticable_changes) {
//There are no changes worth sending an E-Mail
return;
}
@ -43,12 +40,58 @@ function mail_shift_change($old_shift, $new_shift) {
$message .= _("The updated Shift:") . "\n";
$message .= $new_shift["name"] . "\n";
$message .= date("y-m-d H:i", $new_shift["start"]) . " - " . date("y-m-d 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";
foreach ($users as $user) {
if ($user["email_shiftinfo"]) {
engelsystem_email_to_user($user, _("[Angelsystem] Your Shift has changed"), $message);
}
}
}
function mail_shift_delete($shift) {
$users = ShiftEntries_by_shift($shift["SID"]);
$room = Room($shift["RID"]);
$message = _("A Shift you are registered on was deleted:") . "\n";
$message .= $shift["name"] . "\n";
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
$message .= $room["Name"] . "\n";
foreach ($users as $user) {
if ($user["email_shiftinfo"]) {
engelsystem_email_to_user($user, _("[Angelsystem] Your Shift was deleted"), $message);
}
}
}
function mail_shift_assign($user, $shift) {
if ($user["email_shiftinfo"]) {
$room = Room($shift["RID"]);
$message = _("You have been assigned to a Shift:") . "\n"
$message .= $shift["name"] . "\n";
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
$message .= $room["Name"] . "\n";
engelsystem_email_to_user($user, _("[Angelsystem] Assigned to Shift"), $message);
}
}
function mail_shift_removed($user, $shift) {
if ($user["email_shiftinfo"]) {
$room = Room($shift["RID"]);
$message = _("You have been removed from a Shift:") . "\n"
$message .= $shift["name"] . "\n";
$message .= date("y-m-d H:i", $shift["start"]) . " - " . date("H:i", $shift["end"]) . "\n";
$message .= $room["Name"] . "\n";
engelsystem_email_to_user($user, _("[Angelsystem] Assigned to Shift"), $message);
}
}
?>

Loading…
Cancel
Save