ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 387 of file class.ilCalendarMailNotification.php.

388 {
389 global $ilUser;
390
391 include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php';
392 $export = new ilCalendarExport();
393 $export->setExportType(ilCalendarExport::EXPORT_APPOINTMENTS);
394 $export->setAppointments(array($this->getAppointmentId()));
395 $export->export();
396
397 include_once './Services/Mail/classes/class.ilFileDataMail.php';
398 $attachment = new ilFileDataMail($this->getSender());
399 $attachment->storeAsAttachment(
400 'appointment.ics',
401 $export->getExportString()
402 );
403
404 $this->setAttachments(
405 array(
406 'appointment.ics'
407 )
408 );
409 }
@classDescription Export calendar(s) to ical format
This class handles all operations on files (attachments) in directory ilias_data/mail.
getSender()
get sender of mail
setAttachments($a_att)
Set attachments.
$ilUser
Definition: imgupload.php:18

References $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 414 of file class.ilCalendarMailNotification.php.

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

References $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(), sprintf, 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: