ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarMailNotification Class Reference

Distributes calendar mail notifications. More...

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

Public Member Functions

 __construct ()
 Constructor. More...
 
 setAppointmentId ($a_id)
 Set calendar appointment id. More...
 
 getAppointment ()
 Get appointment. More...
 
 getAppointmentId ()
 get appointment id More...
 
 appendAppointmentDetails ()
 
 send ()
 
- 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_type, $a_parse_recipients=true)
 
 getBlockBorder ()
 Get (ascii) block border. More...
 

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 ()
 Delete attachments. 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...
 

Private Attributes

 $appointment_id = null
 

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

Distributes calendar mail notifications.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarMailNotification::__construct ( )

Constructor.

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

52 {
53 $this->setSender(ANONYMOUS_USER_ID);
54 }
setSender($a_usr_id)
Set sender of mail.

References ilMailNotification\setSender().

+ Here is the call graph for this function:

Member Function Documentation

◆ addAttachment()

ilCalendarMailNotification::addAttachment ( )
protected

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

391 {
392 global $DIC;
393
394 $ilUser = $DIC['ilUser'];
395
396 include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php';
397 $export = new ilCalendarExport();
398 $export->setExportType(ilCalendarExport::EXPORT_APPOINTMENTS);
399 $export->setAppointments(array($this->getAppointmentId()));
400 $export->export();
401
402 include_once './Services/Mail/classes/class.ilFileDataMail.php';
403 $attachment = new ilFileDataMail($this->getSender());
404 $attachment->storeAsAttachment(
405 'appointment.ics',
406 $export->getExportString()
407 );
408
409 $this->setAttachments(
410 array(
411 'appointment.ics'
412 )
413 );
414 }
@classDescription Export calendar(s) to ical format
Class ilFileDataMail.
getSender()
get sender of mail
setAttachments($a_att)
Set attachments.
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18

References $DIC, $ilUser, 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 87 of file class.ilCalendarMailNotification.php.

88 {
89 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
90 $app = new ilCalendarEntry($this->getAppointmentId());
91 $this->appendBody($app->appointmentToMailString($this->getLanguage()));
92 }
Model for a calendar entry.
appendBody($a_body)
Append body text.

References 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

Delete attachments.

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

420 {
421 include_once './Services/Mail/classes/class.ilFileDataMail.php';
422 $attachment = new ilFileDataMail($this->getSender());
423 $attachment->unlinkFiles($this->getAttachments());
424 }
getAttachments()
Get attachments.

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

Get appointment.

Returns
ilCalendarEntry

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

74 {
75 return $this->appointment;
76 }

Referenced by send().

+ Here is the caller graph for this function:

◆ getAppointmentId()

ilCalendarMailNotification::getAppointmentId ( )

get appointment id

Returns

Definition at line 82 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 ( )
Returns

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

100 {
101 global $DIC;
102
103 $rbacreview = $DIC['rbacreview'];
104 $lng = $DIC['lng'];
105
106 switch ($this->getType()) {
107 case self::TYPE_USER:
108 $rcp = array_pop($this->getRecipients());
109 $this->initLanguage($rcp);
110 $this->getLanguage()->loadLanguageModule('dateplaner');
111 $this->initMail();
112 $this->setSubject(
113 sprintf(
114 $this->getLanguageText('cal_mail_notification_subject'),
115 $this->getAppointment()->getTitle()
116 )
117 );
118 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
119 $this->appendBody("\n\n");
120 $this->appendBody(
121 $this->getLanguageText('cal_mail_notification_body')
122 );
123 $this->appendBody("\n\n");
125 $this->appendBody("\n\n");
126 $this->getMail()->appendInstallationSignature(true);
127 $this->addAttachment();
128
129 $this->sendMail(
130 $this->getRecipients(),
131 array('system'),
132 true
133 );
134 break;
135
137
138 $rcp = array_pop($this->getRecipients());
139
140 $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
141 $this->getLanguage()->loadLanguageModule('dateplaner');
142 $this->getLanguage()->loadLanguageModule('mail');
143 $this->initMail();
144 $this->setSubject(
145 sprintf(
146 $this->getLanguageText('cal_mail_notification_subject'),
147 $this->getAppointment()->getTitle()
148 )
149 );
150 $this->setBody(ilMail::getSalutation(0, $this->getLanguage()));
151 $this->appendBody("\n\n");
152 $this->appendBody(
153 $this->getLanguageText('cal_mail_notification_body')
154 );
155 $this->appendBody("\n\n");
157 $this->appendBody("\n\n");
158 $this->getMail()->appendInstallationSignature(true);
159 $this->addAttachment();
160
161 $this->sendMail(
162 $this->getRecipients(),
163 array('email'),
164 false
165 );
166 break;
167
169
170 $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
171 $this->getLanguage()->loadLanguageModule('grp');
172 $this->getLanguage()->loadLanguageModule('dateplaner');
173 $this->initMail();
174 $this->setSubject(
175 sprintf($this->getLanguageText('cal_grp_new_notification_sub'), $this->getObjectTitle(true))
176 );
177 $this->setBody($this->getLanguageText('grp_notification_salutation'));
178 $this->appendBody("\n\n");
179 $this->appendBody(
180 sprintf($this->getLanguageText('cal_grp_new_notification_body'), $this->getObjectTitle(true))
181 );
182 $this->appendBody("\n\n");
183 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
184 $this->appendBody("\n\n");
185
187
188 $this->appendBody("\n\n");
189 $this->appendBody($this->createPermanentLink());
190 $this->getMail()->appendInstallationSignature(true);
191
192 $this->addAttachment();
193
194 $this->sendMail(array('#il_grp_admin_' . $this->getRefId(),'#il_grp_member_' . $this->getRefId()), array('system'), false);
195 break;
196
198
199 $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
200 $this->getLanguage()->loadLanguageModule('grp');
201 $this->getLanguage()->loadLanguageModule('dateplaner');
202 $this->initMail();
203 $this->setSubject(
204 sprintf($this->getLanguageText('cal_grp_notification_sub'), $this->getObjectTitle(true))
205 );
206 $this->setBody($this->getLanguageText('grp_notification_salutation'));
207 $this->appendBody("\n\n");
208 $this->appendBody(
209 sprintf($this->getLanguageText('cal_grp_notification_body'), $this->getObjectTitle(true))
210 );
211 $this->appendBody("\n\n");
212
214
215 $this->appendBody("\n\n");
216 $this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
217 $this->appendBody("\n\n");
218 $this->appendBody($this->createPermanentLink());
219 $this->getMail()->appendInstallationSignature(true);
220
221 $this->addAttachment();
222
223 $this->sendMail(array('#il_grp_admin_' . $this->getRefId(),'#il_grp_member_' . $this->getRefId()), array('system'), false);
224 break;
225
227
228 $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
229 $this->getLanguage()->loadLanguageModule('crs');
230 $this->getLanguage()->loadLanguageModule('dateplaner');
231 $this->initMail();
232 $this->setSubject(
233 sprintf($this->getLanguageText('cal_crs_new_notification_sub'), $this->getObjectTitle(true))
234 );
235 $this->setBody($this->getLanguageText('crs_notification_salutation'));
236 $this->appendBody("\n\n");
237 $this->appendBody(
238 sprintf($this->getLanguageText('cal_crs_new_notification_body'), $this->getObjectTitle(true))
239 );
240 $this->appendBody("\n\n");
241 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
242 $this->appendBody("\n\n");
243 $this->appendBody($this->createPermanentLink());
244 $this->appendBody("\n\n");
246
247 $this->getMail()->appendInstallationSignature(true);
248
249 $this->addAttachment();
250
251 $this->sendMail(array('#il_crs_admin_' . $this->getRefId(),'#il_crs_tutor_' . $this->getRefId(),'#il_crs_member_' . $this->getRefId()), array('system'), false);
252 break;
253
255
256 $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
257 $this->getLanguage()->loadLanguageModule('crs');
258 $this->getLanguage()->loadLanguageModule('dateplaner');
259 $this->initMail();
260 $this->setSubject(
261 sprintf($this->getLanguageText('cal_crs_notification_sub'), $this->getObjectTitle(true))
262 );
263 $this->setBody($this->getLanguageText('crs_notification_salutation'));
264 $this->appendBody("\n\n");
265 $this->appendBody(
266 sprintf($this->getLanguageText('cal_crs_notification_body'), $this->getObjectTitle(true))
267 );
268 $this->appendBody("\n\n");
269
271
272 $this->appendBody("\n\n");
273 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
274 $this->appendBody("\n\n");
275 $this->appendBody($this->createPermanentLink());
276 $this->getMail()->appendInstallationSignature(true);
277
278 $this->addAttachment();
279
280 $this->sendMail(array('#il_crs_admin_' . $this->getRefId(),'#il_crs_tutor_' . $this->getRefId(),'#il_crs_member_' . $this->getRefId()), array('system'), false);
281 break;
282
284
285 $user_id = array_pop($this->getRecipients());
286 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
287 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
288 $entry = new ilCalendarEntry($this->getAppointmentId());
289 $booking = new ilBookingEntry($entry->getContextId());
290
291 $this->initLanguage($user_id);
292 $this->getLanguage()->loadLanguageModule('dateplaner');
293 $this->initMail();
294 $this->setSubject(
295 sprintf($this->getLanguageText('cal_booking_confirmation_subject'), $entry->getTitle())
296 );
297 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
298 $this->appendBody("\n\n");
299 $this->appendBody(
300 sprintf($this->getLanguageText('cal_booking_confirmation_body'), ilObjUser::_lookupFullname($booking->getObjId()))
301 );
302 $this->appendBody("\n\n");
303
304 $this->appendAppointmentDetails($booking);
305
306 /*
307 $this->appendBody("\n\n");
308 $this->appendBody($this->getLanguageText('cal_booking_confirmation_link'));
309 $this->appendBody("\n\n");
310 $this->appendBody($this->createPermanentLink());
311 */
312 $this->getMail()->appendInstallationSignature(true);
313
314 $this->sendMail(array($user_id), array('system'), true);
315
316 $this->appendBody("\n\n");
317 $this->appendBody($this->getLanguageText('cal_booking_confirmation_user') . "\n");
318 $this->appendBody(ilObjUser::_lookupFullname($user_id));
319
320 $this->sendMail(array($booking->getObjId()), array('system'), true);
321 break;
322
324
325 $user_id = array_pop($this->getRecipients());
326 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
327 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
328 $entry = new ilCalendarEntry($this->getAppointmentId());
329 $booking = new ilBookingEntry($entry->getContextId());
330
331 $user_id = array_pop($this->getRecipients());
332 $this->initLanguage($user_id);
333 $this->getLanguage()->loadLanguageModule('dateplaner');
334 $this->initMail();
335 $this->setSubject(
336 sprintf($this->getLanguageText('cal_booking_cancellation_subject'), $entry->getTitle())
337 );
338 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
339 $this->appendBody("\n\n");
340 $this->appendBody(
341 sprintf($this->getLanguageText('cal_booking_cancellation_body'), ilObjUser::_lookupFullname($booking->getObjId()))
342 );
343 $this->appendBody("\n\n");
344
345 $this->appendAppointmentDetails($booking);
346
347 $this->getMail()->appendInstallationSignature(true);
348
349 $this->sendMail(array($user_id), array('system'), true);
350
351 $this->appendBody("\n\n");
352 $this->appendBody($this->getLanguageText('cal_booking_cancellation_user') . "\n");
353 $this->appendBody(ilObjUser::_lookupFullname($user_id));
354
355 $this->sendMail(array($booking->getObjId()), array('system'), true);
356 break;
357
359
360 $user_id = array_pop($this->getRecipients());
361
362 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
363 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
364 $entry = new ilCalendarEntry($this->getAppointmentId());
365 $booking = new ilBookingEntry($entry->getContextId());
366
367 $this->initLanguage($user_id);
368 $this->getLanguage()->loadLanguageModule('dateplaner');
369 $this->initMail();
370 $this->setSubject(
371 sprintf($this->getLanguageText('cal_ch_booking_reminder_subject'), $entry->getTitle())
372 );
373 $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
374 $this->appendBody("\n\n");
375 $this->appendBody(
376 sprintf($this->getLanguageText('cal_ch_booking_reminder_body'), ilObjUser::_lookupFullname($booking->getObjId()))
377 );
378 $this->appendBody("\n\n");
379
380 $this->appendAppointmentDetails($booking);
381
382 $this->getMail()->appendInstallationSignature(true);
383 $this->sendMail(array($user_id), array('system'), true);
384 break;
385 }
386
387 $this->deleteAttachments();
388 }
Booking definition.
static _getLanguage($a_lang_key='')
Get langauge object.
sendMail(array $a_rcp, $a_type, $a_parse_recipients=true)
getType()
Get notification type.
initLanguage($a_usr_id)
Init language.
getRecipients()
get array of recipients
getObjectTitle($a_shorten=false)
createPermanentLink($a_params=array(), $a_append='')
static getSalutation($a_usr_id, ilLanguage $a_language=null)
static _lookupFullname($a_user_id)
Lookup Full Name.
$lng

References $DIC, $lng, 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(), 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 (   $a_id)

Set calendar appointment id.

Parameters
object$a_id
Returns

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

62 {
63 $this->appointment_id = $a_id;
64
65 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
66 $this->appointment = new ilCalendarEntry($this->getAppointmentId());
67 }

References getAppointmentId().

+ Here is the call graph for this function:

Field Documentation

◆ $appointment_id

ilCalendarMailNotification::$appointment_id = null
private

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

Referenced by getAppointmentId().

◆ TYPE_BOOKING_CANCELLATION

const ilCalendarMailNotification::TYPE_BOOKING_CANCELLATION = 6

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

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

◆ TYPE_BOOKING_CONFIRMATION

const ilCalendarMailNotification::TYPE_BOOKING_CONFIRMATION = 5

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

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

◆ TYPE_BOOKING_REMINDER

const ilCalendarMailNotification::TYPE_BOOKING_REMINDER = 9

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