ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilExerciseMailNotification Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilExerciseMailNotification:
+ Collaboration diagram for ilExerciseMailNotification:

Public Member Functions

 __construct ()
 
 setAssignmentId (int $a_val)
 
 getAssignmentId ()
 
 setPeerId (int $a_val)
 
 getPeerId ()
 
 setAdditionalText (string $a_val)
 
 getAdditionalText ()
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct (protected bool $is_in_wsp=false)
 
 setType (int $a_type)
 
 getType ()
 
 setSender (int $a_usr_id)
 
 getSender ()
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 
 setAttachments (array $a_att)
 
 getAttachments ()
 
 setLangModules (array $a_modules)
 
 getUserLanguage (int $a_usr_id)
 
 setRefId (int $a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId (int $a_obj_id)
 
 getObjType ()
 
 setAdditionalInformation (array $a_info)
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, bool $a_parse_recipients=true)
 
 getBlockBorder ()
 

Data Fields

const TYPE_FEEDBACK_FILE_ADDED = 20
 
const TYPE_SUBMISSION_UPLOAD = 30
 
const TYPE_FEEDBACK_TEXT_ADDED = 40
 
const TYPE_GRADING_DONE = 70
 
const TYPE_MESSAGE_FROM_PF_GIVER = 50
 
const TYPE_MESSAGE_FROM_PF_RECIPIENT = 60
 
const TYPE_DEADLINE_REQUESTED = 70
 
const TYPE_IDL_DEADLINE_SET = 80
 
- Data Fields inherited from ilMailNotification
final const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 addOpenSubmission ()
 
 sendExerciseNotification (int $rcp, string $subject, string $text, string $link="")
 
 initLanguage (int $a_usr_id)
 Add language module exc. More...
 
- Protected Member Functions inherited from ilMailNotification
 setSubject (string $a_subject)
 
 getSubject ()
 
 setBody (string $a_body)
 
 appendBody (string $a_body)
 
 getBody ()
 
 initLanguage (int $a_usr_id)
 
 initLanguageByIso2Code (string $a_code='')
 
 setLanguage (ilLanguage $a_language)
 
 getLanguage ()
 
 getLanguageText (string $a_keyword)
 
 getObjectTitle (bool $a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink (array $a_params=[], string $a_append='')
 
 userToString (int $a_usr_id)
 
 isRefIdAccessible (int $a_user_id, int $a_ref_id, string $a_permission="read")
 

Protected Attributes

ILIAS Exercise InternalDomainService $domain
 
string $additional_text = ""
 
int $peer_id = 0
 
ILIAS Exercise PermanentLink PermanentLinkManager $permanent_link
 
ilObjUser $user
 
int $ass_id
 
- Protected Attributes inherited from ilMailNotification
int $type
 
int $sender
 
ilMail $mail = null
 
string $subject = ''
 
string $body = ''
 
array $attachments = []
 
ilLanguage $language
 
array $lang_modules = []
 
array $recipients = []
 
int $ref_id
 
int $obj_id = 0
 
string $obj_type = ''
 
array $additional_info = []
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 22 of file class.ilExerciseMailNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilExerciseMailNotification::__construct ( )

Definition at line 40 of file class.ilExerciseMailNotification.php.

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\user().

41  {
42  global $DIC;
43 
44  $this->user = $DIC->user();
45  $this->domain = $DIC->exercise()->internal()->domain();
46  $this->permanent_link = $DIC->exercise()->internal()->gui()->permanentLink();
48  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addOpenSubmission()

ilExerciseMailNotification::addOpenSubmission ( )
protected

Definition at line 60 of file class.ilExerciseMailNotification.php.

References ilMailNotification\$type, ilMailNotification\appendBody(), getAssignmentId(), ilExAssignmentTypes\getInstance(), ilMailNotification\getLanguageText(), and ILIAS\Repository\user().

Referenced by send().

60  : void
61  {
62  $ass = new ilExAssignment($this->getAssignmentId());
64  $type = $types->getById($ass->getType());
65  if ($type->supportsWebDirAccess()) {
66  $submission = new ilExSubmission($ass, $this->user->getId());
67  if ($submission->hasSubmittedPrintVersion()) {
68  $this->appendBody("\n\n");
69  $this->appendBody(sprintf(
70  $this->getLanguageText('exc_submission_open_notification_link'),
71  $this->permanent_link->getOpenSubmissionsLink($this->ref_id, $this->getAssignmentId(), $this->user->getId())
72  ));
73  }
74  }
75  }
Exercise assignment.
getLanguageText(string $a_keyword)
Exercise submission //TODO: This class has many static methods related to delivered "files"...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalText()

ilExerciseMailNotification::getAdditionalText ( )

Definition at line 92 of file class.ilExerciseMailNotification.php.

References $additional_text.

Referenced by send().

92  : string
93  {
95  }
+ Here is the caller graph for this function:

◆ getAssignmentId()

ilExerciseMailNotification::getAssignmentId ( )

Definition at line 55 of file class.ilExerciseMailNotification.php.

References $ass_id.

Referenced by addOpenSubmission(), send(), and sendExerciseNotification().

55  : int
56  {
57  return $this->ass_id;
58  }
+ Here is the caller graph for this function:

◆ getPeerId()

ilExerciseMailNotification::getPeerId ( )

Definition at line 82 of file class.ilExerciseMailNotification.php.

References $peer_id.

Referenced by send().

82  : int
83  {
84  return $this->peer_id;
85  }
+ Here is the caller graph for this function:

◆ initLanguage()

ilExerciseMailNotification::initLanguage ( int  $a_usr_id)
protected

Add language module exc.

Definition at line 380 of file class.ilExerciseMailNotification.php.

References ilMailNotification\getLanguage().

Referenced by send(), and sendExerciseNotification().

380  : void
381  {
382  parent::initLanguage($a_usr_id);
383  $this->getLanguage()->loadLanguageModule('exc');
384  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilExerciseMailNotification::send ( )

Definition at line 97 of file class.ilExerciseMailNotification.php.

References $permanent_link, $user, addOpenSubmission(), ilMailNotification\appendBody(), getAdditionalText(), getAssignmentId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), getPeerId(), ilMailNotification\getRecipients(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), ilExAssignment\lookupTitle(), ilExAssignment\lookupType(), sendExerciseNotification(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), and ilExAssignment\TYPE_UPLOAD.

97  : bool
98  {
99  $ilUser = $this->user;
100  $perma = $this->permanent_link;
101  // parent::send();
102 
103  switch ($this->getType()) {
104  case self::TYPE_FEEDBACK_FILE_ADDED:
105 
106  foreach ($this->getRecipients() as $rcp) {
107  $this->initLanguage($rcp);
108  $this->initMail();
109  $this->setSubject(
110  sprintf(
111  $this->getLanguageText('exc_msg_new_feedback_file_uploaded'),
112  $this->getObjectTitle(true)
113  )
114  );
115  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
116  $this->appendBody("\n\n");
117  $this->appendBody(
118  $this->getLanguageText('exc_msg_new_feedback_file_uploaded2')
119  );
120  $this->appendBody("\n");
121  $this->appendBody(
122  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
123  );
124  $this->appendBody("\n");
125  $this->appendBody(
126  $this->getLanguageText('exc_assignment') . ": " .
128  );
129  $this->appendBody("\n\n");
130  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
131  $this->appendBody("\n");
132  $this->appendBody($this->permanent_link->getPermanentLink($this->ref_id, $this->getAssignmentId()));
133  $this->getMail()->appendInstallationSignature(true);
134 
135  $this->sendMail(array($rcp));
136  }
137  break;
138 
139  case self::TYPE_SUBMISSION_UPLOAD:
140 
141  foreach ($this->getRecipients() as $rcp) {
142  $this->initLanguage($rcp);
143  $this->initMail();
144  $this->setSubject(
145  sprintf(
146  $this->getLanguageText('exc_submission_notification_subject'),
147  $this->getObjectTitle(true)
148  )
149  );
150  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
151  $this->appendBody("\n\n");
152  $this->appendBody(
153  sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true))
154  );
155  $this->appendBody("\n");
156  $this->appendBody(
157  $this->getLanguageText('exc_assignment') . ": " .
159  );
160  $this->appendBody("\n");
161  $this->appendBody(
162  $this->getLanguageText('user') . ": " .
163  $ilUser->getFullname()
164  );
165  $this->appendBody("\n\n");
166  $this->appendBody(sprintf(
167  $this->getLanguageText('exc_submission_notification_link'),
168  $this->permanent_link->getPermanentLink($this->ref_id, $this->getAssignmentId())
169  ));
170 
172  $this->appendBody("\n\n");
173 
174  //new files uploaded
175  //$assignment = new ilExAssignment($this->getAssignmentId());
176  //$submission = new ilExSubmission($assignment, $ilUser->getId());
177 
178  // since mails are sent immediately after upload the files should always be new
179  //if($submission->lookupNewFiles($submission->getTutor()))
180  //{
181  $this->appendBody(sprintf(
182  $this->getLanguageText('exc_submission_downloads_notification_link'),
183  $this->permanent_link->getDownloadSubmissionLink($this->ref_id, $this->getAssignmentId(), $ilUser->getId())
184  ));
185  //}
186  //else
187  //{
188  // $this->appendBody(sprintf($this->getLanguageText('exc_submission_downloads_notification_link'),
189  // $this->getLanguageText("exc_submission_no_new_files")));
190  //}
191  }
192  $this->addOpenSubmission();
193 
194  $this->appendBody("\n\n");
195  $this->appendBody(sprintf(
196  $this->getLanguageText('exc_submission_and_grades_notification_link'),
197  $this->permanent_link->getGradesLink($this->ref_id, $this->getAssignmentId())
198  ));
199 
200  $this->getMail()->appendInstallationSignature(true);
201 
202  $this->sendMail(array($rcp));
203  }
204  break;
205 
206  case self::TYPE_FEEDBACK_TEXT_ADDED:
207 
208  foreach ($this->getRecipients() as $rcp) {
209  $this->initLanguage($rcp);
210  $this->initMail();
211  $this->setSubject(
212  sprintf(
213  $this->getLanguageText('exc_msg_new_feedback_text_uploaded'),
214  $this->getObjectTitle(true)
215  )
216  );
217  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
218  $this->appendBody("\n\n");
219  $this->appendBody(
220  $this->getLanguageText('exc_msg_new_feedback_text_uploaded2')
221  );
222  $this->appendBody("\n");
223  $this->appendBody(
224  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
225  );
226  $this->appendBody("\n");
227  $this->appendBody(
228  $this->getLanguageText('exc_assignment') . ": " .
230  );
231  $this->appendBody("\n\n");
232  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
233  $this->appendBody("\n");
234  $this->appendBody($this->permanent_link->getPermanentLink($this->ref_id, $this->getAssignmentId()));
235  $this->getMail()->appendInstallationSignature(true);
236 
237  $this->sendMail(array($rcp));
238  }
239  break;
240 
241  case self::TYPE_GRADING_DONE:
242 
243  foreach ($this->getRecipients() as $rcp) {
244  $this->initLanguage($rcp);
245  $this->initMail();
246  $this->setSubject(
247  sprintf(
248  $this->getLanguageText('exc_msg_grading_done'),
249  $this->getObjectTitle(true)
250  )
251  );
252  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
253  $this->appendBody("\n\n");
254  $this->appendBody(
255  sprintf(
256  $this->getLanguageText('exc_msg_grading_done_body'),
257  $this->getObjectTitle(false)
258  )
259  );
260  $this->appendBody("\n");
261  $this->appendBody(
262  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
263  );
264  $this->appendBody("\n");
265  $this->appendBody(
266  $this->getLanguageText('exc_assignment') . ": " .
268  );
269  $this->appendBody("\n\n");
270  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
271  $this->appendBody("\n");
272  $this->appendBody($this->permanent_link->getPermanentLink($this->ref_id, $this->getAssignmentId()));
273  $this->getMail()->appendInstallationSignature(true);
274 
275  $this->sendMail(array($rcp));
276  }
277  break;
278 
279  case self::TYPE_MESSAGE_FROM_PF_GIVER:
280 
281  foreach ($this->getRecipients() as $rcp) {
282  $this->initLanguage($rcp);
284  $rcp,
285  sprintf(
286  $this->getLanguageText('exc_msg_new_message_from_pf_giver'),
287  $this->getObjectTitle(true)
288  ),
289  $this->getLanguageText('exc_msg_new_message_from_pf_giver2') .
290  "\n\n" . $this->getAdditionalText(),
291  $perma->getReceivedFeedbackLink($this->ref_id, $this->getAssignmentId())
292  );
293  }
294  break;
295 
296  case self::TYPE_MESSAGE_FROM_PF_RECIPIENT:
297 
298  foreach ($this->getRecipients() as $rcp) {
299  $this->initLanguage($rcp);
301  $rcp,
302  sprintf(
303  $this->getLanguageText('exc_msg_new_message_from_pf_recipient'),
304  $this->getObjectTitle(true)
305  ),
306  $this->getLanguageText('exc_msg_new_message_from_pf_recipient2') .
307  "\n\n" . $this->getAdditionalText(),
308  $perma->getGivenFeedbackLink($this->ref_id, $this->getAssignmentId(), $this->getPeerId())
309  );
310  }
311  break;
312 
313  case self::TYPE_DEADLINE_REQUESTED:
314  foreach ($this->getRecipients() as $rcp) {
315  $this->initLanguage($rcp);
317  $rcp,
318  sprintf(
319  $this->getLanguageText('exc_msg_deadline_request_subject'),
320  $this->getObjectTitle(true)
321  ),
322  $this->getLanguageText('exc_msg_deadline_request_body') .
323  "\n\n" . $this->getLanguageText('user') . ": " .
324  $ilUser->getFullname(),
325  $perma->getGradesLink($this->ref_id, $this->getAssignmentId())
326  );
327  }
328  break;
329 
330  case self::TYPE_IDL_DEADLINE_SET:
331  foreach ($this->getRecipients() as $rcp) {
332  $this->initLanguage($rcp);
334  $rcp,
335  sprintf(
336  $this->getLanguageText('exc_msg_idl_set_subject'),
337  $this->getObjectTitle(true)
338  ),
339  $this->getLanguageText('exc_msg_idl_set_body'),
340  $perma->getPermanentLink($this->ref_id, $this->getAssignmentId())
341  );
342  }
343  break;
344  }
345  return true;
346  }
sendMail(array $a_rcp, bool $a_parse_recipients=true)
static lookupTitle(int $a_id)
static lookupType(int $a_id)
initLanguage(int $a_usr_id)
Add language module exc.
const TYPE_UPLOAD
direct checks against const should be avoided, use type objects instead
sendExerciseNotification(int $rcp, string $subject, string $text, string $link="")
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
getLanguageText(string $a_keyword)
getObjectTitle(bool $a_shorten=false)
setSubject(string $a_subject)
ILIAS Exercise PermanentLink PermanentLinkManager $permanent_link
+ Here is the call graph for this function:

◆ sendExerciseNotification()

ilExerciseMailNotification::sendExerciseNotification ( int  $rcp,
string  $subject,
string  $text,
string  $link = "" 
)
protected

Definition at line 348 of file class.ilExerciseMailNotification.php.

References ilMailNotification\appendBody(), getAssignmentId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMail\getSalutation(), initLanguage(), ilMailNotification\initMail(), ilExAssignment\lookupTitle(), ilMailNotification\sendMail(), ilMailNotification\setBody(), and ilMailNotification\setSubject().

Referenced by send().

353  : void {
354  $this->initLanguage($rcp);
355  $this->initMail();
356  $this->setSubject($subject);
357  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
358  $this->appendBody("\n\n" . $text);
359  $this->appendBody(
360  "\n\n" . $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
361  );
362  $this->appendBody("\n");
363  if ($this->getAssignmentId() > 0) {
364  $this->appendBody(
365  $this->getLanguageText('exc_assignment') . ": " .
367  );
368  }
369  $this->appendBody("\n\n");
370  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
371  $this->appendBody("\n");
372  $this->appendBody($link);
373  $this->getMail()->appendInstallationSignature(true);
374  $this->sendMail(array($rcp));
375  }
sendMail(array $a_rcp, bool $a_parse_recipients=true)
static lookupTitle(int $a_id)
initLanguage(int $a_usr_id)
Add language module exc.
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
getLanguageText(string $a_keyword)
getObjectTitle(bool $a_shorten=false)
setSubject(string $a_subject)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdditionalText()

