ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 (protected bool $is_in_wsp=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
final const int 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 = []
 
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)

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

66 {
67 global $DIC;
68
69 $this->logger = $DIC->logger()->grp();
70 $this->settings = $DIC->settings();
71 parent::__construct($a_is_personal_workspace);
72 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

416 : string
417 {
419
420 $body = $this->getLanguageText('grp_new_status') . "\n";
421 $body .= $this->getLanguageText('role') . ': ';
422
423
424 if ($part->isAdmin($a_usr_id)) {
425 $body .= $this->getLanguageText('il_grp_admin') . "\n";
426 } else {
427 $body .= $this->getLanguageText('il_grp_member') . "\n";
428 }
429
430 if ($part->isAdmin($a_usr_id)) {
431 $body .= $this->getLanguageText('grp_notification') . ': ';
432
433 if ($part->isNotificationEnabled($a_usr_id)) {
434 $body .= $this->getLanguageText('grp_notify_on') . "\n";
435 } else {
436 $body .= $this->getLanguageText('grp_notify_off') . "\n";
437 }
438 }
439 return $body;
440 }
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 94 of file class.ilGroupMembershipMailNotification.php.

94 : void
95 {
96 $this->force_sending_mail = $a_status;
97 }

◆ initLanguage()

ilGroupMembershipMailNotification::initLanguage ( int  $a_usr_id)
protected

@inheritDoc

Reimplemented from ilMailNotification.

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

410 : void
411 {
412 parent::initLanguage($a_usr_id);
413 $this->getLanguage()->loadLanguageModule('grp');
414 }

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

77 : ilMail
78 {
79 parent::initMail();
80 $this->mail = $this->mail->withContextParameters([
84 ''
85 ),
86 ]);
87
88 return $this->mail;
89 }
static _lookupContainerSetting(int $a_id, string $a_keyword, ?string $a_default_value=null)
const string 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 446 of file class.ilGroupMembershipMailNotification.php.

446 : bool
447 {
448 return
449 $this->force_sending_mail ||
450 $this->settings->get('mail_grp_member_notification', "1") ||
451 in_array($a_type, $this->permanent_enabled_notifications);
452 }

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

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

References $info, 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 59 of file class.ilGroupMembershipMailNotification.php.

◆ $logger

ilLogger ilGroupMembershipMailNotification::$logger
private

Definition at line 61 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 53 of file class.ilGroupMembershipMailNotification.php.

◆ $settings

ilSetting ilGroupMembershipMailNotification::$settings
private

Definition at line 62 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 36 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 37 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: