nextcloud/apps/calendar/ajax/neweventform.php

75 lines
3.0 KiB
PHP
Raw Normal View History

2011-08-11 13:22:07 +04:00
<?php
2011-09-24 00:59:24 +04:00
/**
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
require_once('../../../lib/base.php');
2011-09-15 01:29:35 +04:00
OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar');
2011-09-15 01:29:35 +04:00
2011-10-25 21:57:20 +04:00
if (!isset($_POST['start'])){
OC_JSON::error();
die;
2011-09-15 01:29:35 +04:00
}
2011-10-25 21:57:20 +04:00
$start = $_POST['start'];
$end = $_POST['end'];
$allday = $_POST['allday'];
2011-09-15 01:29:35 +04:00
2011-10-25 21:57:20 +04:00
if (!$end){
$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', '60');
$end = $start + ($duration * 60);
}
$start = new DateTime('@'.$start);
$end = new DateTime('@'.$end);
$timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
2011-10-25 21:57:20 +04:00
$start->setTimezone(new DateTimeZone($timezone));
$end->setTimezone(new DateTimeZone($timezone));
2011-10-02 00:53:18 +04:00
2011-10-25 21:57: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-12-26 02:19:49 +04:00
$repeat_end_options = OC_Calendar_App::getEndOptions();
$repeat_month_options = OC_Calendar_App::getMonthOptions();
$repeat_year_options = OC_Calendar_App::getYearOptions();
$repeat_weekly_options = OC_Calendar_App::getWeeklyOptions();
$repeat_weekofmonth_options = OC_Calendar_App::getWeekofMonth();
$repeat_byyearday_options = OC_Calendar_App::getByYearDayOptions();
$repeat_bymonth_options = OC_Calendar_App::getByMonthOptions();
$repeat_byweekno_options = OC_Calendar_App::getByWeekNoOptions();
$repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions();
2011-09-15 01:29:35 +04:00
$tmpl = new OC_Template('calendar', 'part.newevent');
2011-09-23 00:22:52 +04:00
$tmpl->assign('calendar_options', $calendar_options);
$tmpl->assign('category_options', $category_options);
2011-12-26 02:19:49 +04:00
$tmpl->assign('repeat_options', $repeat_options);
$tmpl->assign('repeat_month_options', $repeat_month_options);
$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
$tmpl->assign('repeat_end_options', $repeat_end_options);
$tmpl->assign('repeat_year_options', $repeat_year_options);
$tmpl->assign('repeat_byyearday_options', $repeat_byyearday_options);
$tmpl->assign('repeat_bymonth_options', $repeat_bymonth_options);
$tmpl->assign('repeat_byweekno_options', $repeat_byweekno_options);
$tmpl->assign('repeat_bymonthday_options', $repeat_bymonthday_options);
$tmpl->assign('repeat_weekofmonth_options', $repeat_weekofmonth_options);
2011-10-25 21:57:20 +04:00
$tmpl->assign('startdate', $start->format('d-m-Y'));
$tmpl->assign('starttime', $start->format('H:i'));
$tmpl->assign('enddate', $end->format('d-m-Y'));
$tmpl->assign('endtime', $end->format('H:i'));
2011-09-15 01:29:35 +04:00
$tmpl->assign('allday', $allday);
2011-12-26 02:19:49 +04:00
$tmpl->assign('repeat', 'doesnotrepeat');
$tmpl->assign('repeat_month', 'monthday');
$tmpl->assign('repeat_weekdays', array());
$tmpl->assign('repeat_interval', 1);
$tmpl->assign('repeat_end', 'never');
$tmpl->assign('repeat_count', '10');
$tmpl->assign('repeat_weekofmonth', 'auto');
$tmpl->assign('repeat_date', '');
$tmpl->assign('repeat_year', 'byyearday');
2011-09-15 01:29:35 +04:00
$tmpl->printpage();
?>