ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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)
 
 setBookerID (int $id)
 
 getBookerID ()
 
 getAppointment ()
 
 getAppointmentId ()
 
 appendAppointmentDetails ()
 
 send ()
 
- 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 (MailAttachments $attachments)
 
 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
 
const TYPE_BOOKING_CONFIRMATION_MANAGER = 10
 
- Data Fields inherited from ilMailNotification
final const int SUBJECT_TITLE_LENGTH = 60
 

Protected Member Functions

 addAttachment ()
 
- 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 ()
 
 initFileDataMail ()
 
 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 = ''
 
MailAttachments $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
 

Private Attributes

int $appointment_id = null
 
int $booker_id = 0
 
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 28 of file class.ilCalendarMailNotification.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarMailNotification::__construct ( bool  $a_is_personal_workspace = false)

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

51 {
52 global $DIC;
53
54 parent::__construct($a_is_personal_workspace);
55 $this->lng = $DIC->language();
56 $this->rbacreview = $DIC->rbac()->review();
57 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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 455 of file class.ilCalendarMailNotification.php.

455 : void
456 {
457 $export = new ilCalendarExport();
458 $export->setExportType(ilCalendarExport::EXPORT_APPOINTMENTS);
459 $export->setAppointments([(int) $this->getAppointmentId()]);
460 $export->export();
461
462 $ics_filename = 'appointment_' . (new DateTimeImmutable('now'))->format('Ymd_His_u') . '.ics';
463
464 $attachment = $this->initFileDataMail();
465 $rcid = $attachment->createCollectionFromContent(
466 $ics_filename,
467 $export->getExportString()
468 );
469
470 $this->setAttachments(
471 $rcid !== null
472 ? MailAttachments::fromIrss($rcid)
473 : MailAttachments::empty()
474 );
475 }
@classDescription Export calendar(s) to ical format
setAttachments(MailAttachments $attachments)

References ilCalendarExport\EXPORT_APPOINTMENTS, getAppointmentId(), ilMailNotification\initFileDataMail(), 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 85 of file class.ilCalendarMailNotification.php.

85 : void
86 {
87 $app = new ilCalendarEntry($this->getAppointmentId());
88 $this->appendBody($app->appointmentToMailString($this->getLanguage()));
89 }
Model for a calendar entry.

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

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 75 of file class.ilCalendarMailNotification.php.

References $appointment.

Referenced by send().

+ Here is the caller graph for this function:

◆ getAppointmentId()

ilCalendarMailNotification::getAppointmentId ( )

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

References $appointment_id.

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

+ Here is the caller graph for this function:

◆ getBookerID()

ilCalendarMailNotification::getBookerID ( )

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

References $booker_id.

Referenced by send().

+ Here is the caller graph for this function:

◆ send()

ilCalendarMailNotification::send ( )

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

91 : void
92 {
93 switch ($this->getType()) {
94 case self::TYPE_USER:
95 $rcps = $this->getRecipients();
96 $rcp = array_pop($rcps);
97 $this->initLanguage($rcp);
98 $this->getLanguage()->loadLanguageModule('dateplaner');
99 $this->initMail();
100 $this->setSubject(
101 sprintf(
102 $this->getLanguageText('cal_mail_notification_subject'),
103 $this->getAppointment()->getTitle()
104 )
105 );
106 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
107 $this->appendBody("\n\n");
108 $this->appendBody(
109 $this->getLanguageText('cal_mail_notification_body')
110 );
111 $this->appendBody("\n\n");
113 $this->appendBody("\n\n");
114 $this->getMail()->appendInstallationSignature(true);
115 $this->addAttachment();
116
117 $this->sendMail(
118 $this->getRecipients(),
119 true
120 );
121 break;
122
124
125 $rcps = $this->getRecipients();
126 $rcp = array_pop($rcps);
127
128 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
129 $this->getLanguage()->loadLanguageModule('dateplaner');
130 $this->getLanguage()->loadLanguageModule('mail');
131 $this->initMail();
132 $this->setSubject(
133 sprintf(
134 $this->getLanguageText('cal_mail_notification_subject'),
135 $this->getAppointment()->getTitle()
136 )
137 );
138 $this->setBody(ilMail::getSalutation(0, $this->getLanguage()));
139 $this->appendBody("\n\n");
140 $this->appendBody(
141 $this->getLanguageText('cal_mail_notification_body')
142 );
143 $this->appendBody("\n\n");
145 $this->appendBody("\n\n");
146 $this->getMail()->appendInstallationSignature(true);
147 $this->addAttachment();
148
149 $this->sendMail(
150 $this->getRecipients(),
151 false
152 );
153 break;
154
156
157 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
158 $this->getLanguage()->loadLanguageModule('grp');
159 $this->getLanguage()->loadLanguageModule('dateplaner');
160 $this->initMail();
161 $this->setSubject(
162 sprintf($this->getLanguageText('cal_grp_new_notification_sub'), $this->getObjectTitle(true))
163 );
164 $this->setBody($this->getLanguageText('grp_notification_salutation'));
165 $this->appendBody("\n\n");
166 $this->appendBody(
167 sprintf($this->getLanguageText('cal_grp_new_notification_body'), $this->getObjectTitle(true))
168 );
169 $this->appendBody("\n\n");
170 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
171 $this->appendBody("\n\n");
172
174
175 $this->appendBody("\n\n");
176 $this->appendBody($this->createPermanentLink());
177 $this->getMail()->appendInstallationSignature(true);
178
179 $this->addAttachment();
180
181 $this->sendMail(
182 array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()),
183 false
184 );
185 break;
186
188
189 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
190 $this->getLanguage()->loadLanguageModule('grp');
191 $this->getLanguage()->loadLanguageModule('dateplaner');
192 $this->initMail();
193 $this->setSubject(
194 sprintf($this->getLanguageText('cal_grp_notification_sub'), $this->getObjectTitle(true))
195 );
196 $this->setBody($this->getLanguageText('grp_notification_salutation'));
197 $this->appendBody("\n\n");
198 $this->appendBody(
199 sprintf($this->getLanguageText('cal_grp_notification_body'), $this->getObjectTitle(true))
200 );
201 $this->appendBody("\n\n");
202
204
205 $this->appendBody("\n\n");
206 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
207 $this->appendBody("\n\n");
208 $this->appendBody($this->createPermanentLink());
209 $this->getMail()->appendInstallationSignature(true);
210
211 $this->addAttachment();
212
213 $this->sendMail(
214 array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()),
215 false
216 );
217 break;
218
220
221 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
222 $this->getLanguage()->loadLanguageModule('crs');
223 $this->getLanguage()->loadLanguageModule('dateplaner');
224 $this->initMail();
225 $this->setSubject(
226 sprintf($this->getLanguageText('cal_crs_new_notification_sub'), $this->getObjectTitle(true))
227 );
228 $this->setBody($this->getLanguageText('crs_notification_salutation'));
229 $this->appendBody("\n\n");
230 $this->appendBody(
231 sprintf($this->getLanguageText('cal_crs_new_notification_body'), $this->getObjectTitle(true))
232 );
233 $this->appendBody("\n\n");
234 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
235 $this->appendBody("\n\n");
236 $this->appendBody($this->createPermanentLink());
237 $this->appendBody("\n\n");
239
240 $this->getMail()->appendInstallationSignature(true);
241
242 $this->addAttachment();
243
244 $this->sendMail(array('#il_crs_admin_' . $this->getRefId(),
245 '#il_crs_tutor_' . $this->getRefId(),
246 '#il_crs_member_' . $this->getRefId()
247 ), false);
248 break;
249
251
252 $this->setLanguage(ilLanguageFactory::_getLanguage($this->lng->getDefaultLanguage()));
253 $this->getLanguage()->loadLanguageModule('crs');
254 $this->getLanguage()->loadLanguageModule('dateplaner');
255 $this->initMail();
256 $this->setSubject(
257 sprintf($this->getLanguageText('cal_crs_notification_sub'), $this->getObjectTitle(true))
258 );
259 $this->setBody($this->getLanguageText('crs_notification_salutation'));
260 $this->appendBody("\n\n");
261 $this->appendBody(
262 sprintf($this->getLanguageText('cal_crs_notification_body'), $this->getObjectTitle(true))
263 );
264 $this->appendBody("\n\n");
265
267
268 $this->appendBody("\n\n");
269 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
270 $this->appendBody("\n\n");
271 $this->appendBody($this->createPermanentLink());
272 $this->getMail()->appendInstallationSignature(true);
273
274 $this->addAttachment();
275
276 $this->sendMail(array('#il_crs_admin_' . $this->getRefId(),
277 '#il_crs_tutor_' . $this->getRefId(),
278 '#il_crs_member_' . $this->getRefId()
279 ), false);
280 break;
281
283
284 $rcps = $this->getRecipients();
285 $user_id = array_pop($rcps);
286 $entry = new ilCalendarEntry($this->getAppointmentId());
287 $booking = new ilBookingEntry($entry->getContextId());
288
289 $this->initLanguage($user_id);
290 $this->getLanguage()->loadLanguageModule('dateplaner');
291 $this->initMail();
292 $this->setSubject(
293 sprintf($this->getLanguageText('cal_booking_confirmation_subject'), $entry->getTitle())
294 );
296 $this->appendBody("\n\n");
297 $this->appendBody(
298 sprintf(
299 $this->getLanguageText('cal_booking_confirmation_body'),
300 ilObjUser::_lookupFullname($booking->getObjId())
301 )
302 );
303 $this->appendBody("\n\n");
305
307 if ($comment !== '') {
308 $this->appendBody("\n\n");
309 $this->appendBody(
310 $this->getLanguageText('cal_ch_booking_your_comment') . ' "' .
312 . '"'
313 );
314 $this->appendBody("\n\n");
315 }
316 $this->getMail()->appendInstallationSignature(true);
317 $this->sendMail(array($user_id), true);
318 break;
319
321
322 $rcps = $this->getRecipients();
323 $user_id = array_pop($rcps);
324 $entry = new ilCalendarEntry($this->getAppointmentId());
325 $booking = new ilBookingEntry($entry->getContextId());
326
327 $this->initLanguage($user_id);
328 $this->getLanguage()->loadLanguageModule('dateplaner');
329 $this->initMail();
330 $this->setSubject(
331 sprintf($this->getLanguageText('cal_booking_confirmation_subject'), $entry->getTitle())
332 );
334 $this->appendBody("\n\n");
335 if ($user_id == $booking->getObjId()) {
336 $message = sprintf(
337 $this->getLanguageText('cal_booking_owner_confirmation_body'),
339 );
340 } else {
341 $message = sprintf(
342 $this->getLanguageText('cal_booking_manager_confirmation_body'),
344 ilObjUser::_lookupFullname($booking->getObjId())
345 );
346 }
347 $this->appendBody($message);
348 $this->appendBody("\n\n");
350
351 $comment = ilBookingEntry::lookupBookingMessage($entry->getEntryId(), $this->getBookerID());
352 if ($comment !== '') {
353 $this->appendBody("\n\n");
354 $this->appendBody(
355 $this->getLanguageText('cal_ch_booking_comment') . ' "' .
357 . '"'
358 );
359 $this->appendBody("\n\n");
360 }
361
362 $participants = [];
363 foreach ($booking->getCurrentBookings($entry->getEntryId()) as $bookusers) {
364 if ($bookusers === $this->getBookerID()) {
365 continue;
366 }
367 $participants[] = ilObjUser::_lookupFullname($bookusers);
368 }
369 if ($participants !== []) {
370 $this->appendBody(
371 $this->getLanguageText('cal_ch_booking_other_participants') . ' ' .
372 implode(', ', $participants)
373 );
374 }
375
376 $static_url = new \ILIAS\Calendar\URL\CalendarStaticURLHandler();
377 $uri = $static_url->buildConsultationHoursURI();
378 $this->appendBody("\n\n");
379 $this->appendBody(
380 $this->getLanguageText('cal_ch_booking_link') . ' ' . $uri
381 );
382
383 $this->getMail()->appendInstallationSignature(true);
384 $this->sendMail(array($user_id), true);
385 break;
386
388
389 $rcps = $this->getRecipients();
390 $user_id = array_pop($rcps);
391 $entry = new ilCalendarEntry($this->getAppointmentId());
392 $booking = new ilBookingEntry($entry->getContextId());
393
394 $rcps = $this->getRecipients();
395 $user_id = array_pop($rcps);
396 $this->initLanguage($user_id);
397 $this->getLanguage()->loadLanguageModule('dateplaner');
398 $this->initMail();
399 $this->setSubject(
400 sprintf($this->getLanguageText('cal_booking_cancellation_subject'), $entry->getTitle())
401 );
403 $this->appendBody("\n\n");
404 $this->appendBody(
405 sprintf(
406 $this->getLanguageText('cal_booking_cancellation_body'),
407 ilObjUser::_lookupFullname($booking->getObjId())
408 )
409 );
410 $this->appendBody("\n\n");
411
413
414 $this->getMail()->appendInstallationSignature(true);
415
416 $this->sendMail(array($user_id), true);
417
418 $this->appendBody("\n\n");
419 $this->appendBody($this->getLanguageText('cal_booking_cancellation_user') . "\n");
421
422 $this->sendMail(array($booking->getObjId()), true);
423 break;
424
426
427 $rcps = $this->getRecipients();
428 $user_id = array_pop($rcps);
429
430 $entry = new ilCalendarEntry($this->getAppointmentId());
431 $booking = new ilBookingEntry($entry->getContextId());
432
433 $this->initLanguage($user_id);
434 $this->getLanguage()->loadLanguageModule('dateplaner');
435 $this->initMail();
436 $this->setSubject(
437 sprintf($this->getLanguageText('cal_ch_booking_reminder_subject'), $entry->getTitle())
438 );
440 $this->appendBody("\n\n");
441 $this->appendBody(
442 sprintf(
443 $this->getLanguageText('cal_ch_booking_reminder_body'),
444 ilObjUser::_lookupFullname($booking->getObjId())
445 )
446 );
447 $this->appendBody("\n\n");
449 $this->getMail()->appendInstallationSignature(true);
450 $this->sendMail(array($user_id), true);
451 break;
452 }
453 }
$comment
Definition: buildRTE.php:72
Booking definition.
static lookupBookingMessage(int $a_entry_id, int $a_usr_id)
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)
$static_url
Definition: goto.php:29

References $comment, $message, $static_url, $user_id, ilLanguageFactory\_getLanguage(), ilObjUser\_lookupFullname(), addAttachment(), appendAppointmentDetails(), ilMailNotification\appendBody(), ilMailNotification\createPermanentLink(), getAppointment(), getAppointmentId(), getBookerID(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilMailNotification\getObjectTitle(), ilMailNotification\getRecipients(), ilMailNotification\getRefId(), ilMail\getSalutation(), ILIAS\GlobalScreen\Scope\Footer\Factory\getTitle(), ilMailNotification\getType(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ILIAS\Repository\lng(), ilBookingEntry\lookupBookingMessage(), ilMailNotification\sendMail(), ilMailNotification\setBody(), ilMailNotification\setLanguage(), ilMailNotification\setSubject(), TYPE_BOOKING_CANCELLATION, TYPE_BOOKING_CONFIRMATION, TYPE_BOOKING_CONFIRMATION_MANAGER, 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 59 of file class.ilCalendarMailNotification.php.

59 : void
60 {
61 $this->appointment_id = $a_id;
62 $this->appointment = new ilCalendarEntry($this->getAppointmentId());
63 }

References getAppointmentId().

+ Here is the call graph for this function:

◆ setBookerID()

ilCalendarMailNotification::setBookerID ( int  $id)

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

65 : void
66 {
67 $this->booker_id = $id;
68 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id.

Field Documentation

◆ $appointment

ilCalendarEntry ilCalendarMailNotification::$appointment = null
private

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

Referenced by getAppointment().

◆ $appointment_id

int ilCalendarMailNotification::$appointment_id = null
private

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

Referenced by getAppointmentId().

◆ $booker_id

int ilCalendarMailNotification::$booker_id = 0
private

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

Referenced by getBookerID().

◆ $lng

ilLanguage ilCalendarMailNotification::$lng
protected

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

◆ $rbacreview

ilRbacReview ilCalendarMailNotification::$rbacreview
protected

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

◆ TYPE_BOOKING_CANCELLATION

const ilCalendarMailNotification::TYPE_BOOKING_CANCELLATION = 6

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

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

◆ TYPE_BOOKING_CONFIRMATION

const ilCalendarMailNotification::TYPE_BOOKING_CONFIRMATION = 5

◆ TYPE_BOOKING_CONFIRMATION_MANAGER

const ilCalendarMailNotification::TYPE_BOOKING_CONFIRMATION_MANAGER = 10

◆ TYPE_BOOKING_REMINDER

const ilCalendarMailNotification::TYPE_BOOKING_REMINDER = 9

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