ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
class.ilTestMailNotification.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Mail/classes/class.ilMailNotification.php';
5 
14 {
15  public function __construct()
16  {
17  parent::__construct();
18  }
19 
27  public function sendSimpleNotification($owner_id, $title, $usr_data)
28  {
29  $this->initLanguage($owner_id);
30  $this->language->loadLanguageModule('assessment');
31  $this->initMail();
32  $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
33  $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
34  $this->appendBody("\n\n");
35  $this->appendBody($this->language->txt('user_has_finished_a_test'));
36  $this->appendBody("\n\n");
37 
38  $this->appendBody($this->language->txt('title').': '. $title);
39  $this->appendBody("\n");
40  $this->appendBody($this->language->txt('tst_participant').': '. $usr_data);
41  $this->appendBody("\n");
42 
44  $this->appendBody($this->language->txt('tst_finished').': '. ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
45  $this->appendBody("\n\n");
46 
47  $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
48  $this->appendBody("\n");
49  $this->getMail()->appendInstallationSignature(true);
50 
51  $this->sendMail(array($owner_id),array('system'));
52  }
53 
61  public function sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
62  {
63  $this->initLanguage($owner_id);
64  $this->language->loadLanguageModule('assessment');
65 
66  $this->initMail();
67  $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
68  $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
69  $this->appendBody("\n\n");
70  $this->appendBody($this->language->txt('user_has_finished_a_test'));
71  $this->appendBody("\n\n");
72 
73  $this->appendBody($this->language->txt('title').': '. $title);
74  $this->appendBody("\n");
75  $this->appendBody($this->language->txt('tst_participant').': '. $usr_data);
76  $this->appendBody("\n");
77 
79  $this->appendBody($this->language->txt('tst_finished').': '. ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
80  $this->appendBody("\n\n");
81 
82  $this->appendBody($this->language->txt('tst_attached_xls_file'));
83  $this->appendBody("\n\n");
84 
85  $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
86  $this->appendBody("\n");
87 
88  $this->setAttachments($file_names);
89  $this->getMail()->appendInstallationSignature(true);
90 
91  $this->sendMail(array($owner_id),array('system'));
92  }
93 }
getLanguage()
get language object
setBody($a_body)
Set mail body.
sendMail($a_rcp, $a_type, $a_parse_recipients=true)
Send Mail.
initLanguage($a_usr_id)
Init language.
Class ilTestMailNotification.
setAttachments($a_att)
Set attachments.
static setUseRelativeDates($a_status)
set use relative dates
const IL_CAL_UNIX
setSubject($a_subject)
Set mail subject.
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 formatDate(ilDateTime $date)
Format a date public.
Date and time handling
static getSalutation($a_usr_id, $a_language=null)
Get salutation.
sendSimpleNotification($owner_id, $title, $usr_data)
Send a simple notification to the owner of the test.
appendBody($a_body)
Append body text.