19 declare(strict_types=1);
    53     public function __construct(array $a_calendar_ids = [], 
bool $is_export_limited = 
false)
    56         $this->il_user = $DIC->user();
    57         $this->
logger = $DIC->logger()->cal();
    58         $this->calendars = $a_calendar_ids;
    60         $this->appointments = [];
    75         $this->appointments = $a_apps;
    91         $this->calendars = $a_cal_ids;
   104         $this->export_type = $a_type;
   113         $this->str_writer_export->clear();
   115         $str_writer_prefix->addLine(
'BEGIN:VCALENDAR');
   116         $str_writer_prefix->addLine(
'VERSION:2.0');
   117         $str_writer_prefix->addLine(
'METHOD:PUBLISH');
   118         $str_writer_prefix->addLine(
'PRODID:-//ilias.de/NONSGML ILIAS Calendar V4.4//EN');
   121         $str_writer_suffix->addLine(
'END:VCALENDAR');
   122         $this->str_writer_export->append($str_writer_prefix);
   124             case self::EXPORT_CALENDARS:
   125                 $byte_sum = $str_writer_prefix->byteCount() + $str_writer_suffix->byteCount();
   126                 $remaining_bytes = self::BYTE_LIMIT - $byte_sum;
   128                 $this->str_writer_export->append($str_builder_body);
   131             case self::EXPORT_APPOINTMENTS:
   133                 $this->str_writer_export->append($str_builder_body);
   136         $this->str_writer_export->append($str_writer_suffix);
   146         $str_writer->addLine(
'X-WR-TIMEZONE:' . $this->il_user->getTimeZone());
   148         if (!is_file($tzid_file)) {
   151         $reader = fopen($tzid_file, 
'r');
   152         while ($line = fgets($reader)) {
   153             $line = str_replace(
"\n", 
'', $line);
   154             $str_writer->addLine($line);
   161         $single_appointments = [];
   164         foreach ($this->calendars as $category_id) {
   169                     $str_writer_appointments->append($str_writer_appointment);
   172                 $single_appointments[] = $appointment;
   184         if ($this->is_export_limited) {
   185             $single_appointments = array_filter($single_appointments, 
function (
ilCalendarEntry $a) {
   189                 if ($str_time_start === null) {
   195                 return $lower_bound <= $start;
   199         foreach ($single_appointments as $appointment) {
   203                 $this->is_export_limited &&
   204                 ($str_writer_appointments->byteCount() + $str_writer_appointment->byteCount()) > $remaining_bytes
   208             $str_writer_appointments->append($str_writer_appointment);
   211         return $str_writer_appointments;
   224             $str_builder_appointments->append($str_writer_appointment);
   226         return $str_builder_appointments;
   243             $this->
logger->notice(
'Cannot create appointment for app_id: ' . $app->
getEntryId());
   247         if (!strlen((
string) $test_date)) {
   252         $str_writer->addLine(
'BEGIN:VEVENT');
   253         $str_writer->addLine(
'DTSTAMP:'   260         $str_writer->addLine(
'LAST-MODIFIED:' . $last_mod);
   263         $endInit = $app->
getEnd();
   270             $start = $startInit->get(
IL_CAL_FKT_DATE, 
'Ymd', $this->il_user->getTimeZone());
   271             $end = $endInit->get(
IL_CAL_FKT_DATE, 
'Ymd', $this->il_user->getTimeZone());
   272             $str_writer->addLine(
'DTSTART;VALUE=DATE:' . $start);
   273             $str_writer->addLine(
'DTEND;VALUE=DATE:' . $end);
   278                 $str_writer->addLine(
'DTSTART:' . $start);
   279                 $str_writer->addLine(
'DTEND:' . $end);
   281                 $start = $startInit->get(
IL_CAL_FKT_DATE, 
'Ymd\THis', $this->il_user->getTimeZone());
   282                 $end = $endInit->get(
IL_CAL_FKT_DATE, 
'Ymd\THis', $this->il_user->getTimeZone());
   283                 $str_writer->addLine(
'DTSTART;TZID=' . $this->il_user->getTimezone() . 
':' . $start);
   284                 $str_writer->addLine(
'DTEND;TZID=' . $this->il_user->getTimezone() . 
':' . $end);
   300         $str_writer->addLine(
'END:VEVENT');
   307         include_once 
'./Services/Calendar/classes/class.ilCalendarRecurrences.php';
   310                 $str_writer->addLine($excl->toICal());
   312             $recurrence_ical = $rec->toICal($this->il_user->getId());
   313             if (strlen($recurrence_ical)) {
   314                 $str_writer->addLine($recurrence_ical);
   322         return $this->str_writer_export->__toString();
   332             $str_writer->addLine(
'URL;VALUE=URI:' . ILIAS_HTTP_PATH);
   335             $str_writer->addLine(
'URL;VALUE=URI:' . ilLink::_getLink(current($refs)));
 
ilCalendarUserSettings $user_settings
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static escapeText(string $a_text)
 
const EXPORT_APPOINTMENTS
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
static getZoneInfoFile($a_tz)
 
static _getRecurrences(int $a_cal_id)
get all recurrences of an appointment 
 
static _getInstanceByUserId(int $a_user_id)
 
getPresentationTitle(bool $a_shorten=true)
 
createAppointment(ilCalendarEntry $appointment)
 
getEnd()
Get end of period. 
 
createRecurrences(ilCalendarEntry $app)
 
buildAppointmentUrl(ilCalendarEntry $entry)
 
isFullday()
is event a fullday period 
 
static _lookupCategories(int $a_cal_id)
 
Export calendar(s) to ical format 
 
setExportType(int $a_type)
 
addCategories(int $remaining_bytes)
 
createVEVENT(ilCalendarEntry $app)
 
createVTODO(ilCalendarEntry $app)
 
ilICalWriter $str_writer_export
 
getStart()
Get start of date period. 
 
static getExclusionDates($a_cal_id)
Read exclusion dates. 
 
static getInstanceByCategoryId(int $a_cat_id)
 
static _getAssignedAppointments(array $a_cat_id)
Get assigned apointments. 
 
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples 
 
isRepeatingAppointment(ilCalendarEntry $appointment)
 
__construct(array $a_calendar_ids=[], bool $is_export_limited=false)
 
setAppointments(array $a_apps)
 
setCalendarIds(array $a_cal_ids)