ILIAS  release_8 Revision v8.24
ilCalendarMailNotification Class Reference

Distributes calendar mail notifications. More...

+ Inheritance diagram for ilCalendarMailNotification:
+ Collaboration diagram for ilCalendarMailNotification:

Public Member Functions

 __construct (bool $a_is_personal_workspace=false)
 
 setAppointmentId (int $a_id)
 
 getAppointment ()
 
 getAppointmentId ()
 
 appendAppointmentDetails ()
 
 send ()
 
- 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_GRP_NOTIFICATION = 1
 
const TYPE_GRP_NEW_NOTIFICATION = 2
 
const TYPE_CRS_NOTIFICATION = 3
 
const TYPE_CRS_NEW_NOTIFICATION = 4
 
const TYPE_BOOKING_CONFIRMATION = 5
 
const TYPE_BOOKING_CANCELLATION = 6
 
const TYPE_USER = 7
 
const TYPE_USER_ANONYMOUS = 8
 
const TYPE_BOOKING_REMINDER = 9
 
- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

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

ilLanguage $lng
 
ilRbacReview $rbacreview
 
- 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
 

Private Attributes

int $appointment_id = null
 
ilCalendarEntry $appointment = null
 

Detailed Description

Distributes calendar mail notifications.

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

Definition at line 26 of file class.ilCalendarMailNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarMailNotification::__construct ( bool  $a_is_personal_workspace = false)

Reimplemented from ilMailNotification.

Definition at line 44 of file class.ilCalendarMailNotification.php.

45 {
46 global $DIC;
47
48 parent::__construct($a_is_personal_workspace);
49 $this->lng = $DIC->language();
50 $this->rbacreview = $DIC->rbac()->review();
51 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addAttachment()

ilCalendarMailNotification::addAttachment ( )
protected

Definition at line 377 of file class.ilCalendarMailNotification.php.

377 : void
378 {
379 $export = new ilCalendarExport();
380 $export->setExportType(ilCalendarExport::EXPORT_APPOINTMENTS);
381 $export->setAppointments([(int) $this->getAppointmentId()]);
382 $export->export();
383
384 $ics_filename = 'appointment_' . (new DateTimeImmutable('now'))->format('Ymd_His_u') . '.ics';
385
386 $attachment = new ilFileDataMail($this->getSender());
387 $effective_ics_filename = $attachment->storeAsAttachment(
388 $ics_filename,
389 $export->getExportString()
390 );
391
392 $this->setAttachments([$effective_ics_filename]);
393 }
@classDescription Export calendar(s) to ical format
This class handles all operations on files (attachments) in directory ilias_data/mail.

References ilCalendarExport\EXPORT_APPOINTMENTS, getAppointmentId(), ilMailNotification\getSender(), and ilMailNotification\setAttachments().

Referenced by send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ appendAppointmentDetails()

ilCalendarMailNotification::appendAppointmentDetails ( )

Definition at line 69 of file class.ilCalendarMailNotification.php.

69 : void
70 {
72 $this->appendBody($app->appointmentToMailString($this->getLanguage()));
73 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$app
Definition: cli.php:39

References $app, ilMailNotification\appendBody(), and getAppointmentId().

Referenced by send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteAttachments()

ilCalendarMailNotification::deleteAttachments ( )
protected

Definition at line 395 of file class.ilCalendarMailNotification.php.

395 : void
396 {
397 $attachment = new ilFileDataMail($this->getSender());
398 $attachment->unlinkFiles($this->getAttachments());
399 }

References ilMailNotification\getAttachments(), and ilMailNotification\getSender().

Referenced by send().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAppointment()

ilCalendarMailNotification::getAppointment ( )

Definition at line 59 of file class.ilCalendarMailNotification.php.

References $appointment.

Referenced by send().

+ Here is the caller graph for this function:

◆ getAppointmentId()

ilCalendarMailNotification::getAppointmentId ( )

Definition at line 64 of file class.ilCalendarMailNotification.php.

References $appointment_id.

Referenced by addAttachment(), appendAppointmentDetails(), send(), and setAppointmentId().

+ Here is the caller graph for this function:

◆ send()

ilCalendarMailNotification::send ( )

Definition at line 75 of file class.ilCalendarMailNotification.php.

75 : void
76 {
77 switch ($this->getType()) {
78 case self::TYPE_USER:
79 $rcps = $this->getRecipients();
80 $rcp = array_pop($rcps);
81 $this->initLanguage($rcp);
82 $this->getLanguage()->loadLanguageModule('dateplaner');
83 $this->initMail();
84 $this->setSubject(
85 sprintf(
86 $this->getLanguageText('cal_mail_notification_subject'),
87 $this->getAppointment()->getTitle()
88 )
89 );
90 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
91 $this->appendBody("\n\n");
92 $this->appendBody(
93 $this->getLanguageText('cal_mail_notification_body')
94 );
95 $this->appendBody("\n\n");
97 $this->appendBody("\n\n");
98 $this->getMail()->appendInstallationSignature(true);
99 $this->addAttachment();
100
101 $this->sendMail(
102 $this->getRecipients(),
103 true
104 );
105 break;
106
108
109 $rcps = $this->getRecipients();
110 $rcp = array_pop($rcps);
111
112 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
113 $this->getLanguage()->loadLanguageModule('dateplaner');
114 $this->getLanguage()->loadLanguageModule('mail');
115 $this->initMail();
116 $this->setSubject(
117 sprintf(
118 $this->getLanguageText('cal_mail_notification_subject'),
119 $this->getAppointment()->getTitle()
120 )
121 );
122 $this->setBody(ilMail::getSalutation(0, $this->getLanguage()));
123 $this->appendBody("\n\n");
124 $this->appendBody(
125 $this->getLanguageText('cal_mail_notification_body')
126 );
127 $this->appendBody("\n\n");
129 $this->appendBody("\n\n");
130 $this->getMail()->appendInstallationSignature(true);
131 $this->addAttachment();
132
133 $this->sendMail(
134 $this->getRecipients(),
135 false
136 );
137 break;
138
140
141 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
142 $this->getLanguage()->loadLanguageModule('grp');
143 $this->getLanguage()->loadLanguageModule('dateplaner');
144 $this->initMail();
145 $this->setSubject(
146 sprintf($this->getLanguageText('cal_grp_new_notification_sub'), $this->getObjectTitle(true))
147 );
148 $this->setBody($this->getLanguageText('grp_notification_salutation'));
149 $this->appendBody("\n\n");
150 $this->appendBody(
151 sprintf($this->getLanguageText('cal_grp_new_notification_body'), $this->getObjectTitle(true))
152 );
153 $this->appendBody("\n\n");
154 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
155 $this->appendBody("\n\n");
156
158
159 $this->appendBody("\n\n");
160 $this->appendBody($this->createPermanentLink());
161 $this->getMail()->appendInstallationSignature(true);
162
163 $this->addAttachment();
164
165 $this->sendMail(
166 array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()),
167 false
168 );
169 break;
170
172
173 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
174 $this->getLanguage()->loadLanguageModule('grp');
175 $this->getLanguage()->loadLanguageModule('dateplaner');
176 $this->initMail();
177 $this->setSubject(
178 sprintf($this->getLanguageText('cal_grp_notification_sub'), $this->getObjectTitle(true))
179 );
180 $this->setBody($this->getLanguageText('grp_notification_salutation'));
181 $this->appendBody("\n\n");
182 $this->appendBody(
183 sprintf($this->getLanguageText('cal_grp_notification_body'), $this->getObjectTitle(true))
184 );
185 $this->appendBody("\n\n");
186
188
189 $this->appendBody("\n\n");
190 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
191 $this->appendBody("\n\n");
192 $this->appendBody($this->createPermanentLink());
193 $this->getMail()->appendInstallationSignature(true);
194
195 $this->addAttachment();
196
197 $this->sendMail(
198 array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()),
199 false
200 );
201 break;
202
204
205 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
206 $this->getLanguage()->loadLanguageModule('crs');
207 $this->getLanguage()->loadLanguageModule('dateplaner');
208 $this->initMail();
209 $this->setSubject(
210 sprintf($this->getLanguageText('cal_crs_new_notification_sub'), $this->getObjectTitle(true))
211 );
212 $this->setBody($this->getLanguageText('crs_notification_salutation'));
213 $this->appendBody("\n\n");
214 $this->appendBody(
215 sprintf($this->getLanguageText('cal_crs_new_notification_body'), $this->getObjectTitle(true))
216 );
217 $this->appendBody("\n\n");
218 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
219 $this->appendBody("\n\n");
220 $this->appendBody($this->createPermanentLink());
221 $this->appendBody("\n\n");
223
224 $this->getMail()->appendInstallationSignature(true);
225
226 $this->addAttachment();
227
228 $this->sendMail(array('#il_crs_admin_' . $this->getRefId(),
229 '#il_crs_tutor_' . $this->getRefId(),
230 '#il_crs_member_' . $this->getRefId()
231 ), false);
232 break;
233
235
236 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
237 $this->getLanguage()->loadLanguageModule('crs');
238 $this->getLanguage()->loadLanguageModule('dateplaner');
239 $this->initMail();
240 $this->setSubject(
241 sprintf($this->getLanguageText('cal_crs_notification_sub'), $this->getObjectTitle(true))
242 );
243 $this->setBody($this->getLanguageText('crs_notification_salutation'));
244 $this->appendBody("\n\n");
245 $this->appendBody(
246 sprintf($this->getLanguageText('cal_crs_notification_body'), $this->getObjectTitle(true))
247 );
248 $this->appendBody("\n\n");
249
251
252 $this->appendBody("\n\n");
253 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
254 $this->appendBody("\n\n");
255 $this->appendBody($this->createPermanentLink());
256 $this->getMail()->appendInstallationSignature(true);
257
258 $this->addAttachment();
259
260 $this->sendMail(array('#il_crs_admin_' . $this->getRefId(),
261 '#il_crs_tutor_' . $this->getRefId(),
262 '#il_crs_member_' . $this->getRefId()
263 ), false);
264 break;
265
267
268 $rcps = $this->getRecipients();
269 $user_id = array_pop($rcps);
270 $entry = new ilCalendarEntry($this->getAppointmentId());
271 $booking = new ilBookingEntry($entry->getContextId());
272
273 $this->initLanguage($user_id);
274 $this->getLanguage()->loadLanguageModule('dateplaner');
275 $this->initMail();
276 $this->setSubject(
277 sprintf($this->getLanguageText('cal_booking_confirmation_subject'), $entry->getTitle())
278 );
279 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
280 $this->appendBody("\n\n");
281 $this->appendBody(
282 sprintf(
283 $this->getLanguageText('cal_booking_confirmation_body'),
284 ilObjUser::_lookupFullname($booking->getObjId())
285 )
286 );
287 $this->appendBody("\n\n");
289
290 /*
291 $this->appendBody("\n\n");
292 $this->appendBody($this->getLanguageText('cal_booking_confirmation_link'));
293 $this->appendBody("\n\n");
294 $this->appendBody($this->createPermanentLink());
295 */
296 $this->getMail()->appendInstallationSignature(true);
297
298 $this->sendMail(array($user_id), true);
299
300 $this->appendBody("\n\n");
301 $this->appendBody($this->getLanguageText('cal_booking_confirmation_user') . "\n");
302 $this->appendBody(ilObjUser::_lookupFullname($user_id));
303
304 $this->sendMail(array($booking->getObjId()), true);
305 break;
306
308
309 $rcps = $this->getRecipients();
310 $user_id = array_pop($rcps);
311 $entry = new ilCalendarEntry($this->getAppointmentId());
312 $booking = new ilBookingEntry($entry->getContextId());
313
314 $rcps = $this->getRecipients();
315 $user_id = array_pop($rcps);
316 $this->initLanguage($user_id);
317 $this->getLanguage()->loadLanguageModule('dateplaner');
318 $this->initMail();
319 $this->setSubject(
320 sprintf($this->getLanguageText('cal_booking_cancellation_subject'), $entry->getTitle())
321 );
322 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
323 $this->appendBody("\n\n");
324 $this->appendBody(
325 sprintf(
326 $this->getLanguageText('cal_booking_cancellation_body'),
327 ilObjUser::_lookupFullname($booking->getObjId())
328 )
329 );
330 $this->appendBody("\n\n");
331
333
334 $this->getMail()->appendInstallationSignature(true);
335
336 $this->sendMail(array($user_id), true);
337
338 $this->appendBody("\n\n");
339 $this->appendBody($this->getLanguageText('cal_booking_cancellation_user') . "\n");
340 $this->appendBody(ilObjUser::_lookupFullname($user_id));
341
342 $this->sendMail(array($booking->getObjId()), true);
343 break;
344
346
347 $rcps = $this->getRecipients();
348 $user_id = array_pop($rcps);
349
350 $entry = new ilCalendarEntry($this->getAppointmentId());
351 $booking = new ilBookingEntry($entry->getContextId());
352
353 $this->initLanguage($user_id);
354 $this->getLanguage()->loadLanguageModule('dateplaner');
355 $this->initMail();
356 $this->setSubject(
357 sprintf($this->getLanguageText('cal_ch_booking_reminder_subject'), $entry->getTitle())
358 );
359 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
360 $this->appendBody("\n\n");
361 $this->appendBody(
362 sprintf(
363 $this->getLanguageText('cal_ch_booking_reminder_body'),
364 ilObjUser::_lookupFullname($booking->getObjId())
365 )
366 );
367 $this->appendBody("\n\n");
369 $this->getMail()->appendInstallationSignature(true);
370 $this->sendMail(array($user_id), true);
371 break;
372 }
373
374 $this->deleteAttachments();
375 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getLanguage(string $a_lang_key='')
Get language object.
getObjectTitle(bool $a_shorten=false)
setLanguage(ilLanguage $a_language)
sendMail(array $a_rcp, bool $a_parse_recipients=true)
createPermanentLink(array $a_params=[], string $a_append='')
getLanguageText(string $a_keyword)
setSubject(string $a_subject)
static getSalutation(int $a_usr_id, ?ilLanguage $a_language=null)
static _lookupFullname(int $a_user_id)

References ilLanguageFactory\_getLanguage(), ilObjUser\_lookupFullname(), addAttachment(), appendAppointmentDetails(), ilMailNotification\appendBody(), ilMailNotification\createPermanentLink(), deleteAttachments(), getAppointment(), getAppointmentId(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMailNotification\getRefId(), ilMail\getSalutation(), ilMailNotification\getType(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ILIAS\Repository\lng(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setLanguage(), ilMailNotification\setSubject(), TYPE_BOOKING_CANCELLATION, TYPE_BOOKING_CONFIRMATION, TYPE_BOOKING_REMINDER, TYPE_CRS_NEW_NOTIFICATION, TYPE_CRS_NOTIFICATION, TYPE_GRP_NEW_NOTIFICATION, TYPE_GRP_NOTIFICATION, TYPE_USER, and TYPE_USER_ANONYMOUS.

+ Here is the call graph for this function:

◆ setAppointmentId()

ilCalendarMailNotification::setAppointmentId ( int  $a_id)

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

53 : void
54 {
55 $this->appointment_id = $a_id;
56 $this->appointment = new ilCalendarEntry($this->getAppointmentId());
57 }

References getAppointmentId().

+ Here is the call graph for this function:

Field Documentation

◆ $appointment

ilCalendarEntry ilCalendarMailNotification::$appointment = null
private

Definition at line 39 of file class.ilCalendarMailNotification.php.

Referenced by getAppointment().

◆ $appointment_id

int ilCalendarMailNotification::$appointment_id = null
private

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

Referenced by getAppointmentId().

◆ $lng

ilLanguage ilCalendarMailNotification::$lng
protected

Definition at line 41 of file class.ilCalendarMailNotification.php.

◆ $rbacreview

ilRbacReview ilCalendarMailNotification::$rbacreview
protected

Definition at line 42 of file class.ilCalendarMailNotification.php.

◆ TYPE_BOOKING_CANCELLATION

const ilCalendarMailNotification::TYPE_BOOKING_CANCELLATION = 6

Definition at line 33 of file class.ilCalendarMailNotification.php.

Referenced by ilBookingEntry\cancelBooking(), and send().

◆ TYPE_BOOKING_CONFIRMATION

const ilCalendarMailNotification::TYPE_BOOKING_CONFIRMATION = 5

Definition at line 32 of file class.ilCalendarMailNotification.php.

Referenced by ilBookingEntry\book(), and send().

◆ TYPE_BOOKING_REMINDER

const ilCalendarMailNotification::TYPE_BOOKING_REMINDER = 9

Definition at line 36 of file class.ilCalendarMailNotification.php.

Referenced by ilConsultationHourCron\run(), and send().

◆ TYPE_CRS_NEW_NOTIFICATION

const ilCalendarMailNotification::TYPE_CRS_NEW_NOTIFICATION = 4

◆ TYPE_CRS_NOTIFICATION

const ilCalendarMailNotification::TYPE_CRS_NOTIFICATION = 3

◆ TYPE_GRP_NEW_NOTIFICATION

const ilCalendarMailNotification::TYPE_GRP_NEW_NOTIFICATION = 2

◆ TYPE_GRP_NOTIFICATION

const ilCalendarMailNotification::TYPE_GRP_NOTIFICATION = 1

◆ TYPE_USER

const ilCalendarMailNotification::TYPE_USER = 7

◆ TYPE_USER_ANONYMOUS

const ilCalendarMailNotification::TYPE_USER_ANONYMOUS = 8

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