ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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

 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 401 of file class.ilGroupMembershipMailNotification.php.

402 {
404
405 $body = $this->getLanguageText('grp_new_status') . "\n";
406 $body .= $this->getLanguageText('role') . ': ';
407
408
409 if ($part->isAdmin($a_usr_id)) {
410 $body .= $this->getLanguageText('il_grp_admin') . "\n";
411 } else {
412 $body .= $this->getLanguageText('il_grp_member') . "\n";
413 }
414
415 if ($part->isAdmin($a_usr_id)) {
416 $body .= $this->getLanguageText('grp_notification') . ': ';
417
418 if ($part->isNotificationEnabled($a_usr_id)) {
419 $body .= $this->getLanguageText('grp_notify_on') . "\n";
420 } else {
421 $body .= $this->getLanguageText('grp_notify_off') . "\n";
422 }
423 }
424 return $body;
425 }
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 63 of file class.ilGroupMembershipMailNotification.php.

64 {
65 $this->force_sending_mail = $a_status;
66 }

◆ initLanguage()

ilGroupMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Add language module crs.

Parameters
object$a_usr_id
Returns

Reimplemented from ilMailNotification.

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

391 {
392 parent::initLanguage($a_usr_id);
393 $this->getLanguage()->loadLanguageModule('grp');
394 }

References ilMailNotification\getLanguage().

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 434 of file class.ilGroupMembershipMailNotification.php.

435 {
436 global $DIC;
437
438 $ilSetting = $DIC['ilSetting'];
439
440 return
441 $this->force_sending_mail ||
442 $ilSetting->get('mail_grp_member_notification', true) ||
443 in_array($a_type, $this->permanent_enabled_notifications);
444 }
global $ilSetting
Definition: privfeed.php:17
$a_type
Definition: workflow.php:92
$DIC
Definition: xapitoken.php:46

References $a_type, $DIC, and $ilSetting.

Referenced by send().

+ Here is the caller graph for this function:

◆ send()

ilGroupMembershipMailNotification::send ( )

Send notifications.

Returns

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

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

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: