unset($learning_events["events"][$key]); } } } } switch ($calendar_type) { case "ics": add_statistic("calendar.api", "view", "type", "ics"); require_once "Entrada/icalendar/class.ical.inc.php"; $ical = new iCal("-//" . html_encode($_SERVER["HTTP_HOST"]) . "//iCal " . APPLICATION_NAME . " Calendar MIMEDIR//EN", 1, ENTRADA_ABSOLUTE . "/calendars/", $user_username); if (!empty($learning_events["events"])) { foreach ($learning_events["events"] as $event) { $ical->addEvent(array(), (int) $event["event_start"], (int) $event["event_finish"], $event["event_location"] ? $event["event_location"] : "To Be Announced", 1, array(), strip_tags($event["event_message"]), strip_tags($event["event_title"]), 1, array(), 5, 0, 0, 0, array(), 1, "", 0, 1, str_replace("http://", "https://", ENTRADA_URL) . "/events?id=" . (int) $event["event_id"], "en", md5((int) $event["event_id"])); } } $ical->outputFile(); break; case "json": default: $events = array(); if (!empty($learning_events["events"])) { foreach ($learning_events["events"] as $drid => $event) { $cal_type = 1; $cal_updated = ""; if ($event["audience_type"] == "proxy_id") { $cal_type = 3; } if ((int) $event["last_visited"] && (int) $event["last_visited"] < (int) $event["updated_date"]) { $cal_type = 2; $cal_updated = date(DEFAULT_DATE_FORMAT, $event["updated_date"]); }
break; case 3: $ical_priority = 5; // medium break; case 4: $ical_priority = 3; // high break; case 5: $ical_priority = 1; // very high break; default: $ical_priority = 0; // none } $iCal->addEvent($organizer, $start_time, $end_time, $location, 0, $categorie, $description, $title, 0, $attendees, $ical_priority, 0, 1, 0, '', 0, '', '', 0, $task_url, $langDefault, ''); } } // output the ics file $iCal->outputFile('ics'); //---------------------- //--- functions -------- //---------------------- function authenticate() { header('WWW-Authenticate: Basic realm="My NetOffice iCalendar"'); header('HTTP/1.0 401 Unauthorized'); die('Invalid Credentials!'); }
$endtime = $endtime + 24 * 3600; } ### for thunderbird 3 and lightning 1.0b1 ### if ($starttime != '-1' and $endtime != '-1') { $iCal->addEvent($organizer, $starttime, $endtime, $item->getPlace(), 1, $categories, html_entity_decode(strip_tags($item->getDescription()), ENT_NOQUOTES, 'UTF-8'), $title, 1, $attendee_array, 5, 0, 0, 0, array(), 1, '', $alarm, 1, $path . $c_single_entry_point . '?cid=' . $_GET['cid'] . '&mod=date&fct=detail&iid=' . $item->getItemID(), $language, $item->getItemID()); } } $item = $item_list->getNext(); } if ($current_module == CS_DATE_TYPE) { $dateiname = $translator->getMessage('DATES_EXPORT_FILENAME') . '_' . $_GET['cid']; } elseif ($current_module == CS_TODO_TYPE) { $dateiname = $translator->getMessage('TODO_EXPORT_FILENAME') . '_' . $_GET['cid']; } #echo $iCal->getOutput(); $iCal->outputFile($dateiname); # logging include_once 'include/inc_log.php'; } else { include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php'; include_once 'classes/cs_environment.php'; $environment = new cs_environment(); $environment->setCurrentContextID($_GET['cid']); $translator = $environment->getTranslationObject(); die($translator->getMessage('RSS_NOT_ALLOWED')); } } else { chdir('..'); include_once 'etc/cs_constants.php'; include_once 'etc/cs_config.php';