ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilMailNotification Class Reference
+ Inheritance diagram for ilMailNotification:
+ Collaboration diagram for ilMailNotification:

Public Member Functions

 __construct (protected bool $is_in_wsp=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

final const int SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 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

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 = []
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Detailed Description

Definition at line 21 of file class.ilMailNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailNotification::__construct ( protected bool  $is_in_wsp = false)

Reimplemented in ilSystemNotification.

Definition at line 41 of file class.ilMailNotification.php.

42 {
43 global $DIC;
45 $this->language = ilLanguageFactory::_getLanguage($DIC->language()->getDefaultLanguage());
46
47 if ($this->is_in_wsp) {
48 $this->wsp_tree = new ilWorkspaceTree($DIC->user()->getId()); // owner of tree is irrelevant
49 $this->wsp_access_handler = new ilWorkspaceAccessHandler($this->wsp_tree);
50 }
51 }
static _getLanguage(string $a_lang_key='')
Get language object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ANONYMOUS_USER_ID
Definition: constants.php:27
global $DIC
Definition: shib_login.php:26

References $DIC, ilLanguageFactory\_getLanguage(), ANONYMOUS_USER_ID, ILIAS\UI\examples\Symbol\Glyph\Language\language(), and setSender().

+ Here is the call graph for this function:

Member Function Documentation

◆ appendBody()

◆ createPermanentLink()

ilMailNotification::createPermanentLink ( array  $a_params = [],
string  $a_append = '' 
)
protected

Definition at line 259 of file class.ilMailNotification.php.

259 : ?string
260 {
261 if ($this->getRefId() !== 0) {
262 if (!$this->is_in_wsp) {
263 return ilLink::_getLink($this->ref_id, $this->getObjType(), $a_params, $a_append);
264 }
265 return ilWorkspaceAccessHandler::getGotoLink($this->getRefId(), $this->getObjId(), $a_append);
266 }
267 return ilLink::_getLink(ROOT_FOLDER_ID, 'root');
268 }
static getGotoLink(int $a_node_id, int $a_obj_id, string $a_additional="")
const ROOT_FOLDER_ID
Definition: constants.php:32

References ilWorkspaceAccessHandler\getGotoLink(), getObjId(), getObjType(), getRefId(), and ROOT_FOLDER_ID.

Referenced by ilCalendarMailNotification\send(), ilCourseMembershipMailNotification\send(), ilGroupMembershipMailNotification\send(), ilLMMailNotification\send(), ilLearningSequenceMembershipMailNotification\send(), and ilSessionMembershipMailNotification\send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdditionalInformation()

◆ getAttachments()

ilMailNotification::getAttachments ( )

Definition at line 117 of file class.ilMailNotification.php.

117 : array
118 {
119 return $this->attachments;
120 }

References $attachments.

Referenced by ilCalendarMailNotification\deleteAttachments(), and sendMail().

+ Here is the caller graph for this function:

◆ getBlockBorder()

ilMailNotification::getBlockBorder ( )

Definition at line 312 of file class.ilMailNotification.php.

312 : string
313 {
314 return "----------------------------------------\n";
315 }

◆ getBody()

ilMailNotification::getBody ( )
protected

Definition at line 97 of file class.ilMailNotification.php.

97 : string
98 {
99 return $this->body;
100 }

References $body.

Referenced by ilMailSummaryNotification\send(), sendMail(), and ilMimeMailNotification\sendMimeMail().

+ Here is the caller graph for this function:

◆ getLanguage()

ilMailNotification::getLanguage ( )
protected

Definition at line 159 of file class.ilMailNotification.php.

159 : ilLanguage
160 {
161 return $this->language;
162 }
language handling

References $language.

Referenced by ilTestManScoringParticipantNotification\__construct(), ILIAS\Portfolio\Notification\SharedNotification\appendObjectInformation(), ilTestManScoringParticipantNotification\buildBody(), ILIAS\Mail\Cron\ExpiredOrOrphanedMails\MailNotification\buildFolderTitle(), getLanguageText(), ilCourseMembershipMailNotification\initLanguage(), ilGroupMembershipMailNotification\initLanguage(), ilLMMailNotification\initLanguage(), ilMimeMailNotification\initLanguage(), ILIAS\Portfolio\Notification\SharedNotification\initLanguage(), ilRegistrationMailNotification\initLanguage(), ilSessionMembershipMailNotification\initLanguage(), ilCronDeleteInactiveUserReminderMailNotification\initLanguage(), ilLearningSequenceMembershipMailNotification\initLanguage(), ilMimeMailNotification\initLanguageByIso2Code(), ILIAS\Mail\Cron\ExpiredOrOrphanedMails\MailNotification\initLanguageByIso2Code(), ilCalendarMailNotification\send(), ilCourseMembershipMailNotification\send(), ilExerciseMailNotification\send(), ilGroupMembershipMailNotification\send(), ilLMMailNotification\send(), ilLearningSequenceMembershipMailNotification\send(), ILIAS\Mail\Autoresponder\AutoresponderNotification\send(), ilMailSummaryNotification\send(), ILIAS\Mail\Cron\ExpiredOrOrphanedMails\MailNotification\send(), ILIAS\Portfolio\Notification\SharedNotification\send(), ilRegistrationMailNotification\send(), ilSessionMembershipMailNotification\send(), ilTestMailNotification\sendAdvancedNotification(), and ilTestMailNotification\sendSimpleNotification().

+ Here is the caller graph for this function:

◆ getLanguageText()

◆ getMail()

◆ getObjectTitle()

ilMailNotification::getObjectTitle ( bool  $a_shorten = false)
protected

Definition at line 213 of file class.ilMailNotification.php.

213 : string
214 {
215 if ($this->getObjId() === 0) {
216 return '';
217 }
219 if ($a_shorten) {
220 $txt = ilStr::shortenTextExtended($txt, self::SUBJECT_TITLE_LENGTH, true);
221 }
222 return $txt;
223 }
static _lookupTitle(int $obj_id)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
$txt
Definition: error.php:31

References $txt, ilObject\_lookupTitle(), getObjId(), and ilStr\shortenTextExtended().

Referenced by ilCalendarMailNotification\send(), ilCourseMembershipMailNotification\send(), ilExerciseMailNotification\send(), ilGroupMembershipMailNotification\send(), ilLMMailNotification\send(), ilLearningSequenceMembershipMailNotification\send(), ILIAS\Portfolio\Notification\SharedNotification\send(), and ilSessionMembershipMailNotification\send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjId()

◆ getObjType()

ilMailNotification::getObjType ( )

Definition at line 198 of file class.ilMailNotification.php.

198 : string
199 {
200 return $this->obj_type;
201 }

References $obj_type.

Referenced by createPermanentLink().

+ Here is the caller graph for this function:

◆ getRecipients()

◆ getRefId()

◆ getSender()

ilMailNotification::getSender ( )

Definition at line 68 of file class.ilMailNotification.php.

68 : int
69 {
70 return $this->sender;
71 }

References $sender.

Referenced by ilCalendarMailNotification\addAttachment(), ilCalendarMailNotification\deleteAttachments(), and initMail().

+ Here is the caller graph for this function:

◆ getSubject()

ilMailNotification::getSubject ( )
protected

Definition at line 82 of file class.ilMailNotification.php.

82 : string
83 {
84 return $this->subject;
85 }

References $subject.

Referenced by ilMailSummaryNotification\send(), sendMail(), and ilMimeMailNotification\sendMimeMail().

+ Here is the caller graph for this function:

◆ getType()

◆ getUserLanguage()

ilMailNotification::getUserLanguage ( int  $a_usr_id)

Definition at line 132 of file class.ilMailNotification.php.

132 : ilLanguage
133 {
136
137 foreach ($this->lang_modules as $lmod) {
139 }
140
141 return $language;
142 }
static _getLanguageOfUser(int $a_usr_id)
Get language object of user.
loadLanguageModule(string $a_module)
Load language module.

References $language, ilLanguageFactory\_getLanguageOfUser(), and ilLanguage\loadLanguageModule().

Referenced by initLanguage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initLanguage()

◆ initLanguageByIso2Code()

ilMailNotification::initLanguageByIso2Code ( string  $a_code = '')
protected

Reimplemented in ilMimeMailNotification, and ILIAS\Mail\Cron\ExpiredOrOrphanedMails\MailNotification.

Definition at line 144 of file class.ilMailNotification.php.

144 : void
145 {
147 $this->language->loadLanguageModule('mail');
148
149 foreach ($this->lang_modules as $lmod) {
150 $this->language->loadLanguageModule($lmod);
151 }
152 }

References ilLanguageFactory\_getLanguage(), and ILIAS\UI\examples\Symbol\Glyph\Language\language().

+ Here is the call graph for this function:

◆ initMail()

◆ isRefIdAccessible()

ilMailNotification::isRefIdAccessible ( int  $a_user_id,
int  $a_ref_id,
string  $a_permission = 'read' 
)
protected

Definition at line 278 of file class.ilMailNotification.php.

278 : bool
279 {
280 global $DIC;
281
282 // no given permission == accessible
283
284 if (!$this->is_in_wsp) {
285 if (trim($a_permission) &&
286 !$DIC->access()->checkAccessOfUser(
287 $a_user_id,
288 $a_permission,
289 '',
290 $a_ref_id,
291 $this->getObjType()
292 )) {
293 return false;
294 }
295 } elseif (
296 trim($a_permission) &&
297 !$this->wsp_access_handler->checkAccessOfUser(
298 $this->wsp_tree,
299 $a_user_id,
300 $a_permission,
301 '',
302 $a_ref_id,
303 $this->getObjType()
304 )
305 ) {
306 return false;
307 }
308
309 return true;
310 }

References $DIC.

◆ sendMail()

ilMailNotification::sendMail ( array  $a_rcp,
bool  $a_parse_recipients = true 
)

Reimplemented in ilForumMailNotification, and ilForumMailEventNotificationSender.

Definition at line 225 of file class.ilMailNotification.php.

225 : void
226 {
227 $recipients = [];
228 foreach ($a_rcp as $rcp) {
229 if ($a_parse_recipients) {
230 $recipients[] = ilObjUser::_lookupLogin((int) $rcp);
231 } else {
232 $recipients[] = $rcp;
233 }
234 }
235 $recipients = implode(',', $recipients);
236 $errors = $this->getMail()->enqueue(
238 '',
239 '',
240 $this->getSubject(),
241 $this->getBody(),
242 $this->getAttachments()
243 );
244 if ($errors !== []) {
245 ilLoggerFactory::getLogger('mail')->dump($errors, ilLogLevel::ERROR);
246 }
247 }
static getLogger(string $a_component_id)
Get component logger.
static _lookupLogin(int $a_user_id)

References $recipients, ilObjUser\_lookupLogin(), ilLogLevel\ERROR, getAttachments(), getBody(), ilLoggerFactory\getLogger(), getMail(), and getSubject().

Referenced by ilCalendarMailNotification\send(), ilCourseMembershipMailNotification\send(), ilDataCollectionMailNotification\send(), ilExerciseMailNotification\send(), ilGroupMembershipMailNotification\send(), ilLMMailNotification\send(), ilLearningSequenceMembershipMailNotification\send(), ILIAS\Mail\Autoresponder\AutoresponderNotification\send(), ILIAS\Portfolio\Notification\SharedNotification\send(), ilRegistrationMailNotification\send(), ilTestManScoringParticipantNotification\send(), ilSessionMembershipMailNotification\send(), ilTestMailNotification\sendAdvancedNotification(), and ilTestMailNotification\sendSimpleNotification().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAdditionalInformation()

ilMailNotification::setAdditionalInformation ( array  $a_info)

Definition at line 203 of file class.ilMailNotification.php.

203 : void
204 {
205 $this->additional_info = $a_info;
206 }

◆ setAttachments()

ilMailNotification::setAttachments ( array  $a_att)

Definition at line 112 of file class.ilMailNotification.php.

112 : void
113 {
114 $this->attachments = $a_att;
115 }

Referenced by ilCalendarMailNotification\addAttachment(), ilForumMailNotification\appendAttachments(), and ilTestMailNotification\sendAdvancedNotification().

+ Here is the caller graph for this function:

◆ setBody()

◆ setLangModules()

ilMailNotification::setLangModules ( array  $a_modules)

Definition at line 122 of file class.ilMailNotification.php.

122 : void
123 {
124 $this->lang_modules = $a_modules;
125 }

Referenced by ilIndividualAssessmentPrimitiveInternalNotificator\__construct().

+ Here is the caller graph for this function:

◆ setLanguage()

ilMailNotification::setLanguage ( ilLanguage  $a_language)
protected

Definition at line 154 of file class.ilMailNotification.php.

154 : void
155 {
156 $this->language = $a_language;
157 }

References ILIAS\UI\examples\Symbol\Glyph\Language\language().

Referenced by ilCalendarMailNotification\send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObjId()

ilMailNotification::setObjId ( int  $a_obj_id)

Definition at line 192 of file class.ilMailNotification.php.

192 : void
193 {
194 $this->obj_id = $a_obj_id;
195 $this->obj_type = ilObject::_lookupType($this->obj_id);
196 }
static _lookupType(int $id, bool $reference=false)

References ilObject\_lookupType().

Referenced by setRefId().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setRecipients()

ilMailNotification::setRecipients ( array  $a_rcp)

Definition at line 102 of file class.ilMailNotification.php.

102 : void
103 {
104 $this->recipients = $a_rcp;
105 }

Referenced by ILIAS\Mail\Autoresponder\AutoresponderNotification\__construct(), ilMailSummaryNotification\send(), and ilTestManScoringParticipantNotification\setRecipient().

+ Here is the caller graph for this function:

◆ setRefId()

ilMailNotification::setRefId ( int  $a_id)

Definition at line 169 of file class.ilMailNotification.php.

169 : void
170 {
171 if (!$this->is_in_wsp) {
172 $this->ref_id = $a_id;
173 $obj_id = ilObject::_lookupObjId($this->ref_id);
174 } else {
175 $this->ref_id = $a_id;
176 $obj_id = $this->wsp_tree->lookupObjectId($this->getRefId());
177 }
178
179 $this->setObjId($obj_id);
180 }
static _lookupObjId(int $ref_id)

References $obj_id, ilObject\_lookupObjId(), getRefId(), and setObjId().

Referenced by ilTestManScoringParticipantNotification\__construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSender()

ilMailNotification::setSender ( int  $a_usr_id)

Definition at line 63 of file class.ilMailNotification.php.

63 : void
64 {
65 $this->sender = $a_usr_id;
66 }

Referenced by ILIAS\Mail\Autoresponder\AutoresponderNotification\__construct(), and __construct().

+ Here is the caller graph for this function:

◆ setSubject()

◆ setType()

ilMailNotification::setType ( int  $a_type)

Definition at line 53 of file class.ilMailNotification.php.

53 : void
54 {
55 $this->type = $a_type;
56 }

◆ userToString()

ilMailNotification::userToString ( int  $a_usr_id)
protected

Definition at line 270 of file class.ilMailNotification.php.

270 : string
271 {
272 $name = ilObjUser::_lookupName($a_usr_id);
273 return ($name['title'] ? $name['title'] . ' ' : '') .
274 ($name['firstname'] ? $name['firstname'] . ' ' : '') .
275 ($name['lastname'] ? $name['lastname'] . ' ' : '');
276 }
static _lookupName(int $a_user_id)

References ilObjUser\_lookupName().

Referenced by ilCourseMembershipMailNotification\send(), ilGroupMembershipMailNotification\send(), ilLearningSequenceMembershipMailNotification\send(), and ilSessionMembershipMailNotification\send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $additional_info

array ilMailNotification::$additional_info = []
protected

Definition at line 37 of file class.ilMailNotification.php.

Referenced by getAdditionalInformation().

◆ $attachments

array ilMailNotification::$attachments = []
protected

Definition at line 30 of file class.ilMailNotification.php.

Referenced by getAttachments().

◆ $body

◆ $lang_modules

array ilMailNotification::$lang_modules = []
protected

Definition at line 32 of file class.ilMailNotification.php.

◆ $language

ilLanguage ilMailNotification::$language
protected

Definition at line 31 of file class.ilMailNotification.php.

Referenced by getLanguage(), and getUserLanguage().

◆ $mail

◆ $obj_id

int ilMailNotification::$obj_id = 0
protected

◆ $obj_type

string ilMailNotification::$obj_type = ''
protected

Definition at line 36 of file class.ilMailNotification.php.

Referenced by getObjType().

◆ $recipients

array ilMailNotification::$recipients = []
protected

Definition at line 33 of file class.ilMailNotification.php.

Referenced by getRecipients(), and sendMail().

◆ $ref_id

int ilMailNotification::$ref_id
protected

Definition at line 34 of file class.ilMailNotification.php.

Referenced by getRefId().

◆ $sender

int ilMailNotification::$sender
protected

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

Referenced by getSender(), and ilMailSummaryNotification\send().

◆ $subject

string ilMailNotification::$subject = ''
protected

Definition at line 28 of file class.ilMailNotification.php.

Referenced by getSubject().

◆ $type

◆ $wsp_access_handler

ilWorkspaceAccessHandler ilMailNotification::$wsp_access_handler
protected

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

◆ $wsp_tree

ilWorkspaceTree ilMailNotification::$wsp_tree
protected

Definition at line 38 of file class.ilMailNotification.php.

◆ SUBJECT_TITLE_LENGTH

final const int ilMailNotification::SUBJECT_TITLE_LENGTH = 60

Definition at line 23 of file class.ilMailNotification.php.


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