ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSessionMembershipMailNotification Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSessionMembershipMailNotification:
+ Collaboration diagram for ilSessionMembershipMailNotification:

Public Member Functions

 __construct ()
 
 send (int $userId=0)
 
- Public Member Functions inherited from ilMailNotification
 __construct (bool $a_is_personal_workspace=false)
 
 setType (int $a_type)
 
 getType ()
 
 setSender (int $a_usr_id)
 
 getSender ()
 
 setRecipients (array $a_rcp)
 
 getRecipients ()
 
 setAttachments (array $a_att)
 
 getAttachments ()
 
 setLangModules (array $a_modules)
 
 getUserLanguage (int $a_usr_id)
 
 setRefId (int $a_id)
 
 getRefId ()
 
 getObjId ()
 
 setObjId (int $a_obj_id)
 
 getObjType ()
 
 setAdditionalInformation (array $a_info)
 
 getAdditionalInformation ()
 
 sendMail (array $a_rcp, bool $a_parse_recipients=true)
 
 getBlockBorder ()
 

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 (int $a_usr_id)
 
- Protected Member Functions inherited from ilMailNotification
 setSubject (string $a_subject)
 
 getSubject ()
 
 setBody (string $a_body)
 
 appendBody (string $a_body)
 
 getBody ()
 
 initLanguage (int $a_usr_id)
 
 initLanguageByIso2Code (string $a_code='')
 
 setLanguage (ilLanguage $a_language)
 
 getLanguage ()
 
 getLanguageText (string $a_keyword)
 
 getObjectTitle (bool $a_shorten=false)
 
 initMail ()
 
 getMail ()
 
 createPermanentLink (array $a_params=[], string $a_append='')
 
 userToString (int $a_usr_id)
 
 isRefIdAccessible (int $a_user_id, int $a_ref_id, string $a_permission="read")
 

Protected Attributes

ilSetting $setting
 
- Protected Attributes inherited from ilMailNotification
int $type
 
int $sender
 
ilMail $mail = null
 
string $subject = ''
 
string $body = ''
 
array $attachments = []
 
ilLanguage $language
 
array $lang_modules = []
 
array $recipients = []
 
int $ref_id
 
int $obj_id = 0
 
string $obj_type = ''
 
array $additional_info = []
 
bool $is_in_wsp
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilSessionMembershipMailNotification::__construct ( )

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

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

54  {
55  global $DIC;
56 
57  $this->setting = $DIC->settings();
58 
60  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ initLanguage()

ilSessionMembershipMailNotification::initLanguage ( int  $a_usr_id)
protected

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

References ilMailNotification\getLanguage().

Referenced by send().

339  : void
340  {
341  parent::initLanguage($a_usr_id);
342  $this->getLanguage()->loadLanguageModule('sess');
343  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

ilSessionMembershipMailNotification::send ( int  $userId = 0)

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

References $ilSetting, $setting, 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().

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

Field Documentation

◆ $setting

ilSetting ilSessionMembershipMailNotification::$setting
protected

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

Referenced by send().

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