ILIAS  release_7 Revision v7.30-3-g800a261c036
ilGroupMembershipMailNotification Class Reference
+ Inheritance diagram for ilGroupMembershipMailNotification:
+ Collaboration diagram for ilGroupMembershipMailNotification:

Public Member Functions

 __construct ()
 
 forceSendingMail ($a_status)
 Force sending mail independent from global setting. More...
 
 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_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

 initMail ()
 @inheritDoc More...
 
 initLanguage ($a_usr_id)
 Add language module crs. More...
 
 createGroupStatus ($a_usr_id)
 Get course status body. More...
 
 isNotificationTypeEnabled ($a_type)
 get setting "mail_grp_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_grp_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
 

Private Attributes

 $force_sending_mail = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGroupMembershipMailNotification::__construct ( )

Definition at line 54 of file class.ilGroupMembershipMailNotification.php.

55 {
57 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ createGroupStatus()

ilGroupMembershipMailNotification::createGroupStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

Definition at line 418 of file class.ilGroupMembershipMailNotification.php.

419 {
421
422 $body = $this->getLanguageText('grp_new_status') . "\n";
423 $body .= $this->getLanguageText('role') . ': ';
424
425
426 if ($part->isAdmin($a_usr_id)) {
427 $body .= $this->getLanguageText('il_grp_admin') . "\n";
428 } else {
429 $body .= $this->getLanguageText('il_grp_member') . "\n";
430 }
431
432 if ($part->isAdmin($a_usr_id)) {
433 $body .= $this->getLanguageText('grp_notification') . ': ';
434
435 if ($part->isNotificationEnabled($a_usr_id)) {
436 $body .= $this->getLanguageText('grp_notify_on') . "\n";
437 } else {
438 $body .= $this->getLanguageText('grp_notify_off') . "\n";
439 }
440 }
441 return $body;
442 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.

References ilMailNotification\$body, ilGroupParticipants\_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()

ilGroupMembershipMailNotification::forceSendingMail (   $a_status)

Force sending mail independent from global setting.

Parameters
type$a_status

Definition at line 80 of file class.ilGroupMembershipMailNotification.php.

81 {
82 $this->force_sending_mail = $a_status;
83 }

◆ initLanguage()

ilGroupMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Add language module crs.

Parameters
object$a_usr_id
Returns

Reimplemented from ilMailNotification.

Definition at line 407 of file class.ilGroupMembershipMailNotification.php.

408 {
409 parent::initLanguage($a_usr_id);
410 $this->getLanguage()->loadLanguageModule('grp');
411 }

References ilMailNotification\getLanguage().

Referenced by send().

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

◆ initMail()

ilGroupMembershipMailNotification::initMail ( )
protected

@inheritDoc

Reimplemented from ilMailNotification.

Definition at line 62 of file class.ilGroupMembershipMailNotification.php.

62 : ilMail
63 {
64 parent::initMail();
65 $this->mail = $this->mail->withContextParameters([
69 ''
70 ),
71 ]);
72
73 return $this->mail;
74 }
static _lookupContainerSetting($a_id, $a_keyword, $a_default_value=null)
Lookup a container setting.
const PROP_CONTEXT_SUBJECT_PREFIX
static _lookupObjId($a_id)

References ilMailNotification\$mail, ilContainer\_lookupContainerSetting(), ilObject\_lookupObjId(), ilObjectServiceSettingsGUI\EXTERNAL_MAIL_PREFIX, ilMailNotification\getRefId(), and ilMail\PROP_CONTEXT_SUBJECT_PREFIX.

Referenced by send().

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

◆ isNotificationTypeEnabled()

ilGroupMembershipMailNotification::isNotificationTypeEnabled (   $a_type)
protected

get setting "mail_grp_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 451 of file class.ilGroupMembershipMailNotification.php.

452 {
453 global $DIC;
454
455 $ilSetting = $DIC['ilSetting'];
456
457 return
458 $this->force_sending_mail ||
459 $ilSetting->get('mail_grp_member_notification', true) ||
460 in_array($a_type, $this->permanent_enabled_notifications);
461 }
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17

References $DIC, and $ilSetting.

Referenced by send().

+ Here is the caller graph for this function:

◆ send()

ilGroupMembershipMailNotification::send ( )

Send notifications.

Returns

Definition at line 91 of file class.ilGroupMembershipMailNotification.php.

92 {
93 global $DIC;
94
95 $logger = $DIC->logger()->grp();
96
97 if (!$this->isNotificationTypeEnabled($this->getType())) {
98 $logger->info('Membership mail disabled globally.');
99 return false;
100 }
101
102 if (
103 $this->getType() == self::TYPE_ADMISSION_MEMBER
104 ) {
106 if (!$obj instanceof \ilObjGroup) {
107 $logger->warning('Refid: ' . $this->getRefId() . ' is not of type grp.');
108 return false;
109 }
110 if (!$obj->getAutoNotification()) {
111 if (!$this->force_sending_mail) {
112 $logger->info('Sending welcome mail disabled locally.');
113 return false;
114 }
115 }
116 }
117
118 // parent::send();
119
120 switch ($this->getType()) {
122
123 foreach ($this->getRecipients() as $rcp) {
124 $this->initLanguage($rcp);
125 $this->initMail();
126 $this->setSubject(
127 sprintf($this->getLanguageText('grp_mail_admission_new_sub'), $this->getObjectTitle(true))
128 );
129 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
130 $this->appendBody("\n\n");
131 $this->appendBody(
132 sprintf($this->getLanguageText('grp_mail_admission_new_bod'), $this->getObjectTitle())
133 );
134 $this->appendBody("\n\n");
135 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
136 $this->appendBody("\n\n");
137 $this->appendBody($this->createPermanentLink());
138 $this->getMail()->appendInstallationSignature(true);
139
140 $this->sendMail(array($rcp));
141 }
142 break;
143
145
146 foreach ($this->getRecipients() as $rcp) {
147 $this->initLanguage($rcp);
148 $this->initMail();
149 $this->setSubject(
150 sprintf($this->getLanguageText('grp_mail_dismiss_sub'), $this->getObjectTitle(true))
151 );
152 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
153 $this->appendBody("\n\n");
154 $this->appendBody(
155 sprintf($this->getLanguageText('grp_mail_dismiss_bod'), $this->getObjectTitle())
156 );
157 $this->getMail()->appendInstallationSignature(true);
158 $this->sendMail(array($rcp));
159 }
160 break;
161
162
164
165 foreach ($this->getRecipients() as $rcp) {
166 $this->initLanguage($rcp);
167 $this->initMail();
168 $this->setSubject(
169 sprintf($this->getLanguageText('grp_mail_notification_reg_sub'), $this->getObjectTitle(true))
170 );
171 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
172 $this->appendBody("\n\n");
173
174 $info = $this->getAdditionalInformation();
175 $this->appendBody(
176 sprintf(
177 $this->getLanguageText('grp_mail_notification_reg_bod'),
178 $this->userToString($info['usr_id']),
179 $this->getObjectTitle()
180 )
181 );
182 $this->appendBody("\n\n");
183 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
184 $this->appendBody("\n\n");
185 $this->appendBody($this->createPermanentLink(array(), '_mem'));
186
187 $this->appendBody("\n\n");
188 $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
189
190 $this->getMail()->appendInstallationSignature(true);
191 $this->sendMail(array($rcp));
192 }
193 break;
194
196
197 foreach ($this->getRecipients() as $rcp) {
198 $this->initLanguage($rcp);
199 $this->initMail();
200 $this->setSubject(
201 sprintf($this->getLanguageText('grp_mail_unsubscribe_member_sub'), $this->getObjectTitle(true))
202 );
203 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
204 $this->appendBody("\n\n");
205 $this->appendBody(
206 sprintf($this->getLanguageText('grp_mail_unsubscribe_member_bod'), $this->getObjectTitle())
207 );
208 $this->getMail()->appendInstallationSignature(true);
209 $this->sendMail(array($rcp));
210 }
211 break;
212
214
215 foreach ($this->getRecipients() as $rcp) {
216 $this->initLanguage($rcp);
217 $this->initMail();
218 $this->setSubject(
219 sprintf($this->getLanguageText('grp_mail_notification_unsub_sub'), $this->getObjectTitle(true))
220 );
221 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
222 $this->appendBody("\n\n");
223
224 $info = $this->getAdditionalInformation();
225 $this->appendBody(
226 sprintf(
227 $this->getLanguageText('grp_mail_notification_unsub_bod'),
228 $this->userToString($info['usr_id']),
229 $this->getObjectTitle()
230 )
231 );
232 $this->appendBody("\n\n");
233 $this->appendBody($this->getLanguageText('grp_mail_notification_unsub_bod2'));
234 $this->appendBody("\n\n");
235 $this->appendBody($this->createPermanentLink(array(), '_mem'));
236
237 $this->appendBody("\n\n");
238 $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
239
240 $this->getMail()->appendInstallationSignature(true);
241 $this->sendMail(array($rcp));
242 }
243 break;
244
245
247
248 foreach ($this->getRecipients() as $rcp) {
249 $this->initLanguage($rcp);
250 $this->initMail();
251 $this->setSubject(
252 sprintf($this->getLanguageText('grp_mail_subscribe_member_sub'), $this->getObjectTitle(true))
253 );
254 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
255 $this->appendBody("\n\n");
256 $this->appendBody(
257 sprintf($this->getLanguageText('grp_mail_subscribe_member_bod'), $this->getObjectTitle())
258 );
259
260 $this->appendBody("\n\n");
261 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
262 $this->appendBody("\n\n");
263 $this->appendBody($this->createPermanentLink());
264 $this->getMail()->appendInstallationSignature(true);
265
266 $this->sendMail(array($rcp));
267 }
268 break;
269
270
272
273 foreach ($this->getRecipients() as $rcp) {
274 $this->initLanguage($rcp);
275 $this->initMail();
276 $this->setSubject(
277 sprintf($this->getLanguageText('grp_mail_notification_reg_req_sub'), $this->getObjectTitle(true))
278 );
279 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
280 $this->appendBody("\n\n");
281
282 $info = $this->getAdditionalInformation();
283 $this->appendBody(
284 sprintf(
285 $this->getLanguageText('grp_mail_notification_reg_req_bod'),
286 $this->userToString($info['usr_id']),
287 $this->getObjectTitle()
288 )
289 );
290 $this->appendBody("\n\n");
291 $this->appendBody($this->getLanguageText('grp_mail_notification_reg_req_bod2'));
292 $this->appendBody("\n");
293 $this->appendBody($this->createPermanentLink(array(), '_mem'));
294
295 $this->appendBody("\n\n");
296 $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
297
298 $this->getMail()->appendInstallationSignature(true);
299 $this->sendMail(array($rcp));
300 }
301 break;
302
304
305 foreach ($this->getRecipients() as $rcp) {
306 $this->initLanguage($rcp);
307 $this->initMail();
308 $this->setSubject(
309 sprintf($this->getLanguageText('grp_mail_sub_dec_sub'), $this->getObjectTitle(true))
310 );
311 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
312 $this->appendBody("\n\n");
313 $this->appendBody(
314 sprintf($this->getLanguageText('grp_mail_sub_dec_bod'), $this->getObjectTitle())
315 );
316
317 $this->getMail()->appendInstallationSignature(true);
318
319 $this->sendMail(array($rcp));
320 }
321 break;
322
324
325 foreach ($this->getRecipients() as $rcp) {
326 $this->initLanguage($rcp);
327 $this->initMail();
328 $this->setSubject(
329 sprintf($this->getLanguageText('grp_mail_sub_acc_sub'), $this->getObjectTitle(true))
330 );
331 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
332 $this->appendBody("\n\n");
333 $this->appendBody(
334 sprintf($this->getLanguageText('grp_mail_sub_acc_bod'), $this->getObjectTitle())
335 );
336 $this->appendBody("\n\n");
337 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
338 $this->appendBody("\n\n");
339 $this->appendBody($this->createPermanentLink());
340 $this->getMail()->appendInstallationSignature(true);
341
342 $this->sendMail(array($rcp));
343 }
344 break;
345
347 foreach ($this->getRecipients() as $rcp) {
348 $this->initLanguage($rcp);
349 $this->initMail();
350 $this->setSubject(
351 sprintf($this->getLanguageText('grp_mail_wl_sub'), $this->getObjectTitle(true))
352 );
353
354 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
355
356 $info = $this->getAdditionalInformation();
357 $this->appendBody("\n\n");
358 $this->appendBody(
359 sprintf(
360 $this->getLanguageText('grp_mail_wl_bod'),
361 $this->getObjectTitle(),
362 $info['position']
363 )
364 );
365 $this->getMail()->appendInstallationSignature(true);
366 $this->sendMail(array($rcp));
367 }
368 break;
369
370
372 foreach ($this->getRecipients() as $rcp) {
373 $this->initLanguage($rcp);
374 $this->initMail();
375 $this->setSubject(
376 sprintf($this->getLanguageText('grp_mail_status_sub'), $this->getObjectTitle(true))
377 );
378 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
379 $this->appendBody("\n\n");
380 $this->appendBody(
381 sprintf($this->getLanguageText('grp_mail_status_bod'), $this->getObjectTitle())
382 );
383
384 $this->appendBody("\n\n");
385 $this->appendBody($this->createGroupStatus($rcp));
386
387 $this->appendBody("\n\n");
388 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
389 $this->appendBody("\n\n");
390 $this->appendBody($this->createPermanentLink());
391
392 $this->getMail()->appendInstallationSignature(true);
393
394 $this->sendMail(array($rcp));
395 }
396 break;
397
398 }
399 return true;
400 }
isNotificationTypeEnabled($a_type)
get setting "mail_grp_member_notification" and excludes types which are not affected by this setting ...
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)
Class ilObjGroup.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id

References $DIC, ilMailNotification\appendBody(), createGroupStatus(), ilMailNotification\createPermanentLink(), ilMailNotification\getAdditionalInformation(), ilObjectFactory\getInstanceByRefId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMailNotification\getRefId(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), 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

ilGroupMembershipMailNotification::$force_sending_mail = false
private

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

◆ $permanent_enabled_notifications

array ilGroupMembershipMailNotification::$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 40 of file class.ilGroupMembershipMailNotification.php.

◆ TYPE_ACCEPTED_SUBSCRIPTION_MEMBER

const ilGroupMembershipMailNotification::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22

◆ TYPE_ADMISSION_MEMBER

◆ TYPE_BLOCKED_MEMBER

const ilGroupMembershipMailNotification::TYPE_BLOCKED_MEMBER = 25

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

◆ TYPE_DISMISS_MEMBER

const ilGroupMembershipMailNotification::TYPE_DISMISS_MEMBER = 21

◆ TYPE_NOTIFICATION_REGISTRATION

const ilGroupMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION = 30

◆ TYPE_NOTIFICATION_REGISTRATION_REQUEST

const ilGroupMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31

◆ TYPE_NOTIFICATION_UNSUBSCRIBE

const ilGroupMembershipMailNotification::TYPE_NOTIFICATION_UNSUBSCRIBE = 32

◆ TYPE_REFUSED_SUBSCRIPTION_MEMBER

const ilGroupMembershipMailNotification::TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23

◆ TYPE_STATUS_CHANGED

const ilGroupMembershipMailNotification::TYPE_STATUS_CHANGED = 24

◆ TYPE_SUBSCRIBE_MEMBER

const ilGroupMembershipMailNotification::TYPE_SUBSCRIBE_MEMBER = 28

◆ TYPE_UNBLOCKED_MEMBER

const ilGroupMembershipMailNotification::TYPE_UNBLOCKED_MEMBER = 26

Definition at line 24 of file class.ilGroupMembershipMailNotification.php.

◆ TYPE_UNSUBSCRIBE_MEMBER

const ilGroupMembershipMailNotification::TYPE_UNSUBSCRIBE_MEMBER = 27

◆ TYPE_WAITING_LIST_MEMBER

const ilGroupMembershipMailNotification::TYPE_WAITING_LIST_MEMBER = 29

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