ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilSessionMembershipMailNotification Class Reference
+ Inheritance diagram for ilSessionMembershipMailNotification:
+ Collaboration diagram for ilSessionMembershipMailNotification:

Public Member Functions

 __construct ()
 
 send (int $userId=0)
 
- Public Member Functions inherited from ilMailNotification
 __construct (protected bool $is_in_wsp=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
final 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 = []
 
ilWorkspaceTree $wsp_tree
 
ilWorkspaceAccessHandler $wsp_access_handler
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilSessionMembershipMailNotification::__construct ( )

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

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

53  {
54  global $DIC;
55 
56  $this->setting = $DIC->settings();
57 
59  }
global $DIC
Definition: shib_login.php:22
__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 338 of file class.ilSessionMembershipMailNotification.php.

References ilMailNotification\getLanguage().

Referenced by send().

338  : void
339  {
340  parent::initLanguage($a_usr_id);
341  $this->getLanguage()->loadLanguageModule('sess');
342  }
+ 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 61 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(), null, ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setSubject(), and ilMailNotification\userToString().

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

Field Documentation

◆ $setting

ilSetting ilSessionMembershipMailNotification::$setting
protected

Definition at line 50 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: