ILIAS  Release_4_4_x_branch Revision 61816
 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(array(), '_'.$this->getAssignmentId()).
84  '#fb'.$this->getAssignmentId());
85  $this->getMail()->appendInstallationSignature(true);
86 
87  $this->sendMail(array($rcp),array('system'));
88  }
89  break;
90 
91  case self::TYPE_SUBMISSION_UPLOAD:
92 
93  foreach($this->getRecipients() as $rcp)
94  {
95  $this->initLanguage($rcp);
96  $this->initMail();
97  $this->setSubject(
98  sprintf($this->getLanguageText('exc_submission_notification_subject'),
99  $this->getObjectTitle(true))
100  );
101  $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
102  $this->appendBody("\n\n");
103  $this->appendBody(
104  sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true)));
105  $this->appendBody("\n");
106  $this->appendBody(
107  $this->getLanguageText('exc_assignment').": ".
109  $this->appendBody("\n");
110  $this->appendBody(
111  $this->getLanguageText('user').": ".
112  $ilUser->getFullName());
113  $this->appendBody("\n\n");
114  $this->appendBody(sprintf($this->getLanguageText('exc_submission_notification_link'),
115  $this->createPermanentLink()));
116  $this->getMail()->appendInstallationSignature(true);
117 
118  $this->sendMail(array($rcp),array('system'));
119  }
120  break;
121  }
122  return true;
123  }
124 
130  protected function initLanguage($a_usr_id)
131  {
132  parent::initLanguage($a_usr_id);
133  $this->getLanguage()->loadLanguageModule('exc');
134  }
135 }
136 ?>