ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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 {
17 
21  public function __construct()
22  {
23  parent::__construct();
24  }
25 
31  function setAssignmentId($a_val)
32  {
33  $this->ass_id = $a_val;
34  }
35 
41  function getAssignmentId()
42  {
43  return $this->ass_id;
44  }
45 
50  public function send()
51  {
52  global $ilUser;
53 
54  // parent::send();
55 
56  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
57 
58  switch($this->getType())
59  {
60  case self::TYPE_FEEDBACK_FILE_ADDED:
61 
62  foreach($this->getRecipients() as $rcp)
63  {
64  $this->initLanguage($rcp);
65  $this->initMail();
66  $this->setSubject(
67  sprintf($this->getLanguageText('exc_msg_new_feedback_file_uploaded'),
68  $this->getObjectTitle(true))
69  );
70  $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
71  $this->appendBody("\n\n");
72  $this->appendBody(
73  $this->getLanguageText('exc_msg_new_feedback_file_uploaded2'));
74  $this->appendBody("\n");
75  $this->appendBody(
76  $this->getLanguageText('obj_exc').": ".$this->getObjectTitle(true));
77  $this->appendBody("\n");
78  $this->appendBody(
79  $this->getLanguageText('exc_assignment').": ".
81  $this->appendBody("\n\n");
82  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
83  $this->appendBody("\n");
84  $this->appendBody($this->createPermanentLink(array(), '_'.$this->getAssignmentId()).
85  '#fb'.$this->getAssignmentId());
86  $this->getMail()->appendInstallationSignature(true);
87 
88  $this->sendMail(array($rcp),array('system'));
89  }
90  break;
91 
92  case self::TYPE_SUBMISSION_UPLOAD:
93 
94  foreach($this->getRecipients() as $rcp)
95  {
96  $this->initLanguage($rcp);
97  $this->initMail();
98  $this->setSubject(
99  sprintf($this->getLanguageText('exc_submission_notification_subject'),
100  $this->getObjectTitle(true))
101  );
102  $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
103  $this->appendBody("\n\n");
104  $this->appendBody(
105  sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true)));
106  $this->appendBody("\n");
107  $this->appendBody(
108  $this->getLanguageText('exc_assignment').": ".
110  $this->appendBody("\n");
111  $this->appendBody(
112  $this->getLanguageText('user').": ".
113  $ilUser->getFullName());
114  $this->appendBody("\n\n");
115  $this->appendBody(sprintf($this->getLanguageText('exc_submission_notification_link'),
116  $this->createPermanentLink()));
117  $this->getMail()->appendInstallationSignature(true);
118 
119  $this->sendMail(array($rcp),array('system'));
120  }
121  break;
122 
123  case self::TYPE_FEEDBACK_TEXT_ADDED:
124 
125  foreach($this->getRecipients() as $rcp)
126  {
127  $this->initLanguage($rcp);
128  $this->initMail();
129  $this->setSubject(
130  sprintf($this->getLanguageText('exc_msg_new_feedback_text_uploaded'),
131  $this->getObjectTitle(true))
132  );
133  $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
134  $this->appendBody("\n\n");
135  $this->appendBody(
136  $this->getLanguageText('exc_msg_new_feedback_text_uploaded2'));
137  $this->appendBody("\n");
138  $this->appendBody(
139  $this->getLanguageText('obj_exc').": ".$this->getObjectTitle(true));
140  $this->appendBody("\n");
141  $this->appendBody(
142  $this->getLanguageText('exc_assignment').": ".
144  $this->appendBody("\n\n");
145  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
146  $this->appendBody("\n");
147  $this->appendBody($this->createPermanentLink(array(), '_'.$this->getAssignmentId()).
148  '#fb'.$this->getAssignmentId());
149  $this->getMail()->appendInstallationSignature(true);
150 
151  $this->sendMail(array($rcp),array('system'));
152  }
153  break;
154  }
155  return true;
156  }
157 
163  protected function initLanguage($a_usr_id)
164  {
165  parent::initLanguage($a_usr_id);
166  $this->getLanguage()->loadLanguageModule('exc');
167  }
168 }
169 ?>
getLanguage()
get language object
getType()
Get notification type.
setBody($a_body)
Set mail body.
setAssignmentId($a_val)
Set assignment id.
sendMail($a_rcp, $a_type, $a_parse_recipients=true)
Send Mail.
getLanguageText($a_keyword)
Replace new lines.
setSubject($a_subject)
Set mail subject.
Base class for course/group mail notifications.
getObjectTitle($a_shorten=false)
Get object title.
static getSalutation($a_usr_id, $a_language=null)
Get salutation.
initLanguage($a_usr_id)
Add language module exc.
getRecipients()
get array of recipients
createPermanentLink($a_params=array(), $a_append='')
Create a permanent link for an object.
global $ilUser
Definition: imgupload.php:15
appendBody($a_body)
Append body text.
static lookupTitle($a_id)
Lookup title.