-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathilTestArchiveCreatorNotification.php
More file actions
38 lines (33 loc) · 1.03 KB
/
ilTestArchiveCreatorNotification.php
File metadata and controls
38 lines (33 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
class ilTestArchiveCreatorNotification
{
/** @var array<int, string[]> login => links */
private array $notifications = [];
public function __construct(
private ilTestArchiveCreatorPlugin $plugin,
private ilMail $mail
) {
}
public function addNotification(int $user_id, string $link)
{
$this->notifications[$user_id][] = $link;
}
public function sendNotifications()
{
foreach ($this->notifications as $user_id => $links) {
$login = ilObjUser::_lookupLogin($user_id);
$language = ilObjUser::_lookupLanguage($user_id);
if ($login !== '') {
$this->mail->enqueue(
$login,
'',
'',
$this->plugin->txt('notification_subject', $language),
$this->plugin->txt('notification_message', $language) . "\n\n" . implode("\n", $links),
[]
);
}
}
}
}