ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSessionMembershipMailNotification Class Reference
+ Inheritance diagram for ilSessionMembershipMailNotification:
+ Collaboration diagram for ilSessionMembershipMailNotification:

Public Member Functions

 __construct ()
 
 send ($userId='')
 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_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_BLOCKED_MEMBER = 25
 
const TYPE_UNBLOCKED_MEMBER = 26
 
const TYPE_UNSUBSCRIBE_MEMBER = 27
 
const TYPE_SUBSCRIBE_MEMBER = 28
 
const TYPE_NOTIFICATION_REGISTRATION = 30
 
const TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31
 
const TYPE_NOTIFICATION_UNSUBSCRIBE = 32
 
const TYPE_ENTER_NOTIFICATION = 100
 
const TYPE_REGISTER_NOTIFICATION = 101
 
const TYPE_UNREGISTER_NOTIFICATION = 102
 
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 initLanguage ($a_usr_id)
 Add language module crs. 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...
 

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

ilSessionMembershipMailNotification::__construct ( )

Definition at line 38 of file class.ilSessionMembershipMailNotification.php.

References ILIAS\GlobalScreen\Provider\__construct().

39  {
41  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ initLanguage()

ilSessionMembershipMailNotification::initLanguage (   $a_usr_id)
protected

Add language module crs.

Parameters
object$a_usr_id
Returns

Definition at line 335 of file class.ilSessionMembershipMailNotification.php.

References ilMailNotification\getLanguage().

Referenced by send().

336  {
337  parent::initLanguage($a_usr_id);
338  $this->getLanguage()->loadLanguageModule('sess');
339  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilSessionMembershipMailNotification::send (   $userId = '')

Send notifications.

Returns

Definition at line 47 of file class.ilSessionMembershipMailNotification.php.

References $DIC, $ilSetting, ilMailNotification\appendBody(), ilMailNotification\createPermanentLink(), ilMailNotification\getAdditionalInformation(), ilObjectFactory\getInstanceByObjId(), 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().

48  {
49  global $DIC;
50 
51  $ilSetting = $DIC['ilSetting'];
52 
53  // parent::send();
54 
55  switch ($this->getType()) {
56  case self::TYPE_ADMISSION_MEMBER:
57 
58  // automatic mails about status change disabled
59  if (!$ilSetting->get('mail_grp_member_notification', false)) {
60  return;
61  }
62 
63  foreach ($this->getRecipients() as $rcp) {
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));
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  return;
89  }
90 
91  foreach ($this->getRecipients() as $rcp) {
92  $this->initLanguage($rcp);
93  $this->initMail();
94  $this->setSubject(
95  sprintf($this->getLanguageText('grp_mail_dismiss_sub'), $this->getObjectTitle(true))
96  );
97  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
98  $this->appendBody("\n\n");
99  $this->appendBody(
100  sprintf($this->getLanguageText('grp_mail_dismiss_bod'), $this->getObjectTitle())
101  );
102  $this->getMail()->appendInstallationSignature(true);
103  $this->sendMail(array($rcp));
104  }
105  break;
106 
107 
108 
109 
110  case self::TYPE_SUBSCRIBE_MEMBER:
111 
112  foreach ($this->getRecipients() as $rcp) {
113  $this->initLanguage($rcp);
114  $this->initMail();
115  $this->setSubject(
116  sprintf($this->getLanguageText('grp_mail_subscribe_member_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_subscribe_member_bod'), $this->getObjectTitle())
122  );
123 
124  $this->appendBody("\n\n");
125  $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
126  $this->appendBody("\n\n");
127  $this->appendBody($this->createPermanentLink());
128  $this->getMail()->appendInstallationSignature(true);
129 
130  $this->sendMail(array($rcp));
131  }
132  break;
133 
134 
135  case self::TYPE_NOTIFICATION_REGISTRATION_REQUEST:
136 
137  foreach ($this->getRecipients() as $rcp) {
138  $this->initLanguage($rcp);
139  $this->initMail();
140  $this->setSubject(
141  sprintf($this->getLanguageText('grp_mail_notification_reg_req_sub'), $this->getObjectTitle(true))
142  );
143  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
144  $this->appendBody("\n\n");
145 
146  $info = $this->getAdditionalInformation();
147  $this->appendBody(
148  sprintf(
149  $this->getLanguageText('grp_mail_notification_reg_req_bod'),
150  $this->userToString($info['usr_id']),
151  $this->getObjectTitle()
152  )
153  );
154  $this->appendBody("\n\n");
155  $this->appendBody($this->getLanguageText('grp_mail_notification_reg_req_bod2'));
156  $this->appendBody("\n");
157  $this->appendBody($this->createPermanentLink(array(), '_mem'));
158 
159  $this->appendBody("\n\n");
160  $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
161 
162  $this->getMail()->appendInstallationSignature(true);
163  $this->sendMail(array($rcp));
164  }
165  break;
166 
167  case self::TYPE_REFUSED_SUBSCRIPTION_MEMBER:
168 
169  foreach ($this->getRecipients() as $rcp) {
170  $this->initLanguage($rcp);
171  $this->initMail();
172  $this->setSubject(
173  sprintf($this->getLanguageText('sess_mail_sub_dec_sub'), $this->getObjectTitle(true))
174  );
175  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
176  $this->appendBody("\n\n");
177  $this->appendBody(
178  sprintf($this->getLanguageText('sess_mail_sub_dec_bod'), $this->getObjectTitle())
179  );
180 
181  $this->getMail()->appendInstallationSignature(true);
182 
183  $this->sendMail(array($rcp));
184  }
185  break;
186 
187  case self::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER:
188 
189  foreach ($this->getRecipients() as $rcp) {
190  $this->initLanguage($rcp);
191  $this->initMail();
192  $this->setSubject(
193  sprintf($this->getLanguageText('sess_mail_sub_acc_sub'), $this->getObjectTitle(true))
194  );
195  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
196  $this->appendBody("\n\n");
197  $this->appendBody(
198  sprintf($this->getLanguageText('sess_mail_sub_acc_bod'), $this->getObjectTitle())
199  );
200  $this->appendBody("\n\n");
201  $this->appendBody($this->getLanguageText('sess_mail_permanent_link'));
202  $this->appendBody("\n\n");
203  $this->appendBody($this->createPermanentLink());
204  $this->getMail()->appendInstallationSignature(true);
205 
206  $this->sendMail(array($rcp));
207  }
208  break;
209 
210  case self::TYPE_ENTER_NOTIFICATION:
211  if ('' === $userId) {
212  throw new ilException('No user id given');
213  }
214 
215  $userObject = ilObjectFactory::getInstanceByObjId($userId, false);
216  if (!$userObject || !($userObject instanceof \ilObjUser)) {
217  throw new ilException(sprintf('User with ID "%s" does not exist.', $userId));
218  }
219 
220  foreach ($this->getRecipients() as $rcp) {
221  $this->initLanguage($rcp);
222  $this->initMail();
223  $this->setSubject(
224  sprintf(
225  $this->getLanguageText('session_mail_subject_entered'),
226  $userObject->getFullname(),
227  $this->getObjectTitle(true)
228  )
229  );
230  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
231  $this->appendBody("\n\n");
232  $this->appendBody(
233  sprintf(
234  $this->getLanguageText('entered_notification'),
235  $userObject->getFullname(),
236  $this->getObjectTitle()
237  )
238  );
239  $this->appendBody("\n\n");
240  $this->appendBody($this->getLanguageText('sess_mail_permanent_link_participants'));
241  $this->appendBody("\n\n");
242  $this->appendBody($this->createPermanentLink([], '_part'));
243  $this->getMail()->appendInstallationSignature(true);
244 
245  $this->sendMail(array($rcp), array('system'));
246  }
247  break;
248 
249  case self::TYPE_REGISTER_NOTIFICATION:
250  if ('' === $userId) {
251  throw new ilException('No user id given');
252  }
253 
254  $userObject = ilObjectFactory::getInstanceByObjId($userId, false);
255  if (!$userObject || !($userObject instanceof \ilObjUser)) {
256  throw new ilException(sprintf('User with ID "%s" does not exist.', $userId));
257  }
258 
259  foreach ($this->getRecipients() as $rcp) {
260  $this->initLanguage($rcp);
261  $this->initMail();
262  $this->setSubject(
263  sprintf(
264  $this->getLanguageText('session_mail_subject_registered'),
265  $userObject->getFullname(),
266  $this->getObjectTitle(true)
267  )
268  );
269  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
270  $this->appendBody("\n\n");
271  $this->appendBody(
272  sprintf(
273  $this->getLanguageText('register_notification'),
274  $userObject->getFullname(),
275  $this->getObjectTitle()
276  )
277  );
278  $this->appendBody("\n\n");
279  $this->appendBody($this->getLanguageText('sess_mail_permanent_link_participants'));
280  $this->appendBody("\n\n");
281  $this->appendBody($this->createPermanentLink([], '_part'));
282  $this->getMail()->appendInstallationSignature(true);
283 
284  $this->sendMail(array($rcp), array('system'));
285  }
286  break;
287 
288  case self::TYPE_UNREGISTER_NOTIFICATION:
289  if ('' === $userId) {
290  throw new ilException('No user id given');
291  }
292 
293  $userObject = ilObjectFactory::getInstanceByObjId($userId, false);
294  if (!$userObject || !($userObject instanceof \ilObjUser)) {
295  throw new ilException(sprintf('User with ID "%s" does not exist.', $userId));
296  }
297 
298  foreach ($this->getRecipients() as $rcp) {
299  $this->initLanguage($rcp);
300  $this->initMail();
301  $this->setSubject(
302  sprintf(
303  $this->getLanguageText('session_mail_subject_deletion'),
304  $userObject->getFullname(),
305  $this->getObjectTitle(true)
306  )
307  );
308  $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
309  $this->appendBody("\n\n");
310  $this->appendBody(
311  sprintf(
312  $this->getLanguageText('deletion_notification'),
313  $userObject->getFullname(),
314  $this->getObjectTitle()
315  )
316  );
317  $this->appendBody("\n\n");
318  $this->appendBody($this->getLanguageText('sess_mail_permanent_link_participants'));
319  $this->appendBody("\n\n");
320  $this->appendBody($this->createPermanentLink([], '_part'));
321  $this->getMail()->appendInstallationSignature(true);
322 
323  $this->sendMail(array($rcp), array('system'));
324  }
325  break;
326  }
327  return true;
328  }
getType()
Get notification type.
sendMail(array $a_rcp, $a_parse_recipients=true)
global $DIC
Definition: goto.php:24
getObjectTitle($a_shorten=false)
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
getRecipients()
get array of recipients
createPermanentLink($a_params=array(), $a_append='')
global $ilSetting
Definition: privfeed.php:17
appendBody($a_body)
Append body text.
static getSalutation($a_usr_id, ilLanguage $a_language=null)
+ Here is the call graph for this function:

Field Documentation

◆ TYPE_ACCEPTED_SUBSCRIPTION_MEMBER

const ilSessionMembershipMailNotification::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER = 22

◆ TYPE_ADMISSION_MEMBER

const ilSessionMembershipMailNotification::TYPE_ADMISSION_MEMBER = 20

◆ TYPE_BLOCKED_MEMBER

const ilSessionMembershipMailNotification::TYPE_BLOCKED_MEMBER = 25

◆ TYPE_DISMISS_MEMBER

const ilSessionMembershipMailNotification::TYPE_DISMISS_MEMBER = 21

◆ TYPE_ENTER_NOTIFICATION

const ilSessionMembershipMailNotification::TYPE_ENTER_NOTIFICATION = 100

◆ TYPE_NOTIFICATION_REGISTRATION

const ilSessionMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION = 30

◆ TYPE_NOTIFICATION_REGISTRATION_REQUEST

const ilSessionMembershipMailNotification::TYPE_NOTIFICATION_REGISTRATION_REQUEST = 31

◆ TYPE_NOTIFICATION_UNSUBSCRIBE

const ilSessionMembershipMailNotification::TYPE_NOTIFICATION_UNSUBSCRIBE = 32

◆ TYPE_REFUSED_SUBSCRIPTION_MEMBER

const ilSessionMembershipMailNotification::TYPE_REFUSED_SUBSCRIPTION_MEMBER = 23

◆ TYPE_REGISTER_NOTIFICATION

const ilSessionMembershipMailNotification::TYPE_REGISTER_NOTIFICATION = 101

◆ TYPE_SUBSCRIBE_MEMBER

const ilSessionMembershipMailNotification::TYPE_SUBSCRIBE_MEMBER = 28

◆ TYPE_UNBLOCKED_MEMBER

const ilSessionMembershipMailNotification::TYPE_UNBLOCKED_MEMBER = 26

◆ TYPE_UNREGISTER_NOTIFICATION

const ilSessionMembershipMailNotification::TYPE_UNREGISTER_NOTIFICATION = 102

◆ TYPE_UNSUBSCRIBE_MEMBER

const ilSessionMembershipMailNotification::TYPE_UNSUBSCRIBE_MEMBER = 27

The documentation for this class was generated from the following file: