ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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)
 Constructor. More...
 
 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 ($a_rcp)
 set mail recipients More...
 
 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)
 Set ref id. More...
 
 getRefId ()
 get reference id More...
 
 getObjId ()
 get object id More...
 
 setObjId ($a_obj_id)
 set obj id More...
 
 getObjType ()
 Get object type. More...
 
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails. More...
 
 getAdditionalInformation ()
 Get additional information for generating notification mails. More...
 
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail. More...
 
 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...
 
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 Set mail subject. More...
 
 getSubject ()
 Get mail subject. More...
 
 setBody ($a_body)
 Set mail body. More...
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 Get body. More...
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 A language. More...
 
 getLanguage ()
 get language object More...
 
 getLanguageText ($a_keyword)
 Replace new lines. More...
 
 getObjectTitle ($a_shorten=false)
 Get object title. More...
 
 initMail ()
 Init mail. More...
 
 getMail ()
 Get mail object. More...
 
 createPermanentLink ($a_params=array(), $a_append='')
 Create a permanent link for an object. More...
 
 userToString ($a_usr_id)
 Utility function. More...
 
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user. More...
 

Additional Inherited Members

- 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 37 of file class.ilCourseMembershipMailNotification.php.

38 {
39 parent::__construct();
40 }

Member Function Documentation

◆ createCourseStatus()

ilCourseMembershipMailNotification::createCourseStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

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

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

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 414 of file class.ilCourseMembershipMailNotification.php.

415 {
416 parent::initLanguage($a_usr_id);
417 $this->getLanguage()->loadLanguageModule('crs');
418 }
getLanguage()
get language object

References ilMailNotification\getLanguage().

Referenced by send().

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

◆ send()

ilCourseMembershipMailNotification::send ( )

Send notifications.

Returns

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

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

References $ilSetting, 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(), 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

◆ 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: