ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables 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 ()
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct (bool $a_is_personal_workspace=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
 
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 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

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 = []
 
bool $is_in_wsp
 
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 31 of file class.ilExerciseMailNotification.php.

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

32  {
33  global $DIC;
34 
35  $this->user = $DIC->user();
37  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getAssignmentId()

ilExerciseMailNotification::getAssignmentId ( )

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

References $ass_id.

Referenced by send().

44  : int
45  {
46  return $this->ass_id;
47  }
+ Here is the caller graph for this function:

◆ initLanguage()

ilExerciseMailNotification::initLanguage ( int  $a_usr_id)
protected

Add language module exc.

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

References ilMailNotification\getLanguage().

Referenced by send().

199  : void
200  {
201  parent::initLanguage($a_usr_id);
202  $this->getLanguage()->loadLanguageModule('exc');
203  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilExerciseMailNotification::send ( )

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

References $ilUser, $user, ilMailNotification\appendBody(), 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.

49  : bool
50  {
52  // parent::send();
53 
54  switch ($this->getType()) {
55  case self::TYPE_FEEDBACK_FILE_ADDED:
56 
57  foreach ($this->getRecipients() as $rcp) {
58  $this->initLanguage($rcp);
59  $this->initMail();
60  $this->setSubject(
61  sprintf(
62  $this->getLanguageText('exc_msg_new_feedback_file_uploaded'),
63  $this->getObjectTitle(true)
64  )
65  );
66  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
67  $this->appendBody("\n\n");
68  $this->appendBody(
69  $this->getLanguageText('exc_msg_new_feedback_file_uploaded2')
70  );
71  $this->appendBody("\n");
72  $this->appendBody(
73  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
74  );
75  $this->appendBody("\n");
76  $this->appendBody(
77  $this->getLanguageText('exc_assignment') . ": " .
79  );
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));
88  }
89  break;
90 
91  case self::TYPE_SUBMISSION_UPLOAD:
92 
93  foreach ($this->getRecipients() as $rcp) {
94  $this->initLanguage($rcp);
95  $this->initMail();
96  $this->setSubject(
97  sprintf(
98  $this->getLanguageText('exc_submission_notification_subject'),
99  $this->getObjectTitle(true)
100  )
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  );
107  $this->appendBody("\n");
108  $this->appendBody(
109  $this->getLanguageText('exc_assignment') . ": " .
111  );
112  $this->appendBody("\n");
113  $this->appendBody(
114  $this->getLanguageText('user') . ": " .
115  $ilUser->getFullname()
116  );
117  $this->appendBody("\n\n");
118  $this->appendBody(sprintf(
119  $this->getLanguageText('exc_submission_notification_link'),
120  $this->createPermanentLink()
121  ));
122 
124  $this->appendBody("\n\n");
125 
126  //new files uploaded
127  //$assignment = new ilExAssignment($this->getAssignmentId());
128  //$submission = new ilExSubmission($assignment, $ilUser->getId());
129 
130  // since mails are sent immediately after upload the files should always be new
131  //if($submission->lookupNewFiles($submission->getTutor()))
132  //{
133  $this->appendBody(sprintf(
134  $this->getLanguageText('exc_submission_downloads_notification_link'),
135  $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_" . $ilUser->getId() . "_setdownload")
136  ));
137  //}
138  //else
139  //{
140  // $this->appendBody(sprintf($this->getLanguageText('exc_submission_downloads_notification_link'),
141  // $this->getLanguageText("exc_submission_no_new_files")));
142  //}
143  }
144 
145  $this->appendBody("\n\n");
146  $this->appendBody(sprintf(
147  $this->getLanguageText('exc_submission_and_grades_notification_link'),
148  $this->createPermanentLink(array(), "_" . $this->getAssignmentId() . "_grades")
149  ));
150 
151  $this->getMail()->appendInstallationSignature(true);
152 
153  $this->sendMail(array($rcp));
154  }
155  break;
156 
157  case self::TYPE_FEEDBACK_TEXT_ADDED:
158 
159  foreach ($this->getRecipients() as $rcp) {
160  $this->initLanguage($rcp);
161  $this->initMail();
162  $this->setSubject(
163  sprintf(
164  $this->getLanguageText('exc_msg_new_feedback_text_uploaded'),
165  $this->getObjectTitle(true)
166  )
167  );
168  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
169  $this->appendBody("\n\n");
170  $this->appendBody(
171  $this->getLanguageText('exc_msg_new_feedback_text_uploaded2')
172  );
173  $this->appendBody("\n");
174  $this->appendBody(
175  $this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true)
176  );
177  $this->appendBody("\n");
178  $this->appendBody(
179  $this->getLanguageText('exc_assignment') . ": " .
181  );
182  $this->appendBody("\n\n");
183  $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
184  $this->appendBody("\n");
185  $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) .
186  '#fb' . $this->getAssignmentId());
187  $this->getMail()->appendInstallationSignature(true);
188 
189  $this->sendMail(array($rcp));
190  }
191  break;
192  }
193  return true;
194  }
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
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
getLanguageText(string $a_keyword)
getObjectTitle(bool $a_shorten=false)
createPermanentLink(array $a_params=[], string $a_append='')
$ilUser
Definition: imgupload.php:34
setSubject(string $a_subject)
+ Here is the call graph for this function:

◆ setAssignmentId()

ilExerciseMailNotification::setAssignmentId ( int  $a_val)

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

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

Field Documentation

◆ $ass_id

int ilExerciseMailNotification::$ass_id
protected

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

Referenced by getAssignmentId().

◆ $user

ilObjUser ilExerciseMailNotification::$user
protected

Definition at line 28 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: