ILIAS  release_4-4 Revision
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)
 Constructor. More...
 
 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 ($a_rcp)
 set mail recipients More...
 
 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)
 Set ref id. More...
 
 getRefId ()
 get reference id More...
 
 getObjId ()
 get object id More...
 
 setObjId ($a_obj_id)
 set obj id More...
 
 getObjType ()
 Get object type. More...
 
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails. More...
 
 getAdditionalInformation ()
 Get additional information for generating notification mails. More...
 
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail. More...
 
 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...
 
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 Set mail subject. More...
 
 getSubject ()
 Get mail subject. More...
 
 setBody ($a_body)
 Set mail body. More...
 
 appendBody ($a_body)
 Append body text. More...
 
 getBody ()
 Get body. More...
 
 initLanguage ($a_usr_id)
 Init language. More...
 
 initLanguageByIso2Code ($a_code='')
 Init language by ISO2 code. More...
 
 setLanguage ($a_language)
 A language. More...
 
 getLanguage ()
 get language object More...
 
 getLanguageText ($a_keyword)
 Replace new lines. More...
 
 getObjectTitle ($a_shorten=false)
 Get object title. More...
 
 initMail ()
 Init mail. More...
 
 getMail ()
 Get mail object. More...
 
 createPermanentLink ($a_params=array(), $a_append='')
 Create a permanent link for an object. More...
 
 userToString ($a_usr_id)
 Utility function. More...
 
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user. More...
 

Additional Inherited Members

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

38  {
39  parent::__construct();
40  }

Member Function Documentation

◆ createGroupStatus()

ilGroupMembershipMailNotification::createGroupStatus (   $a_usr_id)
protected

Get course status body.

Parameters
int$a_usr_id
Returns
string

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

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

Referenced by send().

371  {
373 
374  $body = $this->getLanguageText('grp_new_status')."\n";
375  $body .= $this->getLanguageText('role').': ';
376 
377 
378  if($part->isAdmin($a_usr_id))
379  {
380  $body .= $this->getLanguageText('il_grp_admin')."\n";
381 
382  }
383  else
384  {
385  $body .= $this->getLanguageText('il_grp_member')."\n";
386  }
387 
388  if($part->isAdmin($a_usr_id))
389  {
390  $body .= $this->getLanguageText('grp_notification').': ';
391 
392  if($part->isNotificationEnabled($a_usr_id))
393  {
394  $body .= $this->getLanguageText('grp_notify_on')."\n";
395  }
396  else
397  {
398  $body .= $this->getLanguageText('grp_notify_off')."\n";
399  }
400  }
401  return $body;
402  }
getLanguageText($a_keyword)
Replace new lines.
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 359 of file class.ilGroupMembershipMailNotification.php.

References ilMailNotification\getLanguage().

Referenced by send().

360  {
361  parent::initLanguage($a_usr_id);
362  $this->getLanguage()->loadLanguageModule('grp');
363  }
getLanguage()
get language object
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilGroupMembershipMailNotification::send ( )

Send notifications.

Returns

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

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

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

Field Documentation

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