ILIAS  release_8 Revision v8.24
ilGroupMembershipMailNotification Class Reference
+ Inheritance diagram for ilGroupMembershipMailNotification:
+ Collaboration diagram for ilGroupMembershipMailNotification:

Public Member Functions

 __construct (bool $a_is_personal_workspace=false)
 
 forceSendingMail (bool $a_status)
 Force sending mail independent from global setting. More...
 
 send ()
 
- Public Member Functions inherited from ilMailNotification
 __construct (bool $a_is_personal_workspace=false)
 
 setType (int $a_type)
 
 getType ()
 
 setSender (int $a_usr_id)
 
 getSender ()
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 
 setAttachments (array $a_att)
 
 getAttachments ()
 
 setLangModules (array $a_modules)
 
 getUserLanguage (int $a_usr_id)
 
 setRefId (int $a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId (int $a_obj_id)
 
 getObjType ()
 
 setAdditionalInformation (array $a_info)
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, bool $a_parse_recipients=true)
 
 getBlockBorder ()
 

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 (int $a_usr_id)
 @inheritDoc More...
 
 createGroupStatus (int $a_usr_id)
 
 isNotificationTypeEnabled (int $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 (string $a_subject)
 
 getSubject ()
 
 setBody (string $a_body)
 
 appendBody (string $a_body)
 
 getBody ()
 
 initLanguage (int $a_usr_id)
 
 initLanguageByIso2Code (string $a_code='')
 
 setLanguage (ilLanguage $a_language)
 
 getLanguage ()
 
 getLanguageText (string $a_keyword)
 
 getObjectTitle (bool $a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink (array $a_params=[], string $a_append='')
 
 userToString (int $a_usr_id)
 
 isRefIdAccessible (int $a_user_id, int $a_ref_id, string $a_permission="read")
 

Protected Attributes

array $permanent_enabled_notifications
 
- Protected Attributes inherited from ilMailNotification
int $type
 
int $sender
 
ilMail $mail = null
 
string $subject = ''
 
string $body = ''
 
array $attachments = []
 
ilLanguage $language
 
array $lang_modules = []
 
array $recipients = []
 
int $ref_id
 
int $obj_id = 0
 
string $obj_type = ''
 
array $additional_info = []
 
bool $is_in_wsp
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Private Attributes

bool $force_sending_mail = false
 
ilLogger $logger
 
ilSetting $settings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGroupMembershipMailNotification::__construct ( bool  $a_is_personal_workspace = false)

Reimplemented from ilMailNotification.

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

52 {
53 global $DIC;
54
55 $this->logger = $DIC->logger()->grp();
56 $this->settings = $DIC->settings();
57 parent::__construct($a_is_personal_workspace);
58 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ createGroupStatus()

ilGroupMembershipMailNotification::createGroupStatus ( int  $a_usr_id)
protected

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

402 : string
403 {
405
406 $body = $this->getLanguageText('grp_new_status') . "\n";
407 $body .= $this->getLanguageText('role') . ': ';
408
409
410 if ($part->isAdmin($a_usr_id)) {
411 $body .= $this->getLanguageText('il_grp_admin') . "\n";
412 } else {
413 $body .= $this->getLanguageText('il_grp_member') . "\n";
414 }
415
416 if ($part->isAdmin($a_usr_id)) {
417 $body .= $this->getLanguageText('grp_notification') . ': ';
418
419 if ($part->isNotificationEnabled($a_usr_id)) {
420 $body .= $this->getLanguageText('grp_notify_on') . "\n";
421 } else {
422 $body .= $this->getLanguageText('grp_notify_off') . "\n";
423 }
424 }
425 return $body;
426 }
static _getInstanceByObjId(int $a_obj_id)
Get singleton instance.
getLanguageText(string $a_keyword)

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 ( bool  $a_status)

Force sending mail independent from global setting.

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

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

◆ initLanguage()

ilGroupMembershipMailNotification::initLanguage ( int  $a_usr_id)
protected

@inheritDoc

Reimplemented from ilMailNotification.

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

396 : void
397 {
398 parent::initLanguage($a_usr_id);
399 $this->getLanguage()->loadLanguageModule('grp');
400 }

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

63 : ilMail
64 {
65 parent::initMail();
66 $this->mail = $this->mail->withContextParameters([
70 ''
71 ),
72 ]);
73
74 return $this->mail;
75 }
static _lookupContainerSetting(int $a_id, string $a_keyword, string $a_default_value=null)
const PROP_CONTEXT_SUBJECT_PREFIX
static _lookupObjId(int $ref_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 ( int  $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

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

432 : bool
433 {
434 return
435 $this->force_sending_mail ||
436 $this->settings->get('mail_grp_member_notification', "1") ||
437 in_array($a_type, $this->permanent_enabled_notifications);
438 }

References ILIAS\Repository\settings().

Referenced by send().

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

◆ send()

ilGroupMembershipMailNotification::send ( )

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

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

References 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(), ILIAS\Repository\logger(), 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

bool ilGroupMembershipMailNotification::$force_sending_mail = false
private

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

◆ $logger

ilLogger ilGroupMembershipMailNotification::$logger
private

Definition at line 47 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
)

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

◆ $settings

ilSetting ilGroupMembershipMailNotification::$settings
private

Definition at line 48 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 22 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 23 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: