engelsystem/includes/mailer/shifts_mailer.php

36 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2014-12-07 18:01:45 +01:00
<?php
2023-01-03 22:19:03 +01:00
use Engelsystem\Models\Shifts\Shift;
2018-10-09 21:47:31 +02:00
use Engelsystem\Models\User\User;
2014-12-07 18:01:45 +01:00
2023-01-03 22:19:03 +01:00
function mail_shift_assign(User $user, Shift $shift)
2017-01-02 03:57:23 +01:00
{
2018-10-09 21:47:31 +02:00
if (!$user->settings->email_shiftinfo) {
2017-01-03 03:22:48 +01:00
return;
}
2017-01-02 15:43:36 +01:00
$message = __('You have been assigned to a Shift:') . "\n";
2023-01-03 22:19:03 +01:00
$message .= $shift->shiftType->name . "\n";
$message .= $shift->title . "\n";
2023-11-23 14:30:46 +01:00
$message .= $shift->start->format(__('general.datetime')) . ' - ' . $shift->end->format(__('H:i')) . "\n";
2023-10-15 19:25:55 +02:00
$message .= $shift->location->name . "\n\n";
2023-01-03 22:19:03 +01:00
$message .= url('/shifts', ['action' => 'view', 'shift_id' => $shift->id]) . "\n";
2017-01-03 03:22:48 +01:00
engelsystem_email_to_user($user, __('Assigned to Shift'), $message, true);
}
2014-12-07 18:01:45 +01:00
2023-01-03 22:19:03 +01:00
function mail_shift_removed(User $user, Shift $shift)
2017-01-02 03:57:23 +01:00
{
2018-10-09 21:47:31 +02:00
if (!$user->settings->email_shiftinfo) {
2017-01-03 03:22:48 +01:00
return;
}
2017-01-02 15:43:36 +01:00
$message = __('You have been removed from a Shift:') . "\n";
2023-01-03 22:19:03 +01:00
$message .= $shift->shiftType->name . "\n";
$message .= $shift->title . "\n";
2023-11-23 14:30:46 +01:00
$message .= $shift->start->format(__('general.datetime')) . ' - ' . $shift->end->format(__('H:i')) . "\n";
2023-10-15 19:25:55 +02:00
$message .= $shift->location->name . "\n";
2017-01-03 03:22:48 +01:00
engelsystem_email_to_user($user, __('Removed from Shift'), $message, true);
2014-12-07 18:01:45 +01:00
}