ilExerciseMailNotification::setAdditionalText ( string  $a_val)

Definition at line 87 of file class.ilExerciseMailNotification.php.

87  : void
88  {
89  $this->additional_text = $a_val;
90  }

◆ setAssignmentId()

ilExerciseMailNotification::setAssignmentId ( int  $a_val)

Definition at line 50 of file class.ilExerciseMailNotification.php.

50  : void
51  {
52  $this->ass_id = $a_val;
53  }

◆ setPeerId()

ilExerciseMailNotification::setPeerId ( int  $a_val)

Definition at line 77 of file class.ilExerciseMailNotification.php.

77  : void
78  {
79  $this->peer_id = $a_val;
80  }

Field Documentation

◆ $additional_text

string ilExerciseMailNotification::$additional_text = ""
protected

Definition at line 33 of file class.ilExerciseMailNotification.php.

Referenced by getAdditionalText().

◆ $ass_id

int ilExerciseMailNotification::$ass_id
protected

Definition at line 38 of file class.ilExerciseMailNotification.php.

Referenced by getAssignmentId().

◆ $domain

ILIAS Exercise InternalDomainService ilExerciseMailNotification::$domain
protected

Definition at line 28 of file class.ilExerciseMailNotification.php.

◆ $peer_id

int ilExerciseMailNotification::$peer_id = 0
protected

Definition at line 34 of file class.ilExerciseMailNotification.php.

Referenced by getPeerId().

◆ $permanent_link

ILIAS Exercise PermanentLink PermanentLinkManager ilExerciseMailNotification::$permanent_link
protected

Definition at line 35 of file class.ilExerciseMailNotification.php.

Referenced by send().

◆ $user

ilObjUser ilExerciseMailNotification::$user
protected

Definition at line 37 of file class.ilExerciseMailNotification.php.

Referenced by send().

◆ TYPE_DEADLINE_REQUESTED

const ilExerciseMailNotification::TYPE_DEADLINE_REQUESTED = 70

◆ TYPE_FEEDBACK_FILE_ADDED

const ilExerciseMailNotification::TYPE_FEEDBACK_FILE_ADDED = 20

◆ TYPE_FEEDBACK_TEXT_ADDED

const ilExerciseMailNotification::TYPE_FEEDBACK_TEXT_ADDED = 40

◆ TYPE_GRADING_DONE

const ilExerciseMailNotification::TYPE_GRADING_DONE = 70

◆ TYPE_IDL_DEADLINE_SET

const ilExerciseMailNotification::TYPE_IDL_DEADLINE_SET = 80

◆ TYPE_MESSAGE_FROM_PF_GIVER

const ilExerciseMailNotification::TYPE_MESSAGE_FROM_PF_GIVER = 50

◆ TYPE_MESSAGE_FROM_PF_RECIPIENT

const ilExerciseMailNotification::TYPE_MESSAGE_FROM_PF_RECIPIENT = 60

◆ TYPE_SUBMISSION_UPLOAD

const ilExerciseMailNotification::TYPE_SUBMISSION_UPLOAD = 30

The documentation for this class was generated from the following file: