ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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 372 of file class.ilGroupMembershipMailNotification.php.

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

Referenced by send().

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

References ilMailNotification\getLanguage().

Referenced by send().

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