2011-09-15 23:20:42 +04:00
|
|
|
<?php
|
|
|
|
/*************************************************
|
|
|
|
* ownCloud - Calendar Plugin *
|
|
|
|
* *
|
|
|
|
* (c) Copyright 2011 Bart Visscher *
|
|
|
|
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
|
|
|
* *
|
|
|
|
* If you are not able to view the License, *
|
|
|
|
* <http://www.gnu.org/licenses/> *
|
|
|
|
* please write to the Free Software Foundation. *
|
|
|
|
* Address: *
|
|
|
|
* 59 Temple Place, Suite 330, Boston, *
|
|
|
|
* MA 02111-1307 USA *
|
|
|
|
*************************************************/
|
|
|
|
require_once('../../../lib/base.php');
|
|
|
|
|
|
|
|
$l10n = new OC_L10N('calendar');
|
|
|
|
|
|
|
|
if(!OC_USER::isLoggedIn()) {
|
|
|
|
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
|
|
|
}
|
|
|
|
|
2011-09-23 00:22:52 +04:00
|
|
|
$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
|
|
|
|
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
|
2011-09-15 23:20:42 +04:00
|
|
|
$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
|
|
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
$data = OC_Calendar_Object::find($id);
|
2011-09-16 02:08:15 +04:00
|
|
|
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
|
|
|
|
if($calendar['userid'] != OC_User::getUser()){
|
|
|
|
echo $l10n->t('Wrong calendar');
|
|
|
|
exit;
|
|
|
|
}
|
2011-09-15 23:20:42 +04:00
|
|
|
$object = Sabre_VObject_Reader::read($data['calendardata']);
|
|
|
|
$vevent = $object->VEVENT;
|
|
|
|
$dtstart = $vevent->DTSTART;
|
|
|
|
$dtend = $vevent->DTEND;
|
|
|
|
switch($dtstart->getDateType()) {
|
|
|
|
case Sabre_VObject_Element_DateTime::LOCALTZ:
|
|
|
|
$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
|
|
|
}
|
|
|
|
|
|
|
|
$summary = isset($vevent->SUMMARY) ? $vevent->SUMMARY->value : '';
|
|
|
|
$location = isset($vevent->LOCATION) ? $vevent->LOCATION->value : '';
|
2011-09-23 00:22:52 +04:00
|
|
|
$categories = array();
|
|
|
|
if (isset($vevent->CATEGORIES)){
|
|
|
|
$categories = explode(',', $vevent->CATEGORIES->value);
|
|
|
|
$categories = array_map('trim', $categories);
|
|
|
|
}
|
2011-09-15 23:20:42 +04:00
|
|
|
$repeat = isset($vevent->CATEGORY) ? $vevent->CATEGORY->value : '';
|
|
|
|
$description = isset($vevent->DESCRIPTION) ? $vevent->DESCRIPTION->value : '';
|
|
|
|
|
|
|
|
$tmpl = new OC_Template('calendar', 'part.editevent');
|
|
|
|
$tmpl->assign('id', $id);
|
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
|
|
|
|