ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 389 of file class.ilGroupMembershipMailNotification.php.

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

Referenced by send().

390  {
392 
393  $body = $this->getLanguageText('grp_new_status')."\n";
394  $body .= $this->getLanguageText('role').': ';
395 
396 
397  if($part->isAdmin($a_usr_id))
398  {
399  $body .= $this->getLanguageText('il_grp_admin')."\n";
400 
401  }
402  else
403  {
404  $body .= $this->getLanguageText('il_grp_member')."\n";
405  }
406 
407  if($part->isAdmin($a_usr_id))
408  {
409  $body .= $this->getLanguageText('grp_notification').': ';
410 
411  if($part->isNotificationEnabled($a_usr_id))
412  {
413  $body .= $this->getLanguageText('grp_notify_on')."\n";
414  }
415  else
416  {
417  $body .= $this->getLanguageText('grp_notify_off')."\n";
418  }
419  }
420  return $body;
421  }
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 378 of file class.ilGroupMembershipMailNotification.php.

References ilMailNotification\getLanguage().

Referenced by send().

379  {
380  parent::initLanguage($a_usr_id);
381  $this->getLanguage()->loadLanguageModule('grp');
382  }
+ 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 430 of file class.ilGroupMembershipMailNotification.php.

References $a_type, and $ilSetting.

Referenced by send().

431  {
432  global $ilSetting;
433 
434  return
435  $this->force_sending_mail ||
436  $ilSetting->get('mail_grp_member_notification',true) ||
437  in_array($a_type, $this->permanent_enabled_notifications);
438  }
$a_type
Definition: workflow.php:93
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(), ilMailNotification\getType(), initLanguage(), ilMailNotification\initMail(), isNotificationTypeEnabled(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), and ilMailNotification\userToString().

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

const ilGroupMembershipMailNotification::TYPE_ADMISSION_MEMBER = 20

◆ 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: