/** * Handle Request * @return */ public function handleRequest() { $this->initIlias(); $this->initTokenHandler(); if ($this->getTokenHandler()->getIcal() and !$this->getTokenHandler()->isIcalExpired()) { ilUtil::deliverData($this->getTokenHandler(), 'calendar.ics', 'text/calendar', 'utf-8'); } include_once './Services/Calendar/classes/Export/class.ilCalendarExport.php'; include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; if ($this->getTokenHandler()->getSelectionType() == ilCalendarAuthenticationToken::SELECTION_CALENDAR) { #$export = new ilCalendarExport(array($this->getTokenHandler()->getCalendar())); $cats = ilCalendarCategories::_getInstance(); $cats->initialize(ilCalendarCategories::MODE_REMOTE_SELECTED, $this->getTokenHandler()->getCalendar()); $export = new ilCalendarExport($cats->getCategories(true)); } else { $cats = ilCalendarCategories::_getInstance(); $cats->initialize(ilCalendarCategories::MODE_REMOTE_ACCESS); $export = new ilCalendarExport($cats->getCategories(true)); } $export->export(); $this->getTokenHandler()->setIcal($export->getExportString()); $this->getTokenHandler()->storeIcal(); $GLOBALS['ilAuth']->logout(); ilUtil::deliverData($export->getExportString(), 'calendar.ics', 'text/calendar', 'utf-8'); #echo $export->getExportString(); #echo nl2br($export->getExportString()); #$fp = fopen('ilias.ics', 'w'); #fwrite($fp,$export->getExportString()); exit; }
protected function addAttachment() { 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()); $this->setAttachments(array('appointment.ics')); }