ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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_type, $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  {
56  parent::__construct();
57  }

Member Function Documentation

◆ createGroupStatus()

ilGroupMembershipMailNotification::createGroupStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

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

References ilMailNotification\$body, ilGroupParticipants\_getInstanceByObjId(), ilMailNotification\getLanguageText(), and ilMailNotification\getObjId().

Referenced by send().

381  {
383 
384  $body = $this->getLanguageText('grp_new_status') . "\n";
385  $body .= $this->getLanguageText('role') . ': ';
386 
387 
388  if ($part->isAdmin($a_usr_id)) {
389  $body .= $this->getLanguageText('il_grp_admin') . "\n";
390  } else {
391  $body .= $this->getLanguageText('il_grp_member') . "\n";
392  }
393 
394  if ($part->isAdmin($a_usr_id)) {
395  $body .= $this->getLanguageText('grp_notification') . ': ';
396 
397  if ($part->isNotificationEnabled($a_usr_id)) {
398  $body .= $this->getLanguageText('grp_notify_on') . "\n";
399  } else {
400  $body .= $this->getLanguageText('grp_notify_off') . "\n";
401  }
402  }
403  return $body;
404  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ 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

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

References ilMailNotification\getLanguage().

Referenced by send().

370  {
371  parent::initLanguage($a_usr_id);
372  $this->getLanguage()->loadLanguageModule('grp');
373  }
+ 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 413 of file class.ilGroupMembershipMailNotification.php.

References $a_type, and $ilSetting.

Referenced by send().

414  {
415  global $ilSetting;
416 
417  return
418  $this->force_sending_mail ||
419  $ilSetting->get('mail_grp_member_notification', true) ||
420  in_array($a_type, $this->permanent_enabled_notifications);
421  }
$a_type
Definition: workflow.php:92
global $ilSetting
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ send()

ilGroupMembershipMailNotification::send ( )

Send notifications.

Returns

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

References $GLOBALS, $info, ilMailNotification\appendBody(), array, createGroupStatus(), ilMailNotification\createPermanentLink(), ilMailNotification\getAdditionalInformation(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMail\getSalutation(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), isNotificationTypeEnabled(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), and ilMailNotification\userToString().

75  {
76  if (!$this->isNotificationTypeEnabled($this->getType())) {
77  $GLOBALS['DIC']->logger()->grp()->info('Membership mail disabled globally.');
78  return false;
79  }
80  // parent::send();
81 
82  switch ($this->getType()) {
83  case self::TYPE_ADMISSION_MEMBER:
84 
85  foreach ($this->getRecipients() as $rcp) {
86  $this->initLanguage($rcp);
87  $this->initMail();
88  $this->setSubject(
89  sprintf($this->getLanguageText('grp_mail_admission_new_sub'), $this->getObjectTitle(true))
90  );
91  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
92  $this->appendBody("\n\n");
93  $this->appendBody(
94  sprintf($this->getLanguageText('grp_mail_admission_new_bod'), $this->getObjectTitle())
95  );
96  $this->appendBody("\n\n");
97  $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
98  $this->appendBody("\n\n");
99  $this->appendBody($this->createPermanentLink());
100  $this->getMail()->appendInstallationSignature(true);
101 
102  $this->sendMail(array($rcp), array('system'));
103  }
104  break;
105 
106  case self::TYPE_DISMISS_MEMBER:
107 
108  foreach ($this->getRecipients() as $rcp) {
109  $this->initLanguage($rcp);
110  $this->initMail();
111  $this->setSubject(
112  sprintf($this->getLanguageText('grp_mail_dismiss_sub'), $this->getObjectTitle(true))
113  );
114  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
115  $this->appendBody("\n\n");
116  $this->appendBody(
117  sprintf($this->getLanguageText('grp_mail_dismiss_bod'), $this->getObjectTitle())
118  );
119  $this->getMail()->appendInstallationSignature(true);
120  $this->sendMail(array($rcp), array('system'));
121  }
122  break;
123 
124 
125  case self::TYPE_NOTIFICATION_REGISTRATION:
126 
127  foreach ($this->getRecipients() as $rcp) {
128  $this->initLanguage($rcp);
129  $this->initMail();
130  $this->setSubject(
131  sprintf($this->getLanguageText('grp_mail_notification_reg_sub'), $this->getObjectTitle(true))
132  );
133  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
134  $this->appendBody("\n\n");
135 
136  $info = $this->getAdditionalInformation();
137  $this->appendBody(
138  sprintf(
139  $this->getLanguageText('grp_mail_notification_reg_bod'),
140  $this->userToString($info['usr_id']),
141  $this->getObjectTitle()
142  )
143  );
144  $this->appendBody("\n\n");
145  $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
146  $this->appendBody("\n\n");
147  $this->appendBody($this->createPermanentLink(array(), '_mem'));
148 
149  $this->appendBody("\n\n");
150  $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
151 
152  $this->getMail()->appendInstallationSignature(true);
153  $this->sendMail(array($rcp), array('system'));
154  }
155  break;
156 
157  case self::TYPE_UNSUBSCRIBE_MEMBER:
158 
159  foreach ($this->getRecipients() as $rcp) {
160  $this->initLanguage($rcp);
161  $this->initMail();
162  $this->setSubject(
163  sprintf($this->getLanguageText('grp_mail_unsubscribe_member_sub'), $this->getObjectTitle(true))
164  );
165  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
166  $this->appendBody("\n\n");
167  $this->appendBody(
168  sprintf($this->getLanguageText('grp_mail_unsubscribe_member_bod'), $this->getObjectTitle())
169  );
170  $this->getMail()->appendInstallationSignature(true);
171  $this->sendMail(array($rcp), array('system'));
172  }
173  break;
174 
175  case self::TYPE_NOTIFICATION_UNSUBSCRIBE:
176 
177  foreach ($this->getRecipients() as $rcp) {
178  $this->initLanguage($rcp);
179  $this->initMail();
180  $this->setSubject(
181  sprintf($this->getLanguageText('grp_mail_notification_unsub_sub'), $this->getObjectTitle(true))
182  );
183  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
184  $this->appendBody("\n\n");
185 
186  $info = $this->getAdditionalInformation();
187  $this->appendBody(
188  sprintf(
189  $this->getLanguageText('grp_mail_notification_unsub_bod'),
190  $this->userToString($info['usr_id']),
191  $this->getObjectTitle()
192  )
193  );
194  $this->appendBody("\n\n");
195  $this->appendBody($this->getLanguageText('grp_mail_notification_unsub_bod2'));
196  $this->appendBody("\n\n");
197  $this->appendBody($this->createPermanentLink(array(), '_mem'));
198 
199  $this->appendBody("\n\n");
200  $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
201 
202  $this->getMail()->appendInstallationSignature(true);
203  $this->sendMail(array($rcp), array('system'));
204  }
205  break;
206 
207 
208  case self::TYPE_SUBSCRIBE_MEMBER:
209 
210  foreach ($this->getRecipients() as $rcp) {
211  $this->initLanguage($rcp);
212  $this->initMail();
213  $this->setSubject(
214  sprintf($this->getLanguageText('grp_mail_subscribe_member_sub'), $this->getObjectTitle(true))
215  );
216  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
217  $this->appendBody("\n\n");
218  $this->appendBody(
219  sprintf($this->getLanguageText('grp_mail_subscribe_member_bod'), $this->getObjectTitle())
220  );
221 
222  $this->appendBody("\n\n");
223  $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
224  $this->appendBody("\n\n");
225  $this->appendBody($this->createPermanentLink());
226  $this->getMail()->appendInstallationSignature(true);
227 
228  $this->sendMail(array($rcp), array('system'));
229  }
230  break;
231 
232 
233  case self::TYPE_NOTIFICATION_REGISTRATION_REQUEST:
234 
235  foreach ($this->getRecipients() as $rcp) {
236  $this->initLanguage($rcp);
237  $this->initMail();
238  $this->setSubject(
239  sprintf($this->getLanguageText('grp_mail_notification_reg_req_sub'), $this->getObjectTitle(true))
240  );
241  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
242  $this->appendBody("\n\n");
243 
244  $info = $this->getAdditionalInformation();
245  $this->appendBody(
246  sprintf(
247  $this->getLanguageText('grp_mail_notification_reg_req_bod'),
248  $this->userToString($info['usr_id']),
249  $this->getObjectTitle()
250  )
251  );
252  $this->appendBody("\n\n");
253  $this->appendBody($this->getLanguageText('grp_mail_notification_reg_req_bod2'));
254  $this->appendBody("\n");
255  $this->appendBody($this->createPermanentLink(array(), '_mem'));
256 
257  $this->appendBody("\n\n");
258  $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
259 
260  $this->getMail()->appendInstallationSignature(true);
261  $this->sendMail(array($rcp), array('system'));
262  }
263  break;
264 
265  case self::TYPE_REFUSED_SUBSCRIPTION_MEMBER:
266 
267  foreach ($this->getRecipients() as $rcp) {
268  $this->initLanguage($rcp);
269  $this->initMail();
270  $this->setSubject(
271  sprintf($this->getLanguageText('grp_mail_sub_dec_sub'), $this->getObjectTitle(true))
272  );
273  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
274  $this->appendBody("\n\n");
275  $this->appendBody(
276  sprintf($this->getLanguageText('grp_mail_sub_dec_bod'), $this->getObjectTitle())
277  );
278 
279  $this->getMail()->appendInstallationSignature(true);
280 
281  $this->sendMail(array($rcp), array('system'));
282  }
283  break;
284 
285  case self::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER:
286 
287  foreach ($this->getRecipients() as $rcp) {
288  $this->initLanguage($rcp);
289  $this->initMail();
290  $this->setSubject(
291  sprintf($this->getLanguageText('grp_mail_sub_acc_sub'), $this->getObjectTitle(true))
292  );
293  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
294  $this->appendBody("\n\n");
295  $this->appendBody(
296  sprintf($this->getLanguageText('grp_mail_sub_acc_bod'), $this->getObjectTitle())
297  );
298  $this->appendBody("\n\n");
299  $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
300  $this->appendBody("\n\n");
301  $this->appendBody($this->createPermanentLink());
302  $this->getMail()->appendInstallationSignature(true);
303 
304  $this->sendMail(array($rcp), array('system'));
305  }
306  break;
307 
308  case self::TYPE_WAITING_LIST_MEMBER:
309  foreach ($this->getRecipients() as $rcp) {
310  $this->initLanguage($rcp);
311  $this->initMail();
312  $this->setSubject(
313  sprintf($this->getLanguageText('grp_mail_wl_sub'), $this->getObjectTitle(true))
314  );
315 
316  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
317 
318  $info = $this->getAdditionalInformation();
319  $this->appendBody("\n\n");
320  $this->appendBody(
321  sprintf(
322  $this->getLanguageText('grp_mail_wl_bod'),
323  $this->getObjectTitle(),
324  $info['position']
325  )
326  );
327  $this->getMail()->appendInstallationSignature(true);
328  $this->sendMail(array($rcp), array('system'));
329  }
330  break;
331 
332 
333  case self::TYPE_STATUS_CHANGED:
334  foreach ($this->getRecipients() as $rcp) {
335  $this->initLanguage($rcp);
336  $this->initMail();
337  $this->setSubject(
338  sprintf($this->getLanguageText('grp_mail_status_sub'), $this->getObjectTitle(true))
339  );
340  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
341  $this->appendBody("\n\n");
342  $this->appendBody(
343  sprintf($this->getLanguageText('grp_mail_status_bod'), $this->getObjectTitle())
344  );
345 
346  $this->appendBody("\n\n");
347  $this->appendBody($this->createGroupStatus($rcp));
348 
349  $this->appendBody("\n\n");
350  $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
351  $this->appendBody("\n\n");
352  $this->appendBody($this->createPermanentLink());
353 
354  $this->getMail()->appendInstallationSignature(true);
355 
356  $this->sendMail(array($rcp), array('system'));
357  }
358  break;
359 
360  }
361  return true;
362  }
isNotificationTypeEnabled($a_type)
get setting "mail_grp_member_notification" and excludes types which are not affected by this setting ...
getType()
Get notification type.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getObjectTitle($a_shorten=false)
Create styles array
The data for the language used.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getRecipients()
get array of recipients
createPermanentLink($a_params=array(), $a_append='')
appendBody($a_body)
Append body text.
$info
Definition: index.php:5
static getSalutation($a_usr_id, ilLanguage $a_language=null)
+ 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:
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: