ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
ilSystemNotification 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 ilSystemNotification:
+ Collaboration diagram for ilSystemNotification:

Public Member Functions

 __construct (protected bool $is_in_wsp=false)
 
 setSubjectLangId (string $a_lang_id)
 
 setSubjectDirect (string $a_text)
 
 setIntroductionLangId (string $a_lang_id)
 
 setIntroductionDirect (string $a_text)
 
 setTaskLangId (string $a_lang_id)
 
 setReasonLangId (string $a_lang_id)
 
 setGotoLangId (string $a_lang_id)
 
 setChangedByUserId (int $a_id)
 
 addAdditionalInfo (string $a_lang_id, string $a_value, bool $a_multiline=false, bool $a_lang_direct=false)
 Add additional information. More...
 
 sendMailAndReturnRecipients (array $a_user_ids, ?string $a_goto_additional=null, string $a_permission="read")
 Send notification(s) More...
 
 composeAndGetMessage (int $a_user_id, ?string $a_goto_additional=null, string $a_permission="read", bool $a_append_signature_direct=false)
 Compose notification to single recipient. More...
 
- Public Member Functions inherited from ilMailNotification
 __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 ()
 

Protected Member Functions

 composeAndSendMail (int $a_user_id, ?string $a_goto_additional=null, string $a_permission="read")
 Send notification to single recipient. 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

string $subject_lang_id = ""
 
string $subject_direct = ""
 
string $introduction = ""
 
string $introduction_direct = ""
 
string $task = ""
 
string $reason = ""
 
array $additional = []
 
string $goto_caption = ""
 
int $changed_by = 0
 
array $all_ref_ids = []
 
- 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 = []
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Additional Inherited Members

- Data Fields inherited from ilMailNotification
final const int SUBJECT_TITLE_LENGTH = 60
 

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 Wrapper classes for system notifications

See also
FeatureWiki/Guidelines/System Notification Guideline
Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

@phpstan-type SystemNotificationAdditionalInfo array{ caption: string, content: string, is_multiline: bool, is_direct_translation: bool }

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilMailNotification.

Definition at line 47 of file class.ilSystemNotification.php.

48 {
49 parent::__construct($is_in_wsp);
50 $this->ref_id = 0;
51 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAdditionalInfo()

ilSystemNotification::addAdditionalInfo ( string  $a_lang_id,
string  $a_value,
bool  $a_multiline = false,
bool  $a_lang_direct = false 
)

Add additional information.

Definition at line 96 of file class.ilSystemNotification.php.

101 : void {
102 $this->additional[] = [
103 'caption' => $a_lang_id,
104 'content' => trim($a_value),
105 'is_direct_translation' => $a_lang_direct,
106 'is_multiline' => $a_multiline
107 ];
108 }

◆ composeAndGetMessage()

ilSystemNotification::composeAndGetMessage ( int  $a_user_id,
?string  $a_goto_additional = null,
string  $a_permission = "read",
bool  $a_append_signature_direct = false 
)

Compose notification to single recipient.

Definition at line 332 of file class.ilSystemNotification.php.

337 : string {
338 if ($this->compose($a_user_id, $a_goto_additional, $a_permission, $a_append_signature_direct)) {
339 return $this->body;
340 }
341 return "";
342 }

◆ composeAndSendMail()

ilSystemNotification::composeAndSendMail ( int  $a_user_id,
?string  $a_goto_additional = null,
string  $a_permission = "read" 
)
protected

Send notification to single recipient.

Definition at line 317 of file class.ilSystemNotification.php.

321 : bool {
322 if ($this->compose($a_user_id, $a_goto_additional, $a_permission)) {
323 $this->sendMail(array($a_user_id), is_numeric($a_user_id));
324 return true;
325 }
326 return false;
327 }
sendMail(array $a_rcp, bool $a_parse_recipients=true)

◆ sendMailAndReturnRecipients()

ilSystemNotification::sendMailAndReturnRecipients ( array  $a_user_ids,
?string  $a_goto_additional = null,
string  $a_permission = "read" 
)

Send notification(s)

Parameters
array$a_user_ids
?string$a_goto_additional
string$a_permission
Returns
array recipient ids

Definition at line 118 of file class.ilSystemNotification.php.

122 : array {
123 $this->all_ref_ids = null;
124
125 // prepare object related info
126 if ($this->getObjId()) {
127 if (!$this->getRefId()) {
128 // try to find ref_id(s)
129 if (!$this->is_in_wsp) {
130 $ref_ids = ilObject::_getAllReferences($this->getObjId());
131 if (count($ref_ids) === 1) {
132 $this->ref_id = array_shift($ref_ids);
133 } else {
134 $this->all_ref_ids = $ref_ids;
135 }
136 }
137 } elseif ($this->is_in_wsp) { // #11680
138 $this->ref_id = $this->wsp_tree->lookupNodeId($this->getObjId());
139 }
140
141 // default values
142 if (!$this->goto_caption) {
143 $this->goto_caption = "url";
144 }
145 }
146
147 $recipient_ids = array();
148 foreach (array_unique($a_user_ids) as $user_id) {
149 // author of change should not get notification
150 if ($this->changed_by === $user_id) {
151 continue;
152 }
153 if ($this->composeAndSendMail($user_id, $a_goto_additional, $a_permission)) {
154 $recipient_ids[] = $user_id;
155 }
156 }
157
158 return $recipient_ids;
159 }
static _getAllReferences(int $id)
get all reference ids for object ID
composeAndSendMail(int $a_user_id, ?string $a_goto_additional=null, string $a_permission="read")
Send notification to single recipient.

References ilObject\_getAllReferences().

+ Here is the call graph for this function:

◆ setChangedByUserId()

ilSystemNotification::setChangedByUserId ( int  $a_id)

Definition at line 88 of file class.ilSystemNotification.php.

88 : void
89 {
90 $this->changed_by = $a_id;
91 }

◆ setGotoLangId()

ilSystemNotification::setGotoLangId ( string  $a_lang_id)

Definition at line 83 of file class.ilSystemNotification.php.

83 : void
84 {
85 $this->goto_caption = $a_lang_id;
86 }

◆ setIntroductionDirect()

ilSystemNotification::setIntroductionDirect ( string  $a_text)

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

68 : void
69 {
70 $this->introduction_direct = trim($a_text);
71 }

◆ setIntroductionLangId()

ilSystemNotification::setIntroductionLangId ( string  $a_lang_id)

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

63 : void
64 {
65 $this->introduction = $a_lang_id;
66 }

◆ setReasonLangId()

ilSystemNotification::setReasonLangId ( string  $a_lang_id)

Definition at line 78 of file class.ilSystemNotification.php.

78 : void
79 {
80 $this->reason = $a_lang_id;
81 }

◆ setSubjectDirect()

ilSystemNotification::setSubjectDirect ( string  $a_text)

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

58 : void
59 {
60 $this->subject_direct = trim($a_text);
61 }

◆ setSubjectLangId()

ilSystemNotification::setSubjectLangId ( string  $a_lang_id)

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

53 : void
54 {
55 $this->subject_lang_id = $a_lang_id;
56 }

◆ setTaskLangId()

ilSystemNotification::setTaskLangId ( string  $a_lang_id)

Definition at line 73 of file class.ilSystemNotification.php.

73 : void
74 {
75 $this->task = $a_lang_id;
76 }

Field Documentation

◆ $additional

array ilSystemNotification::$additional = []
protected

Definition at line 42 of file class.ilSystemNotification.php.

◆ $all_ref_ids

array ilSystemNotification::$all_ref_ids = []
protected

Definition at line 45 of file class.ilSystemNotification.php.

◆ $changed_by

int ilSystemNotification::$changed_by = 0
protected

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

◆ $goto_caption

string ilSystemNotification::$goto_caption = ""
protected

Definition at line 43 of file class.ilSystemNotification.php.

◆ $introduction

string ilSystemNotification::$introduction = ""
protected

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

◆ $introduction_direct

string ilSystemNotification::$introduction_direct = ""
protected

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

◆ $reason

string ilSystemNotification::$reason = ""
protected

Definition at line 40 of file class.ilSystemNotification.php.

◆ $subject_direct

string ilSystemNotification::$subject_direct = ""
protected

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

◆ $subject_lang_id

string ilSystemNotification::$subject_lang_id = ""
protected

Definition at line 35 of file class.ilSystemNotification.php.

◆ $task

string ilSystemNotification::$task = ""
protected

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


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