ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTestMailNotification.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
29{
30 public function __construct()
31 {
33 }
34
42 public function sendSimpleNotification($owner_id, $title, $usr_data)
43 {
44 $this->initLanguage($owner_id);
45 $this->language->loadLanguageModule('assessment');
46 $this->initMail();
47 $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
48 $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
49 $this->appendBody("\n\n");
50 $this->appendBody($this->language->txt('user_has_finished_a_test'));
51 $this->appendBody("\n\n");
52
53 $this->appendBody($this->language->txt('title') . ': ' . $title);
54 $this->appendBody("\n");
55 $this->appendBody($this->language->txt('tst_participant') . ': ' . $usr_data);
56 $this->appendBody("\n");
57
59 $this->appendBody($this->language->txt('tst_finished') . ': ' . ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
60 $this->appendBody("\n\n");
61
62 $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
63 $this->appendBody("\n");
64 $this->getMail()->appendInstallationSignature(true);
65
66 $this->sendMail([$owner_id]);
67 }
68
76 public function sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
77 {
78 $this->initLanguage($owner_id);
79 $this->language->loadLanguageModule('assessment');
80
81 $this->initMail();
82 $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
83 $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
84 $this->appendBody("\n\n");
85 $this->appendBody($this->language->txt('user_has_finished_a_test'));
86 $this->appendBody("\n\n");
87
88 $this->appendBody($this->language->txt('title') . ': ' . $title);
89 $this->appendBody("\n");
90 $this->appendBody($this->language->txt('tst_participant') . ': ' . $usr_data);
91 $this->appendBody("\n");
92
94 $this->appendBody($this->language->txt('tst_finished') . ': ' . ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
95 $this->appendBody("\n\n");
96
97 $this->appendBody($this->language->txt('tst_attached_xls_file'));
98 $this->appendBody("\n\n");
99
100 $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
101 $this->appendBody("\n");
102
103 $this->setAttachments($file_names);
104 $this->getMail()->appendInstallationSignature(true);
105
106 $this->sendMail([$owner_id]);
107 }
108}
const IL_CAL_UNIX
static setUseRelativeDates(bool $a_status)
set use relative dates
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
sendMail(array $a_rcp, bool $a_parse_recipients=true)
setSubject(string $a_subject)
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
Class ilTestMailNotification.
sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
send an advanced notification to the owner of the test
sendSimpleNotification($owner_id, $title, $usr_data)
Send a simple notification to the owner of the test.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc