ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLearningSequenceMembershipMailNotification Class Reference
+ Inheritance diagram for ilLearningSequenceMembershipMailNotification:
+ Collaboration diagram for ilLearningSequenceMembershipMailNotification:

Public Member Functions

 __construct (ilLogger $logger, ilSetting $settings)
 
 forceSendingMail (bool $status)
 
 send ()
 
- 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_parse_recipients=true)
 
 getBlockBorder ()
 Get (ascii) block border. More...
 

Data Fields

const TYPE_ADMISSION_MEMBER = 20
 
const TYPE_DISMISS_MEMBER = 21
 
const TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22
 
const TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23
 
const TYPE_STATUS_CHANGED = 24
 
const TYPE_BLOCKED_MEMBER = 25
 
const TYPE_UNBLOCKED_MEMBER = 26
 
const TYPE_UNSUBSCRIBE_MEMBER = 27
 
const TYPE_SUBSCRIBE_MEMBER = 28
 
const TYPE_WAITING_LIST_MEMBER = 29
 
const TYPE_NOTIFICATION_REGISTRATION = 30
 
const TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31
 
const TYPE_NOTIFICATION_UNSUBSCRIBE = 32
 
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 initLanguage ($usr_id)
 Init language. More...
 
 createLearningSequenceStatus (int $usr_id)
 
 isNotificationTypeEnabled (int $type)
 
- 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

 $permanent_enabled_notifications
 Notifications which are not affected by "mail_grp_member_notification" setting because they addresses admins. More...
 
 $logger
 
- 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
 

Private Attributes

 $force_sending_mail = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilLearningSequenceMembershipMailNotification::__construct ( ilLogger  $logger,
ilSetting  $settings 
)

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

45 {
47
48 $this->logger = $logger;
49 $this->settings = $settings;
50 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
settings()
Definition: settings.php:2

References $logger, ILIAS\GlobalScreen\Provider\__construct(), and settings().

+ Here is the call graph for this function:

Member Function Documentation

◆ createLearningSequenceStatus()

ilLearningSequenceMembershipMailNotification::createLearningSequenceStatus ( int  $usr_id)
protected

Definition at line 378 of file class.ilLearningSequenceMembershipMailNotification.php.

378 : string
379 {
381 $body = $this->getLanguageText('lso_new_status') . "\n";
382 $body .= $this->getLanguageText('role') . ': ';
383
384 if ($part->isAdmin($usr_id)) {
385 $body .= $this->getLanguageText('il_lso_admin') . "\n";
386 } else {
387 $body .= $this->getLanguageText('il_lso_member') . "\n";
388 }
389
390 if ($part->isAdmin($usr_id)) {
391 $body .= $this->getLanguageText('lso_notification') . ': ';
392
393 if ($part->isNotificationEnabled($usr_id)) {
394 $body .= $this->getLanguageText('lso_notify_on') . "\n";
395 } else {
396 $body .= $this->getLanguageText('lso_notify_off') . "\n";
397 }
398 }
399
400 return $body;
401 }

References ilMailNotification\$body, ilLearningSequenceParticipants\_getInstanceByObjId(), ilMailNotification\getLanguageText(), and ilMailNotification\getObjId().

Referenced by send().

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

◆ forceSendingMail()

ilLearningSequenceMembershipMailNotification::forceSendingMail ( bool  $status)

Definition at line 52 of file class.ilLearningSequenceMembershipMailNotification.php.

53 {
54 $this->force_sending_mail = $status;
55 }

◆ initLanguage()

ilLearningSequenceMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Init language.

Parameters
int$a_usr_id

Reimplemented from ilMailNotification.

Definition at line 372 of file class.ilLearningSequenceMembershipMailNotification.php.

373 {
374 parent::initLanguage($usr_id);
375 $this->getLanguage()->loadLanguageModule('lso');
376 }

References ilMailNotification\getLanguage().

Referenced by send().

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

◆ isNotificationTypeEnabled()

ilLearningSequenceMembershipMailNotification::isNotificationTypeEnabled ( int  $type)
protected

Definition at line 403 of file class.ilLearningSequenceMembershipMailNotification.php.

403 : bool
404 {
405 return (
406 $this->force_sending_mail ||
407 $this->settings->get('mail_lso_member_notification', true) ||
408 in_array($type, $this->permanent_enabled_notifications)
409 );
410 }

References ilMailNotification\$type, and settings().

Referenced by send().

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

◆ send()

ilLearningSequenceMembershipMailNotification::send ( )

Definition at line 57 of file class.ilLearningSequenceMembershipMailNotification.php.

57 : bool
58 {
59 if (!$this->isNotificationTypeEnabled($this->getType())) {
60 $this->logger->info('Membership mail disabled globally.');
61 return false;
62 }
63
64 switch ($this->getType()) {
66 foreach ($this->getRecipients() as $rcp) {
67 $this->initLanguage($rcp);
68 $this->initMail();
69 $this->setSubject(sprintf(
70 $this->getLanguageText('lso_mail_admission_new_sub'),
71 $this->getObjectTitle(true)
72 ));
74 $rcp,
75 $this->getLanguage()
76 ));
77 $this->appendBody("\n\n");
78 $this->appendBody(sprintf(
79 $this->getLanguageText('lso_mail_admission_new_bod'),
80 $this->getObjectTitle()
81 ));
82 $this->appendBody("\n\n");
83 $this->appendBody(
84 $this->getLanguageText('lso_mail_permanent_link')
85 );
86 $this->appendBody("\n\n");
87 $this->appendBody($this->createPermanentLink());
88 $this->getMail()->appendInstallationSignature(true);
89 $this->sendMail(array($rcp));
90 }
91 break;
93 foreach ($this->getRecipients() as $rcp) {
94 $this->initLanguage($rcp);
95 $this->initMail();
96 $this->setSubject(sprintf(
97 $this->getLanguageText('lso_mail_dismiss_sub'),
98 $this->getObjectTitle(true)
99 ));
101 $rcp,
102 $this->getLanguage()
103 ));
104 $this->appendBody("\n\n");
105 $this->appendBody(sprintf(
106 $this->getLanguageText('lso_mail_dismiss_bod'),
107 $this->getObjectTitle()
108 ));
109 $this->getMail()->appendInstallationSignature(true);
110 $this->sendMail(array($rcp));
111 }
112 break;
114 foreach ($this->getRecipients() as $rcp) {
115 $this->initLanguage($rcp);
116 $this->initMail();
117 $this->setSubject(sprintf(
118 $this->getLanguageText('lso_mail_notification_reg_sub'),
119 $this->getObjectTitle(true)
120 ));
122 $rcp,
123 $this->getLanguage()
124 ));
125 $this->appendBody("\n\n");
126 $info = $this->getAdditionalInformation();
127 $this->appendBody(sprintf(
128 $this->getLanguageText('lso_mail_notification_reg_bod'),
129 $this->userToString($info['usr_id']),
130 $this->getObjectTitle()
131 ));
132 $this->appendBody("\n\n");
133 $this->appendBody(
134 $this->getLanguageText('lso_mail_permanent_link')
135 );
136 $this->appendBody("\n\n");
137 $this->appendBody(
138 $this->createPermanentLink(array(), '_mem')
139 );
140 $this->appendBody("\n\n");
141 $this->appendBody($this->getLanguageText(
142 'lso_notification_explanation_admin'
143 ));
144 $this->getMail()->appendInstallationSignature(true);
145 $this->sendMail(array($rcp));
146 }
147 break;
149 foreach ($this->getRecipients() as $rcp) {
150 $this->initLanguage($rcp);
151 $this->initMail();
152 $this->setSubject(sprintf(
153 $this->getLanguageText('lso_mail_unsubscribe_member_sub'),
154 $this->getObjectTitle(true)
155 ));
157 $rcp,
158 $this->getLanguage()
159 ));
160 $this->appendBody("\n\n");
161 $this->appendBody(sprintf(
162 $this->getLanguageText('lso_mail_unsubscribe_member_bod'),
163 $this->getObjectTitle()
164 ));
165 $this->getMail()->appendInstallationSignature(true);
166 $this->sendMail(array($rcp));
167 }
168 break;
170 foreach ($this->getRecipients() as $rcp) {
171 $this->initLanguage($rcp);
172 $this->initMail();
173 $this->setSubject(sprintf(
174 $this->getLanguageText('lso_mail_notification_unsub_sub'),
175 $this->getObjectTitle(true)
176 ));
178 $rcp,
179 $this->getLanguage()
180 ));
181 $this->appendBody("\n\n");
182 $info = $this->getAdditionalInformation();
183 $this->appendBody(sprintf(
184 $this->getLanguageText('lso_mail_notification_unsub_bod'),
185 $this->userToString($info['usr_id']),
186 $this->getObjectTitle()
187 ));
188 $this->appendBody("\n\n");
189 $this->appendBody(
190 $this->getLanguageText(
191 'lso_mail_notification_unsub_bod2'
192 )
193 );
194 $this->appendBody("\n\n");
195 $this->appendBody($this->createPermanentLink(
196 array(),
197 '_mem'
198 ));
199 $this->appendBody("\n\n");
200 $this->appendBody(
201 $this->getLanguageText(
202 'lso_notification_explanation_admin'
203 )
204 );
205 $this->getMail()->appendInstallationSignature(true);
206 $this->sendMail(array($rcp));
207 }
208 break;
210 foreach ($this->getRecipients() as $rcp) {
211 $this->initLanguage($rcp);
212 $this->initMail();
213 $this->setSubject(sprintf(
214 $this->getLanguageText('grp_mail_subscribe_member_sub'),
215 $this->getObjectTitle(true)
216 ));
218 $rcp,
219 $this->getLanguage()
220 ));
221 $this->appendBody("\n\n");
222 $this->appendBody(
223 sprintf(
224 $this->getLanguageText('grp_mail_subscribe_member_bod'),
225 $this->getObjectTitle()
226 )
227 );
228 $this->appendBody("\n\n");
229 $this->appendBody(
230 $this->getLanguageText('grp_mail_permanent_link')
231 );
232 $this->appendBody("\n\n");
233 $this->appendBody($this->createPermanentLink());
234 $this->getMail()->appendInstallationSignature(true);
235 $this->sendMail(array($rcp));
236 }
237 break;
239 foreach ($this->getRecipients() as $rcp) {
240 $this->initLanguage($rcp);
241 $this->initMail();
242 $this->setSubject(sprintf(
243 $this->getLanguageText('grp_mail_notification_reg_req_sub'),
244 $this->getObjectTitle(true)
245 ));
247 $rcp,
248 $this->getLanguage()
249 ));
250 $this->appendBody("\n\n");
251 $info = $this->getAdditionalInformation();
252 $this->appendBody(sprintf(
253 $this->getLanguageText('grp_mail_notification_reg_req_bod'),
254 $this->userToString($info['usr_id']),
255 $this->getObjectTitle()
256 ));
257 $this->appendBody("\n\n");
258 $this->appendBody(
259 $this->getLanguageText('grp_mail_notification_reg_req_bod2')
260 );
261 $this->appendBody("\n");
262 $this->appendBody($this->createPermanentLink(array(), '_mem'));
263 $this->appendBody("\n\n");
264 $this->appendBody(
265 $this->getLanguageText('grp_notification_explanation_admin')
266 );
267 $this->getMail()->appendInstallationSignature(true);
268 $this->sendMail(array($rcp));
269 }
270 break;
272 foreach ($this->getRecipients() as $rcp) {
273 $this->initLanguage($rcp);
274 $this->initMail();
275 $this->setSubject(sprintf(
276 $this->getLanguageText('grp_mail_sub_dec_sub'),
277 $this->getObjectTitle(true)
278 ));
280 $rcp,
281 $this->getLanguage()
282 ));
283 $this->appendBody("\n\n");
284 $this->appendBody(sprintf(
285 $this->getLanguageText('grp_mail_sub_dec_bod'),
286 $this->getObjectTitle()
287 ));
288 $this->getMail()->appendInstallationSignature(true);
289 $this->sendMail(array($rcp));
290 }
291 break;
293 foreach ($this->getRecipients() as $rcp) {
294 $this->initLanguage($rcp);
295 $this->initMail();
296 $this->setSubject(sprintf(
297 $this->getLanguageText('grp_mail_sub_acc_sub'),
298 $this->getObjectTitle(true)
299 ));
300 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
301 $this->appendBody("\n\n");
302 $this->appendBody(sprintf(
303 $this->getLanguageText('grp_mail_sub_acc_bod'),
304 $this->getObjectTitle()
305 ));
306 $this->appendBody("\n\n");
307 $this->appendBody(
308 $this->getLanguageText('grp_mail_permanent_link')
309 );
310 $this->appendBody("\n\n");
311 $this->appendBody($this->createPermanentLink());
312 $this->getMail()->appendInstallationSignature(true);
313 $this->sendMail(array($rcp));
314 }
315 break;
317 foreach ($this->getRecipients() as $rcp) {
318 $this->initLanguage($rcp);
319 $this->initMail();
320 $this->setSubject(sprintf(
321 $this->getLanguageText('grp_mail_wl_sub'),
322 $this->getObjectTitle(true)
323 ));
325 $rcp,
326 $this->getLanguage()
327 ));
328 $info = $this->getAdditionalInformation();
329 $this->appendBody("\n\n");
330 $this->appendBody(sprintf(
331 $this->getLanguageText('grp_mail_wl_bod'),
332 $this->getObjectTitle(),
333 $info['position']
334 ));
335 $this->getMail()->appendInstallationSignature(true);
336 $this->sendMail(array($rcp));
337 }
338 break;
340 foreach ($this->getRecipients() as $rcp) {
341 $this->initLanguage($rcp);
342 $this->initMail();
343 $this->setSubject(sprintf(
344 $this->getLanguageText('grp_mail_status_sub'),
345 $this->getObjectTitle(true)
346 ));
348 $rcp,
349 $this->getLanguage()
350 ));
351 $this->appendBody("\n\n");
352 $this->appendBody(sprintf(
353 $this->getLanguageText('grp_mail_status_bod'),
354 $this->getObjectTitle()
355 ));
356 $this->appendBody("\n\n");
357 $this->appendBody($this->createLearningSequenceStatus((int) $rcp));
358 $this->appendBody("\n\n");
359 $this->appendBody(
360 $this->getLanguageText('grp_mail_permanent_link')
361 );
362 $this->appendBody("\n\n");
363 $this->appendBody($this->createPermanentLink());
364 $this->getMail()->appendInstallationSignature(true);
365 $this->sendMail(array($rcp));
366 }
367 break;
368 }
369 return true;
370 }
appendBody($a_body)
Append body text.
getType()
Get notification type.
sendMail(array $a_rcp, $a_parse_recipients=true)
getRecipients()
get array of recipients
getObjectTitle($a_shorten=false)
createPermanentLink($a_params=array(), $a_append='')
static getSalutation($a_usr_id, ilLanguage $a_language=null)

References ilMailNotification\appendBody(), createLearningSequenceStatus(), ilMailNotification\createPermanentLink(), ilMailNotification\getAdditionalInformation(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), isNotificationTypeEnabled(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), TYPE_ACCEPTED_SUBSCRIPTION_MEMBER, TYPE_ADMISSION_MEMBER, TYPE_DISMISS_MEMBER, TYPE_NOTIFICATION_REGISTRATION, TYPE_NOTIFICATION_REGISTRATION_REQUEST, TYPE_NOTIFICATION_UNSUBSCRIBE, TYPE_REFUSED_SUBSCRIPTION_MEMBER, TYPE_STATUS_CHANGED, TYPE_SUBSCRIBE_MEMBER, TYPE_UNSUBSCRIBE_MEMBER, TYPE_WAITING_LIST_MEMBER, and ilMailNotification\userToString().

+ Here is the call graph for this function:

Field Documentation

◆ $force_sending_mail

ilLearningSequenceMembershipMailNotification::$force_sending_mail = false
private

◆ $logger

ilLearningSequenceMembershipMailNotification::$logger
protected

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

Referenced by __construct().

◆ $permanent_enabled_notifications

ilLearningSequenceMembershipMailNotification::$permanent_enabled_notifications
protected
Initial value:
= array(
self::TYPE_NOTIFICATION_REGISTRATION,
self::TYPE_NOTIFICATION_REGISTRATION_REQUEST,
self::TYPE_NOTIFICATION_UNSUBSCRIBE
)

Notifications which are not affected by "mail_grp_member_notification" setting because they addresses admins.

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

◆ TYPE_ACCEPTED_SUBSCRIPTION_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22

◆ TYPE_ADMISSION_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_ADMISSION_MEMBER = 20

◆ TYPE_BLOCKED_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_BLOCKED_MEMBER = 25

◆ TYPE_DISMISS_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_DISMISS_MEMBER = 21

◆ TYPE_NOTIFICATION_REGISTRATION

const ilLearningSequenceMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION = 30

◆ TYPE_NOTIFICATION_REGISTRATION_REQUEST

const ilLearningSequenceMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31

◆ TYPE_NOTIFICATION_UNSUBSCRIBE

const ilLearningSequenceMembershipMailNotification::TYPE_NOTIFICATION_UNSUBSCRIBE = 32

◆ TYPE_REFUSED_SUBSCRIPTION_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23

◆ TYPE_STATUS_CHANGED

const ilLearningSequenceMembershipMailNotification::TYPE_STATUS_CHANGED = 24

◆ TYPE_SUBSCRIBE_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_SUBSCRIBE_MEMBER = 28

◆ TYPE_UNBLOCKED_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_UNBLOCKED_MEMBER = 26

◆ TYPE_UNSUBSCRIBE_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_UNSUBSCRIBE_MEMBER = 27

◆ TYPE_WAITING_LIST_MEMBER

const ilLearningSequenceMembershipMailNotification::TYPE_WAITING_LIST_MEMBER = 29

Definition at line 20 of file class.ilLearningSequenceMembershipMailNotification.php.

Referenced by send().


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