ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilCourseMembershipMailNotification Class Reference
+ Inheritance diagram for ilCourseMembershipMailNotification:
+ Collaboration diagram for ilCourseMembershipMailNotification:

Public Member Functions

 __construct ()
 
 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_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 ($a_usr_id)
 Add language module crs. More...
 
 createCourseStatus ($a_usr_id)
 Get course status body. More...
 
 isNotificationTypeEnabled ($a_type)
 get setting "mail_crs_member_notification" and excludes types which are not affected by this setting See description of $this->permanent_enabled_notifications 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

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

Constructor & Destructor Documentation

◆ __construct()

ilCourseMembershipMailNotification::__construct ( )

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

50 {
51 parent::__construct();
52 }

Member Function Documentation

◆ createCourseStatus()

ilCourseMembershipMailNotification::createCourseStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

Definition at line 428 of file class.ilCourseMembershipMailNotification.php.

429 {
431
432 $body = $this->getLanguageText('crs_new_status')."\n";
433 $body .= $this->getLanguageText('role').': ';
434
435
436 if($part->isAdmin($a_usr_id))
437 {
438 $body .= $this->getLanguageText('crs_admin')."\n";
439
440 }
441 elseif($part->isTutor($a_usr_id))
442 {
443 $body .= $this->getLanguageText('crs_tutor')."\n";
444 }
445 else
446 {
447 $body .= $this->getLanguageText('crs_member')."\n";
448 }
449
450 if($part->isAdmin($a_usr_id) or $part->isTutor($a_usr_id))
451 {
452 $body .= $this->getLanguageText('crs_status').': ';
453
454 if($part->isNotificationEnabled($a_usr_id))
455 {
456 $body .= $this->getLanguageText('crs_notify')."\n";
457 }
458 else
459 {
460 $body .= $this->getLanguageText('crs_no_notify')."\n";
461 }
462 }
463 else
464 {
465 $body .= $this->getLanguageText('crs_access').': ';
466
467 if($part->isBlocked($a_usr_id))
468 {
469 $body .= $this->getLanguageText('crs_blocked')."\n";
470 }
471 else
472 {
473 $body .= $this->getLanguageText('crs_unblocked')."\n";
474 }
475 }
476
477 $body .= $this->getLanguageText('crs_passed').': ';
478
479 if($part->hasPassed($a_usr_id))
480 {
481 $body .= $this->getLanguageText('yes');
482 }
483 else
484 {
485 $body .= $this->getLanguageText('no');
486 }
487 return $body;
488 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.

References ilMailNotification\$body, ilCourseParticipants\_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:

◆ initLanguage()

ilCourseMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Add language module crs.

Parameters
object$a_usr_id
Returns

Reimplemented from ilMailNotification.

Definition at line 417 of file class.ilCourseMembershipMailNotification.php.

418 {
419 parent::initLanguage($a_usr_id);
420 $this->getLanguage()->loadLanguageModule('crs');
421 }

References ilMailNotification\getLanguage().

Referenced by send().

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

◆ isNotificationTypeEnabled()

ilCourseMembershipMailNotification::isNotificationTypeEnabled (   $a_type)
protected

get setting "mail_crs_member_notification" and excludes types which are not affected by this setting See description of $this->permanent_enabled_notifications

Parameters
int$a_type
Returns
bool

Definition at line 497 of file class.ilCourseMembershipMailNotification.php.

498 {
499 global $ilSetting;
500
501 return $ilSetting->get('mail_crs_member_notification',true) || in_array($a_type, $this->permanent_enabled_notifications);
502 }
global $ilSetting
Definition: privfeed.php:40

References $ilSetting.

Referenced by send().

+ Here is the caller graph for this function:

◆ send()

ilCourseMembershipMailNotification::send ( )

Send notifications.

Returns

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

59 {
60 if( (int) $this->getRefId() &&
61 in_array($this->getType(), array(self::TYPE_ADMISSION_MEMBER)) )
62 {
63 $obj = ilObjectFactory::getInstanceByRefId( (int) $this->getRefId() );
64
65 if( $obj->getAutoNotification() == false )
66 {
67 return false;
68 }
69 }
70
71 if(!$this->isNotificationTypeEnabled($this->getType()))
72 {
73 return false;
74 }
75
76 // #11359
77 // parent::send();
78
79 switch($this->getType())
80 {
82
83 foreach($this->getRecipients() as $rcp)
84 {
85 $this->initLanguage($rcp);
86 $this->initMail();
87 $this->setSubject(
88 sprintf($this->getLanguageText('crs_added_member'),$this->getObjectTitle(true))
89 );
90 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
91 $this->appendBody("\n\n");
92 $this->appendBody(
93 sprintf($this->getLanguageText('crs_added_member_body'),$this->getObjectTitle())
94 );
95 $this->appendBody("\n\n");
96 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
97 $this->appendBody("\n\n");
98 $this->appendBody($this->createPermanentLink());
99 $this->getMail()->appendInstallationSignature(true);
100
101 $this->sendMail(array($rcp),array('system'));
102 }
103 break;
104
105
107
108 foreach($this->getRecipients() as $rcp)
109 {
110 $this->initLanguage($rcp);
111 $this->initMail();
112 $this->setSubject(
113 sprintf($this->getLanguageText('crs_accept_subscriber'),$this->getObjectTitle(true))
114 );
115 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
116 $this->appendBody("\n\n");
117 $this->appendBody(
118 sprintf($this->getLanguageText('crs_accept_subscriber_body'),$this->getObjectTitle())
119 );
120 $this->appendBody("\n\n");
121 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
122 $this->appendBody("\n\n");
123 $this->appendBody($this->createPermanentLink());
124 $this->getMail()->appendInstallationSignature(true);
125
126 $this->sendMail(array($rcp),array('system'));
127 }
128 break;
129
131
132 foreach($this->getRecipients() as $rcp)
133 {
134 $this->initLanguage($rcp);
135 $this->initMail();
136 $this->setSubject(
137 sprintf($this->getLanguageText('crs_reject_subscriber'),$this->getObjectTitle(true))
138 );
139 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
140 $this->appendBody("\n\n");
141 $this->appendBody(
142 sprintf($this->getLanguageText('crs_reject_subscriber_body'),$this->getObjectTitle())
143 );
144
145 $this->getMail()->appendInstallationSignature(true);
146
147 $this->sendMail(array($rcp),array('system'));
148 }
149 break;
150
152 foreach($this->getRecipients() as $rcp)
153 {
154 $this->initLanguage($rcp);
155 $this->initMail();
156 $this->setSubject(
157 sprintf($this->getLanguageText('crs_status_changed'),$this->getObjectTitle(true))
158 );
159 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
160 $this->appendBody("\n\n");
161 $this->appendBody(
162 sprintf($this->getLanguageText('crs_status_changed_body'),$this->getObjectTitle())
163 );
164
165 $this->appendBody("\n\n");
166 $this->appendBody($this->createCourseStatus($rcp));
167
168 $this->appendBody("\n\n");
169 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
170 $this->appendBody("\n\n");
171 $this->appendBody($this->createPermanentLink());
172
173 $this->getMail()->appendInstallationSignature(true);
174
175 $this->sendMail(array($rcp),array('system'));
176 }
177 break;
178
179
181
182 foreach($this->getRecipients() as $rcp)
183 {
184 $this->initLanguage($rcp);
185 $this->initMail();
186 $this->setSubject(
187 sprintf($this->getLanguageText('crs_dismiss_member'),$this->getObjectTitle(true))
188 );
189 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
190 $this->appendBody("\n\n");
191 $this->appendBody(
192 sprintf($this->getLanguageText('crs_dismiss_member_body'),$this->getObjectTitle())
193 );
194 $this->getMail()->appendInstallationSignature(true);
195 $this->sendMail(array($rcp),array('system'));
196 }
197 break;
198
199
201
202 foreach($this->getRecipients() as $rcp)
203 {
204 $this->initLanguage($rcp);
205 $this->initMail();
206 $this->setSubject(
207 sprintf($this->getLanguageText('crs_blocked_member'),$this->getObjectTitle(true))
208 );
209 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
210 $this->appendBody("\n\n");
211 $this->appendBody(
212 sprintf($this->getLanguageText('crs_blocked_member_body'),$this->getObjectTitle())
213 );
214 $this->getMail()->appendInstallationSignature(true);
215 $this->sendMail(array($rcp),array('system'));
216 }
217 break;
218
220
221 foreach($this->getRecipients() as $rcp)
222 {
223 $this->initLanguage($rcp);
224 $this->initMail();
225 $this->setSubject(
226 sprintf($this->getLanguageText('crs_unblocked_member'),$this->getObjectTitle(true))
227 );
228 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
229 $this->appendBody("\n\n");
230 $this->appendBody(
231 sprintf($this->getLanguageText('crs_unblocked_member_body'),$this->getObjectTitle())
232 );
233
234 $this->appendBody("\n\n");
235 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
236 $this->appendBody("\n\n");
237 $this->appendBody($this->createPermanentLink());
238 $this->getMail()->appendInstallationSignature(true);
239
240 $this->sendMail(array($rcp),array('system'));
241 }
242 break;
243
245
246 foreach($this->getRecipients() as $rcp)
247 {
248 $this->initLanguage($rcp);
249 $this->initMail();
250 $this->setSubject(
251 sprintf($this->getLanguageText('crs_new_subscription'),$this->getObjectTitle(true))
252 );
253 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
254 $this->appendBody("\n\n");
255
257 $this->appendBody(
258 sprintf($this->getLanguageText('crs_new_subscription_body'),
259 $this->userToString($info['usr_id']),
260 $this->getObjectTitle()
261 )
262 );
263 $this->appendBody("\n\n");
264 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
265 $this->appendBody("\n\n");
266 $this->appendBody($this->createPermanentLink(array(),'_mem'));
267
268 $this->appendBody("\n\n");
269 $this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
270
271 $this->getMail()->appendInstallationSignature(true);
272 $this->sendMail(array($rcp),array('system'));
273 }
274 break;
275
277
278 foreach($this->getRecipients() as $rcp)
279 {
280 $this->initLanguage($rcp);
281 $this->initMail();
282 $this->setSubject(
283 sprintf($this->getLanguageText('crs_new_subscription_request'),$this->getObjectTitle(true))
284 );
285 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
286 $this->appendBody("\n\n");
287
289 $this->appendBody(
290 sprintf($this->getLanguageText('crs_new_subscription_request_body'),
291 $this->userToString($info['usr_id']),
292 $this->getObjectTitle()
293 )
294 );
295 $this->appendBody("\n\n");
296 $this->appendBody($this->getLanguageText('crs_new_subscription_request_body2'));
297 $this->appendBody("\n");
298 $this->appendBody($this->createPermanentLink(array(),'_mem'));
299
300 $this->appendBody("\n\n");
301 $this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
302
303 $this->getMail()->appendInstallationSignature(true);
304 $this->sendMail(array($rcp),array('system'));
305 }
306 break;
307
309
310 foreach($this->getRecipients() as $rcp)
311 {
312 $this->initLanguage($rcp);
313 $this->initMail();
314 $this->setSubject(
315 sprintf($this->getLanguageText('crs_cancel_subscription'),$this->getObjectTitle(true))
316 );
317 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
318 $this->appendBody("\n\n");
319
321 $this->appendBody(
322 sprintf($this->getLanguageText('crs_cancel_subscription_body'),
323 $this->userToString($info['usr_id']),
324 $this->getObjectTitle()
325 )
326 );
327 $this->appendBody("\n\n");
328 $this->appendBody($this->getLanguageText('crs_cancel_subscription_body2'));
329 $this->appendBody("\n\n");
330 $this->appendBody($this->createPermanentLink(array(),'_mem'));
331
332 $this->appendBody("\n\n");
333 $this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
334
335 $this->getMail()->appendInstallationSignature(true);
336 $this->sendMail(array($rcp),array('system'));
337 }
338 break;
339
341 foreach($this->getRecipients() as $rcp)
342 {
343 $this->initLanguage($rcp);
344 $this->initMail();
345 $this->setSubject(
346 sprintf($this->getLanguageText('crs_unsubscribe_member'),$this->getObjectTitle(true))
347 );
348 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
349 $this->appendBody("\n\n");
350 $this->appendBody(
351 sprintf($this->getLanguageText('crs_unsubscribe_member_body'),$this->getObjectTitle())
352 );
353 $this->appendBody("\n\n");
354 $this->appendBody($this->getLanguageText('crs_unsubscribe_member_explanation'));
355 $this->getMail()->appendInstallationSignature(true);
356 $this->sendMail(array($rcp),array('system'));
357 }
358 break;
359
361
362 foreach($this->getRecipients() as $rcp)
363 {
364 $this->initLanguage($rcp);
365 $this->initMail();
366 $this->setSubject(
367 sprintf($this->getLanguageText('crs_subscribe_member'),$this->getObjectTitle(true))
368 );
369 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
370 $this->appendBody("\n\n");
371 $this->appendBody(
372 sprintf($this->getLanguageText('crs_subscribe_member_body'),$this->getObjectTitle())
373 );
374
375 $this->appendBody("\n\n");
376 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
377 $this->appendBody("\n\n");
378 $this->appendBody($this->createPermanentLink());
379 $this->getMail()->appendInstallationSignature(true);
380
381 $this->sendMail(array($rcp),array('system'));
382 }
383 break;
384
386 foreach($this->getRecipients() as $rcp)
387 {
388 $this->initLanguage($rcp);
389 $this->initMail();
390 $this->setSubject(
391 sprintf($this->getLanguageText('crs_subscribe_wl'),$this->getObjectTitle(true))
392 );
393
394 $this->setBody(ilMail::getSalutation($rcp,$this->getLanguage()));
395
397 $this->appendBody("\n\n");
398 $this->appendBody(
399 sprintf($this->getLanguageText('crs_subscribe_wl_body'),
400 $this->getObjectTitle(),
401 $info['position']
402 )
403 );
404 $this->getMail()->appendInstallationSignature(true);
405 $this->sendMail(array($rcp),array('system'));
406 }
407 break;
408 }
409 return true;
410 }
isNotificationTypeEnabled($a_type)
get setting "mail_crs_member_notification" and excludes types which are not affected by this setting ...
appendBody($a_body)
Append body text.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getType()
Get notification type.
getRecipients()
get array of recipients
getObjectTitle($a_shorten=false)
createPermanentLink($a_params=array(), $a_append='')
static getSalutation($a_usr_id, $a_language=null)
Get salutation.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
$info
Definition: example_052.php:80

References $info, ilMailNotification\appendBody(), createCourseStatus(), ilMailNotification\createPermanentLink(), ilMailNotification\getAdditionalInformation(), ilObjectFactory\getInstanceByRefId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMailNotification\getRefId(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), isNotificationTypeEnabled(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), TYPE_ACCEPTED_SUBSCRIPTION_MEMBER, TYPE_ADMISSION_MEMBER, TYPE_BLOCKED_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_UNBLOCKED_MEMBER, TYPE_UNSUBSCRIBE_MEMBER, TYPE_WAITING_LIST_MEMBER, and ilMailNotification\userToString().

+ Here is the call graph for this function:

Field Documentation

◆ $permanent_enabled_notifications

array ilCourseMembershipMailNotification::$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_crs_member_notification" setting because they addresses admins.

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

◆ TYPE_ACCEPTED_SUBSCRIPTION_MEMBER

const ilCourseMembershipMailNotification::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22

◆ TYPE_ADMISSION_MEMBER

const ilCourseMembershipMailNotification::TYPE_ADMISSION_MEMBER = 20

◆ TYPE_BLOCKED_MEMBER

const ilCourseMembershipMailNotification::TYPE_BLOCKED_MEMBER = 25

◆ TYPE_DISMISS_MEMBER

const ilCourseMembershipMailNotification::TYPE_DISMISS_MEMBER = 21

◆ TYPE_NOTIFICATION_REGISTRATION

const ilCourseMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION = 30

◆ TYPE_NOTIFICATION_REGISTRATION_REQUEST

const ilCourseMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31

◆ TYPE_NOTIFICATION_UNSUBSCRIBE

const ilCourseMembershipMailNotification::TYPE_NOTIFICATION_UNSUBSCRIBE = 32

◆ TYPE_REFUSED_SUBSCRIPTION_MEMBER

const ilCourseMembershipMailNotification::TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23

◆ TYPE_STATUS_CHANGED

const ilCourseMembershipMailNotification::TYPE_STATUS_CHANGED = 24

◆ TYPE_SUBSCRIBE_MEMBER

const ilCourseMembershipMailNotification::TYPE_SUBSCRIBE_MEMBER = 28

◆ TYPE_UNBLOCKED_MEMBER

const ilCourseMembershipMailNotification::TYPE_UNBLOCKED_MEMBER = 26

◆ TYPE_UNSUBSCRIBE_MEMBER

const ilCourseMembershipMailNotification::TYPE_UNSUBSCRIBE_MEMBER = 27

◆ TYPE_WAITING_LIST_MEMBER

const ilCourseMembershipMailNotification::TYPE_WAITING_LIST_MEMBER = 29

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