ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExerciseMailNotification Class Reference
+ Inheritance diagram for ilExerciseMailNotification:
+ Collaboration diagram for ilExerciseMailNotification:

Public Member Functions

 __construct ()
 
 setAssignmentId ($a_val)
 Set assignment id. More...
 
 getAssignmentId ()
 Get assignment id. More...
 
 send ()
 Send notifications. More...
 
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 
 setType ($a_type)
 Set notification type. More...
 
 getType ()
 Get notification type. More...
 
 setSender ($a_usr_id)
 Set sender of mail. More...
 
 getSender ()
 get sender of mail More...
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 get array of recipients More...
 
 setAttachments ($a_att)
 Set attachments. More...
 
 getAttachments ()
 Get attachments. More...
 
 setLangModules (array $a_modules)
 Set lang modules. More...
 
 getUserLanguage ($a_usr_id)
 Get user language. More...
 
 setRefId ($a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId ($a_obj_id)
 
 getObjType ()
 Get object type. More...
 
 setAdditionalInformation (array $a_info)
 Additional information for creating notification mails. More...
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, $a_type, $a_parse_recipients=true)
 
 getBlockBorder ()
 Get (ascii) block border. More...
 

Data Fields

const TYPE_FEEDBACK_FILE_ADDED = 20
 
const TYPE_SUBMISSION_UPLOAD = 30
 
const TYPE_FEEDBACK_TEXT_ADDED = 40
 
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 initLanguage ($a_usr_id)
 Add language module exc. More...
 
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 
 getSubject ()
 
 setBody ($a_body)
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 
 getLanguage ()
 
 getLanguageText ($a_keyword)
 
 getObjectTitle ($a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink ($a_params=array(), $a_append='')
 
 userToString ($a_usr_id)
 
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user. More...
 

Protected Attributes

 $user
 
- Protected Attributes inherited from ilMailNotification
 $type = null
 
 $sender = null
 
 $mail = null
 
 $subject = ''
 
 $body = ''
 
 $attachments = array()
 
 $language = null
 
 $lang_modules = array()
 
 $recipients = array()
 
 $ref_id = null
 
 $obj_id = null
 
 $obj_type = null
 
 $additional_info = array()
 
 $is_in_wsp
 
 $wsp_tree
 
 $wsp_access_handler
 

Detailed Description

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilExerciseMailNotification::__construct ( )

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

References $DIC, and user().

27  {
28  global $DIC;
29 
30  $this->user = $DIC->user();
31  parent::__construct();
32  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignmentId()

ilExerciseMailNotification::getAssignmentId ( )

Get assignment id.

Returns
int assignment id

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

Referenced by send().

50  {
51  return $this->ass_id;
52  }
+ Here is the caller graph for this function:

◆ initLanguage()

ilExerciseMailNotification::initLanguage (   $a_usr_id)
protected

Add language module exc.

Parameters
object$a_usr_id
Returns

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

References ilMailNotification\getLanguage().

Referenced by send().

213  {
214  parent::initLanguage($a_usr_id);
215  $this->getLanguage()->loadLanguageModule('exc');
216  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilExerciseMailNotification::send ( )

Send notifications.

Returns

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

References $ilUser, $user, ilMailNotification\appendBody(), array, ilMailNotification\createPermanentLink(), getAssignmentId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), ilExAssignment\lookupTitle(), ilExAssignment\lookupType(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), and ilExAssignment\TYPE_UPLOAD.

59  {
61  // parent::send();
62 
63  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
64 
65  switch ($this->getType()) {
66  case self::TYPE_FEEDBACK_FILE_ADDED:
67 
68  foreach ($this->getRecipients() as $rcp) {
69  $this->initLanguage($rcp);
70  $this->initMail();
71  $this->setSubject(
72  sprintf(
73  $this->getLanguageText('exc_msg_new_feedback_file_uploaded'),
74  $this->getObjectTitle(true)
75  )
76  );
77  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
78  $this->appendBody("\n\n");
79  $this->appendBody(
80  $this->getLanguageText('exc_msg_new_feedback_file_uploaded2')
81  );
82  $this->appendBody("\n");
83  $this->appendBody(
84  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
85  );
86  $this->appendBody("\n");
87  $this->appendBody(
88  $this->getLanguageText('exc_assignment') . ": " .
90  );
91  $this->appendBody("\n\n");
92  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
93  $this->appendBody("\n");
94  $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
95  '#fb' . $this->getAssignmentId());
96  $this->getMail()->appendInstallationSignature(true);
97 
98  $this->sendMail(array($rcp), array('system'));
99  }
100  break;
101 
102  case self::TYPE_SUBMISSION_UPLOAD:
103 
104  foreach ($this->getRecipients() as $rcp) {
105  $this->initLanguage($rcp);
106  $this->initMail();
107  $this->setSubject(
108  sprintf(
109  $this->getLanguageText('exc_submission_notification_subject'),
110  $this->getObjectTitle(true)
111  )
112  );
113  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
114  $this->appendBody("\n\n");
115  $this->appendBody(
116  sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true))
117  );
118  $this->appendBody("\n");
119  $this->appendBody(
120  $this->getLanguageText('exc_assignment') . ": " .
122  );
123  $this->appendBody("\n");
124  $this->appendBody(
125  $this->getLanguageText('user') . ": " .
126  $ilUser->getFullName()
127  );
128  $this->appendBody("\n\n");
129  $this->appendBody(sprintf(
130  $this->getLanguageText('exc_submission_notification_link'),
131  $this->createPermanentLink()
132  ));
133 
135  $this->appendBody("\n\n");
136 
137  //new files uploaded
138  $assignment = new ilExAssignment($this->getAssignmentId());
139  $submission = new ilExSubmission($assignment, $ilUser->getId());
140 
141  // since mails are sent immediately after upload the files should always be new
142  //if($submission->lookupNewFiles($submission->getTutor()))
143  //{
144  $this->appendBody(sprintf(
145  $this->getLanguageText('exc_submission_downloads_notification_link'),
146  $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_" . $ilUser->getId() . "_setdownload")
147  ));
148  //}
149  //else
150  //{
151  // $this->appendBody(sprintf($this->getLanguageText('exc_submission_downloads_notification_link'),
152  // $this->getLanguageText("exc_submission_no_new_files")));
153  //}
154  }
155 
156  $this->appendBody("\n\n");
157  $this->appendBody(sprintf(
158  $this->getLanguageText('exc_submission_and_grades_notification_link'),
159  $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_grades")
160  ));
161 
162  $this->getMail()->appendInstallationSignature(true);
163 
164  $this->sendMail(array($rcp), array('system'));
165  }
166  break;
167 
168  case self::TYPE_FEEDBACK_TEXT_ADDED:
169 
170  foreach ($this->getRecipients() as $rcp) {
171  $this->initLanguage($rcp);
172  $this->initMail();
173  $this->setSubject(
174  sprintf(
175  $this->getLanguageText('exc_msg_new_feedback_text_uploaded'),
176  $this->getObjectTitle(true)
177  )
178  );
179  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
180  $this->appendBody("\n\n");
181  $this->appendBody(
182  $this->getLanguageText('exc_msg_new_feedback_text_uploaded2')
183  );
184  $this->appendBody("\n");
185  $this->appendBody(
186  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
187  );
188  $this->appendBody("\n");
189  $this->appendBody(
190  $this->getLanguageText('exc_assignment') . ": " .
192  );
193  $this->appendBody("\n\n");
194  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
195  $this->appendBody("\n");
196  $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
197  '#fb' . $this->getAssignmentId());
198  $this->getMail()->appendInstallationSignature(true);
199 
200  $this->sendMail(array($rcp), array('system'));
201  }
202  break;
203  }
204  return true;
205  }
getType()
Get notification type.
Exercise assignment.
getObjectTitle($a_shorten=false)
$ilUser
Definition: imgupload.php:18
initLanguage($a_usr_id)
Add language module exc.
Create styles array
The data for the language used.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getRecipients()
get array of recipients
createPermanentLink($a_params=array(), $a_append='')
static lookupType($a_id)
Lookup type.
appendBody($a_body)
Append body text.
Exercise submission.
static lookupTitle($a_id)
Lookup title.
static getSalutation($a_usr_id, ilLanguage $a_language=null)
+ Here is the call graph for this function:

◆ setAssignmentId()

ilExerciseMailNotification::setAssignmentId (   $a_val)

Set assignment id.

Parameters
intassignment id

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

40  {
41  $this->ass_id = $a_val;
42  }

Field Documentation

◆ $user

ilExerciseMailNotification::$user
protected

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

Referenced by send().

◆ TYPE_FEEDBACK_FILE_ADDED

const ilExerciseMailNotification::TYPE_FEEDBACK_FILE_ADDED = 20

◆ TYPE_FEEDBACK_TEXT_ADDED

const ilExerciseMailNotification::TYPE_FEEDBACK_TEXT_ADDED = 40

◆ TYPE_SUBMISSION_UPLOAD

const ilExerciseMailNotification::TYPE_SUBMISSION_UPLOAD = 30

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