ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCalendarMailNotification Class Reference

Distributes calendar mail notifications. More...

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

Public Member Functions

 __construct ()
 Constructor.
 setAppointmentId ($a_id)
 Set calendar appointment id.
 getAppointment ()
 Get appointment.
 getAppointmentId ()
 get appointment id
 appendAppointmentDetails ()
 send ()
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 Constructor.
 setType ($a_type)
 Set notification type.
 getType ()
 Get notification type.
 setSender ($a_usr_id)
 Set sender of mail.
 getSender ()
 get sender of mail
 setRecipients ($a_rcp)
 set mail recipients
 getRecipients ()
 get array of recipients
 setAttachments ($a_att)
 Set attachments.
 getAttachments ()
 Get attachments.
 setLangModules (array $a_modules)
 Set lang modules.
 getUserLanguage ($a_usr_id)
 Get user language.
 setRefId ($a_id)
 Set ref id.
 getRefId ()
 get reference id
 getObjId ()
 get object id
 setObjId ($a_obj_id)
 set obj id
 getObjType ()
 Get object type.
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails.
 getAdditionalInformation ()
 Get additional information for generating notification mails.
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail.
 getBlockBorder ()
 Get (ascii) block border.

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.
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 Set mail subject.
 getSubject ()
 Get mail subject.
 setBody ($a_body)
 Set mail body.
 appendBody ($a_body)
 Append body text.
 getBody ()
 Get body.
 initLanguage ($a_usr_id)
 Init language.
 initLanguageByIso2Code ($a_code= '')
 Init language by ISO2 code.
 setLanguage ($a_language)
 A language.
 getLanguage ()
 get language object
 getLanguageText ($a_keyword)
 Replace new lines.
 getObjectTitle ($a_shorten=false)
 Get object title.
 initMail ()
 Init mail.
 getMail ()
 Get mail object.
 createPermanentLink ($a_params=array(), $a_append= '')
 Create a permanent link for an object.
 userToString ($a_usr_id)
 Utility function.
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user.

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

ilCalendarMailNotification::__construct ( )

Constructor.

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

References ilMailNotification\setSender().

{
$this->setSender(ANONYMOUS_USER_ID);
}

+ Here is the call graph for this function:

Member Function Documentation

ilCalendarMailNotification::addAttachment ( )
protected

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

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

Referenced by send().

{
global $ilUser;
include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php';
$export = new ilCalendarExport();
$export->setExportType(ilCalendarExport::EXPORT_APPOINTMENTS);
$export->setAppointments(array($this->getAppointmentId()));
$export->export();
include_once './Services/Mail/classes/class.ilFileDataMail.php';
$attachment = new ilFileDataMail($this->getSender());
$attachment->storeAsAttachment(
'appointment.ics',
$export->getExportString()
);
array(
'appointment.ics'
)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarMailNotification::appendAppointmentDetails ( )

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

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

Referenced by send().

{
include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
$app = new ilCalendarEntry($this->getAppointmentId());
$this->appendBody($app->appointmentToMailString($this->getLanguage()));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarMailNotification::deleteAttachments ( )
protected

Delete attachments.

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

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

Referenced by send().

{
include_once './Services/Mail/classes/class.ilFileDataMail.php';
$attachment = new ilFileDataMail($this->getSender());
$attachment->unlinkFiles($this->getAttachments());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilCalendarMailNotification::getAppointment ( )

Get appointment.

Returns
ilCalendarEntry

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

Referenced by send().

{
return $this->appointment;
}

+ Here is the caller graph for this function:

ilCalendarMailNotification::getAppointmentId ( )

get appointment id

Returns

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

References $appointment_id.

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

{
}

+ Here is the caller graph for this function:

ilCalendarMailNotification::send ( )
Returns

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

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(), and TYPE_BOOKING_REMINDER.

{
global $rbacreview,$lng;
switch($this->getType())
{
case self::TYPE_USER:
$rcp = array_pop($this->getRecipients());
$this->initLanguage($rcp);
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf(
$this->getLanguageText('cal_mail_notification_subject'),
$this->getAppointment()->getTitle()
)
);
$this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
$this->getLanguageText('cal_mail_notification_body')
);
$this->appendBody("\n\n");
$this->appendBody("\n\n");
$this->getMail()->appendInstallationSignature(true);
$this->addAttachment();
$this->sendMail(
$this->getRecipients(),
array('system'),
true
);
break;
case self::TYPE_USER_ANONYMOUS:
$rcp = array_pop($this->getRecipients());
$this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->getLanguage()->loadLanguageModule('mail');
$this->initMail();
$this->setSubject(
sprintf(
$this->getLanguageText('cal_mail_notification_subject'),
$this->getAppointment()->getTitle()
)
);
$this->appendBody("\n\n");
$this->appendBody(
$this->getLanguageText('cal_mail_notification_body')
);
$this->appendBody("\n\n");
$this->appendBody("\n\n");
$this->getMail()->appendInstallationSignature(true);
$this->addAttachment();
$this->sendMail(
$this->getRecipients(),
array('email'),
false
);
break;
case self::TYPE_GRP_NEW_NOTIFICATION:
$this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
$this->getLanguage()->loadLanguageModule('grp');
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_grp_new_notification_sub'),$this->getObjectTitle(true))
);
$this->setBody($this->getLanguageText('grp_notification_salutation'));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_grp_new_notification_body'),$this->getObjectTitle(true))
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->addAttachment();
$this->sendMail(array('#il_grp_admin_'.$this->getRefId(),'#il_grp_member_'.$this->getRefId()),array('system'),false);
break;
case self::TYPE_GRP_NOTIFICATION:
$this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
$this->getLanguage()->loadLanguageModule('grp');
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_grp_notification_sub'),$this->getObjectTitle(true))
);
$this->setBody($this->getLanguageText('grp_notification_salutation'));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_grp_notification_body'),$this->getObjectTitle(true))
);
$this->appendBody("\n\n");
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('grp_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->addAttachment();
$this->sendMail(array('#il_grp_admin_'.$this->getRefId(),'#il_grp_member_'.$this->getRefId()),array('system'),false);
break;
case self::TYPE_CRS_NEW_NOTIFICATION:
$this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
$this->getLanguage()->loadLanguageModule('crs');
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_crs_new_notification_sub'),$this->getObjectTitle(true))
);
$this->setBody($this->getLanguageText('crs_notification_salutation'));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_crs_new_notification_body'),$this->getObjectTitle(true))
);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->addAttachment();
$this->sendMail(array('#il_crs_admin_'.$this->getRefId(),'#il_crs_tutor_'.$this->getRefId(),'#il_crs_member_'.$this->getRefId()),array('system'),false);
break;
case self::TYPE_CRS_NOTIFICATION:
$this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()));
$this->getLanguage()->loadLanguageModule('crs');
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_crs_notification_sub'),$this->getObjectTitle(true))
);
$this->setBody($this->getLanguageText('crs_notification_salutation'));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_crs_notification_body'),$this->getObjectTitle(true))
);
$this->appendBody("\n\n");
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
$this->getMail()->appendInstallationSignature(true);
$this->addAttachment();
$this->sendMail(array('#il_crs_admin_'.$this->getRefId(),'#il_crs_tutor_'.$this->getRefId(),'#il_crs_member_'.$this->getRefId()),array('system'),false);
break;
case self::TYPE_BOOKING_CONFIRMATION:
$user_id = array_pop($this->getRecipients());
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
include_once 'Services/Booking/classes/class.ilBookingEntry.php';
$entry = new ilCalendarEntry($this->getAppointmentId());
$booking = new ilBookingEntry($entry->getContextId());
$this->initLanguage($user_id);
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_booking_confirmation_subject'),$entry->getTitle())
);
$this->setBody(ilMail::getSalutation($user_id,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_booking_confirmation_body'),ilObjUser::_lookupFullname($booking->getObjId()))
);
$this->appendBody("\n\n");
$this->appendAppointmentDetails($booking);
/*
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('cal_booking_confirmation_link'));
$this->appendBody("\n\n");
$this->appendBody($this->createPermanentLink());
*/
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($user_id),array('system'),true);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('cal_booking_confirmation_user')."\n");
$this->sendMail(array($booking->getObjId()),array('system'),true);
break;
case self::TYPE_BOOKING_CANCELLATION:
$user_id = array_pop($this->getRecipients());
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
include_once 'Services/Booking/classes/class.ilBookingEntry.php';
$entry = new ilCalendarEntry($this->getAppointmentId());
$booking = new ilBookingEntry($entry->getContextId());
$user_id = array_pop($this->getRecipients());
$this->initLanguage($user_id);
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_booking_cancellation_subject'),$entry->getTitle())
);
$this->setBody(ilMail::getSalutation($user_id,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_booking_cancellation_body'),ilObjUser::_lookupFullname($booking->getObjId()))
);
$this->appendBody("\n\n");
$this->appendAppointmentDetails($booking);
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($user_id),array('system'),true);
$this->appendBody("\n\n");
$this->appendBody($this->getLanguageText('cal_booking_cancellation_user')."\n");
$this->sendMail(array($booking->getObjId()),array('system'),true);
break;
$user_id = array_pop($this->getRecipients());
include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
include_once 'Services/Booking/classes/class.ilBookingEntry.php';
$entry = new ilCalendarEntry($this->getAppointmentId());
$booking = new ilBookingEntry($entry->getContextId());
$this->initLanguage($user_id);
$this->getLanguage()->loadLanguageModule('dateplaner');
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText('cal_ch_booking_reminder_subject'),$entry->getTitle())
);
$this->setBody(ilMail::getSalutation($user_id,$this->getLanguage()));
$this->appendBody("\n\n");
$this->appendBody(
sprintf($this->getLanguageText('cal_ch_booking_reminder_body'),ilObjUser::_lookupFullname($booking->getObjId()))
);
$this->appendBody("\n\n");
$this->appendAppointmentDetails($booking);
$this->getMail()->appendInstallationSignature(true);
$this->sendMail(array($user_id),array('system'),true);
break;
}
}

+ Here is the call graph for this function:

ilCalendarMailNotification::setAppointmentId (   $a_id)

Set calendar appointment id.

Parameters
object$a_id
Returns

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

References getAppointmentId().

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

+ Here is the call graph for this function:

Field Documentation

ilCalendarMailNotification::$appointment_id = null
private

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

Referenced by getAppointmentId().

const ilCalendarMailNotification::TYPE_BOOKING_CANCELLATION = 6

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

Referenced by ilBookingEntry\cancelBooking().

const ilCalendarMailNotification::TYPE_BOOKING_CONFIRMATION = 5

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

Referenced by ilBookingEntry\book().

const ilCalendarMailNotification::TYPE_BOOKING_REMINDER = 9

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

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

const ilCalendarMailNotification::TYPE_CRS_NEW_NOTIFICATION = 4
const ilCalendarMailNotification::TYPE_CRS_NOTIFICATION = 3
const ilCalendarMailNotification::TYPE_GRP_NEW_NOTIFICATION = 2
const ilCalendarMailNotification::TYPE_GRP_NOTIFICATION = 1
const ilCalendarMailNotification::TYPE_USER = 7
const ilCalendarMailNotification::TYPE_USER_ANONYMOUS = 8

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