ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestMailNotification.php
Go to the documentation of this file.
1 <?php
2 
27 {
28  public function __construct()
29  {
31  }
32 
40  public function sendSimpleNotification($owner_id, $title, $usr_data)
41  {
42  $this->initLanguage($owner_id);
43  $this->language->loadLanguageModule('assessment');
44  $this->initMail();
45  $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
46  $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
47  $this->appendBody("\n\n");
48  $this->appendBody($this->language->txt('user_has_finished_a_test'));
49  $this->appendBody("\n\n");
50 
51  $this->appendBody($this->language->txt('title') . ': ' . $title);
52  $this->appendBody("\n");
53  $this->appendBody($this->language->txt('tst_participant') . ': ' . $usr_data);
54  $this->appendBody("\n");
55 
57  $this->appendBody($this->language->txt('tst_finished') . ': ' . ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
58  $this->appendBody("\n\n");
59 
60  $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
61  $this->appendBody("\n");
62  $this->getMail()->appendInstallationSignature(true);
63 
64  $this->sendMail(array($owner_id));
65  }
66 
74  public function sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
75  {
76  $this->initLanguage($owner_id);
77  $this->language->loadLanguageModule('assessment');
78 
79  $this->initMail();
80  $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
81  $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
82  $this->appendBody("\n\n");
83  $this->appendBody($this->language->txt('user_has_finished_a_test'));
84  $this->appendBody("\n\n");
85 
86  $this->appendBody($this->language->txt('title') . ': ' . $title);
87  $this->appendBody("\n");
88  $this->appendBody($this->language->txt('tst_participant') . ': ' . $usr_data);
89  $this->appendBody("\n");
90 
92  $this->appendBody($this->language->txt('tst_finished') . ': ' . ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
93  $this->appendBody("\n\n");
94 
95  $this->appendBody($this->language->txt('tst_attached_xls_file'));
96  $this->appendBody("\n\n");
97 
98  $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
99  $this->appendBody("\n");
100 
101  $this->setAttachments($file_names);
102  $this->getMail()->appendInstallationSignature(true);
103 
104  $this->sendMail(array($owner_id));
105  }
106 }
sendMail(array $a_rcp, bool $a_parse_recipients=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
Base class for course/group mail notifications.
sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
send an advanced notification to the owner of the test
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
sendSimpleNotification($owner_id, $title, $usr_data)
Send a simple notification to the owner of the test.
__construct(Container $dic, ilPlugin $plugin)
setSubject(string $a_subject)
static setUseRelativeDates(bool $a_status)
set use relative dates