2011-09-15 23:20:42 +04:00
|
|
|
<?php
|
2011-09-24 00:59:24 +04:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2011-09-15 23:20:42 +04:00
|
|
|
require_once('../../../lib/base.php');
|
|
|
|
|
|
|
|
if(!OC_USER::isLoggedIn()) {
|
|
|
|
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
|
|
|
}
|
2011-10-01 01:05:10 +04:00
|
|
|
OC_JSON::checkAppEnabled('calendar');
|
2011-09-15 23:20:42 +04:00
|
|
|
|
|
|
|
$id = $_GET['id'];
|
2011-12-19 01:58:20 +04:00
|
|
|
$data = OC_Calendar_App::getEventObject($id);
|
2011-09-20 16:41:17 +04:00
|
|
|
$object = OC_VObject::parse($data['calendardata']);
|
2011-09-15 23:20:42 +04:00
|
|
|
$vevent = $object->VEVENT;
|
2011-12-19 01:58:20 +04:00
|
|
|
|
2011-09-15 23:20:42 +04:00
|
|
|
$dtstart = $vevent->DTSTART;
|
2011-09-29 01:16:32 +04:00
|
|
|
$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
|
2011-09-15 23:20:42 +04:00
|
|
|
switch($dtstart->getDateType()) {
|
|
|
|
case Sabre_VObject_Element_DateTime::LOCALTZ:
|
2011-09-29 01:16:32 +04:00
|
|
|
case Sabre_VObject_Element_DateTime::LOCAL:
|
2011-09-15 23:20:42 +04:00
|
|
|
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
|
|
|
$starttime = $dtstart->getDateTime()->format('H:i');
|
|
|
|
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
|
|
|
$endtime = $dtend->getDateTime()->format('H:i');
|
|
|
|
$allday = false;
|
|
|
|
break;
|
2011-09-16 02:08:15 +04:00
|
|
|
case Sabre_VObject_Element_DateTime::DATE:
|
|
|
|
$startdate = $dtstart->getDateTime()->format('d-m-Y');
|
|
|
|
$starttime = '';
|
|
|
|
$dtend->getDateTime()->modify('-1 day');
|
|
|
|
$enddate = $dtend->getDateTime()->format('d-m-Y');
|
|
|
|
$endtime = '';
|
|
|
|
$allday = true;
|
|
|
|
break;
|
2011-09-15 23:20:42 +04:00
|
|
|
}
|
|
|
|
|
2011-09-20 16:41:17 +04:00
|
|
|
$summary = $vevent->getAsString('SUMMARY');
|
|
|
|
$location = $vevent->getAsString('LOCATION');
|
|
|
|
$categories = $vevent->getAsArray('CATEGORIES');
|
|
|
|
$repeat = $vevent->getAsString('CATEGORY');
|
|
|
|
$description = $vevent->getAsString('DESCRIPTION');
|
2011-09-29 01:16:32 +04:00
|
|
|
foreach($categories as $category){
|
|
|
|
if (!in_array($category, $category_options)){
|
|
|
|
array_unshift($category_options, $category);
|
|
|
|
}
|
|
|
|
}
|
2011-11-10 01:17:09 +04:00
|
|
|
$last_modified = $vevent->__get('LAST-MODIFIED');
|
|
|
|
if ($last_modified){
|
|
|
|
$lastmodified = $last_modified->getDateTime()->format('U');
|
|
|
|
}else{
|
|
|
|
$lastmodified = 0;
|
|
|
|
}
|
2011-09-15 23:20:42 +04:00
|
|
|
|
2011-12-19 01:58:20 +04:00
|
|
|
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
|
|
|
$category_options = OC_Calendar_App::getCategoryOptions();
|
|
|
|
$repeat_options = OC_Calendar_App::getRepeatOptions();
|
|
|
|
|
2011-09-15 23:20:42 +04:00
|
|
|
$tmpl = new OC_Template('calendar', 'part.editevent');
|
|
|
|
$tmpl->assign('id', $id);
|
2011-11-10 01:17:09 +04:00
|
|
|
$tmpl->assign('lastmodified', $lastmodified);
|
2011-09-23 00:22:52 +04:00
|
|
|
$tmpl->assign('calendar_options', $calendar_options);
|
|
|
|
$tmpl->assign('category_options', $category_options);
|
2011-09-15 23:20:42 +04:00
|
|
|
$tmpl->assign('repeat_options', $repeat_options);
|
|
|
|
|
|
|
|
$tmpl->assign('title', $summary);
|
|
|
|
$tmpl->assign('location', $location);
|
2011-09-23 00:22:52 +04:00
|
|
|
$tmpl->assign('categories', $categories);
|
2011-09-15 23:20:42 +04:00
|
|
|
$tmpl->assign('calendar', $data['calendarid']);
|
|
|
|
$tmpl->assign('allday', $allday);
|
|
|
|
$tmpl->assign('startdate', $startdate);
|
|
|
|
$tmpl->assign('starttime', $starttime);
|
|
|
|
$tmpl->assign('enddate', $enddate);
|
|
|
|
$tmpl->assign('endtime', $endtime);
|
|
|
|
$tmpl->assign('repeat', $repeat);
|
|
|
|
$tmpl->assign('description', $description);
|
|
|
|
$tmpl->printpage();
|
|
|
|
?>
|
2011-08-19 22:33:48 +04:00
|
|
|
|