ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilGroupMembershipMailNotification Class Reference
+ Inheritance diagram for ilGroupMembershipMailNotification:
+ Collaboration diagram for ilGroupMembershipMailNotification:

Public Member Functions

 __construct ()
 
 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilGroupMembershipMailNotification::__construct ( )

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

50  {
51  parent::__construct();
52  }

Member Function Documentation

◆ createGroupStatus()

ilGroupMembershipMailNotification::createGroupStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

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

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

Referenced by send().

374  {
376 
377  $body = $this->getLanguageText('grp_new_status')."\n";
378  $body .= $this->getLanguageText('role').': ';
379 
380 
381  if($part->isAdmin($a_usr_id))
382  {
383  $body .= $this->getLanguageText('il_grp_admin')."\n";
384 
385  }
386  else
387  {
388  $body .= $this->getLanguageText('il_grp_member')."\n";
389  }
390 
391  if($part->isAdmin($a_usr_id))
392  {
393  $body .= $this->getLanguageText('grp_notification').': ';
394 
395  if($part->isNotificationEnabled($a_usr_id))
396  {
397  $body .= $this->getLanguageText('grp_notify_on')."\n";
398  }
399  else
400  {
401  $body .= $this->getLanguageText('grp_notify_off')."\n";
402  }
403  }
404  return $body;
405  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initLanguage()

ilGroupMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Add language module crs.

Parameters
object$a_usr_id
Returns

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

References ilMailNotification\getLanguage().

Referenced by send().

363  {
364  parent::initLanguage($a_usr_id);
365  $this->getLanguage()->loadLanguageModule('grp');
366  }
+ 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 414 of file class.ilGroupMembershipMailNotification.php.

References $ilSetting.

Referenced by send().

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

◆ send()

ilGroupMembershipMailNotification::send ( )

Send notifications.

Returns

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

References $GLOBALS, $info, ilMailNotification\appendBody(), 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().

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

Field Documentation

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

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: