ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExerciseMailNotification.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once './Services/Mail/classes/class.ilMailNotification.php';
5 
13 {
16 
20  public function __construct()
21  {
23  }
24 
30  function setAssignmentId($a_val)
31  {
32  $this->ass_id = $a_val;
33  }
34 
40  function getAssignmentId()
41  {
42  return $this->ass_id;
43  }
44 
49  public function send()
50  {
51  global $ilUser;
52 
53  parent::send();
54 
55  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
56 
57  switch($this->getType())
58  {
59  case self::TYPE_FEEDBACK_FILE_ADDED:
60 
61  foreach($this->getRecipients() as $rcp)
62  {
63  $this->initLanguage($rcp);
64  $this->initMail();
65  $this->setSubject(
66  sprintf($this->getLanguageText('exc_msg_new_feedback_file_uploaded'),
67  $this->getObjectTitle(true))
68  );
69  $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
70  $this->appendBody("\n\n");
71  $this->appendBody(
72  $this->getLanguageText('exc_msg_new_feedback_file_uploaded2'));
73  $this->appendBody("\n");
74  $this->appendBody(
75  $this->getLanguageText('obj_exc').": ".$this->getObjectTitle(true));
76  $this->appendBody("\n");
77  $this->appendBody(
78  $this->getLanguageText('exc_assignment').": ".
80  $this->appendBody("\n\n");
81  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
82  $this->appendBody("\n");
83  $this->appendBody($this->createPermanentLink());
84  $this->getMail()->appendInstallationSignature(true);
85 
86  $this->sendMail(array($rcp),array('system'));
87  }
88  break;
89 
90  case self::TYPE_SUBMISSION_UPLOAD:
91 
92  foreach($this->getRecipients() as $rcp)
93  {
94  $this->initLanguage($rcp);
95  $this->initMail();
96  $this->setSubject(
97  sprintf($this->getLanguageText('exc_submission_notification_subject'),
98  $this->getObjectTitle(true))
99  );
100  $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
101  $this->appendBody("\n\n");
102  $this->appendBody(
103  sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true)));
104  $this->appendBody("\n");
105  $this->appendBody(
106  $this->getLanguageText('exc_assignment').": ".
108  $this->appendBody("\n");
109  $this->appendBody(
110  $this->getLanguageText('user').": ".
111  $ilUser->getFullName());
112  $this->appendBody("\n\n");
113  $this->appendBody(sprintf($this->getLanguageText('exc_submission_notification_link'),
114  $this->createPermanentLink()));
115  $this->getMail()->appendInstallationSignature(true);
116 
117  $this->sendMail(array($rcp),array('system'));
118  }
119  break;
120  }
121  return true;
122  }
123 
129  protected function initLanguage($a_usr_id)
130  {
131  parent::initLanguage($a_usr_id);
132  $this->getLanguage()->loadLanguageModule('exc');
133  }
134 }
135 ?>