nextcloud/apps/calendar/export.php

32 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2011-09-24 00:59:24 +04:00
/**
2012-01-15 03:45:27 +04:00
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
2011-09-24 00:59:24 +04:00
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once ('../../lib/base.php');
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = isset($_GET['calid']) ? $_GET['calid'] : NULL;
$event = isset($_GET['eventid']) ? $_GET['eventid'] : NULL;
2012-03-28 19:06:16 +04:00
$nl = "\n\r";
2011-10-02 01:19:06 +04:00
if(isset($cal)){
$calendar = OC_Calendar_App::getCalendar($cal);
2011-10-02 01:19:06 +04:00
$calobjects = OC_Calendar_Object::all($cal);
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics');
2011-12-19 02:01:45 +04:00
foreach($calobjects as $calobject){
2012-01-15 03:45:27 +04:00
echo $calobject['calendardata'] . $nl;
2011-10-02 01:19:06 +04:00
}
}elseif(isset($event)){
$data = OC_Calendar_App::getEventObject($_GET['eventid']);
$calendarid = $data['calendarid'];
$calendar = OC_Calendar_App::getCalendar($calendarid);
header('Content-Type: text/Calendar');
header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics');
echo $data['calendardata'];
}
?>