diff options
Diffstat (limited to 'apps/tasks/ajax/addtask.php')
-rw-r--r-- | apps/tasks/ajax/addtask.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/tasks/ajax/addtask.php b/apps/tasks/ajax/addtask.php new file mode 100644 index 00000000000..891fbdb96df --- /dev/null +++ b/apps/tasks/ajax/addtask.php @@ -0,0 +1,26 @@ +<?php + +// Init owncloud +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('tasks'); + +$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true); +$cid = reset($calendars)['id']; + +$input = $_GET['text']; +$request = array(); +$request['summary'] = $input; +$request["categories"] = null; +$request['priority'] = null; +$request['percent_complete'] = null; +$request['completed'] = null; +$request['location'] = null; +$request['due'] = null; +$request['description'] = null; +$vcalendar = OC_Task_App::createVCalendarFromRequest($request); +$id = OC_Calendar_Object::add($cid, $vcalendar->serialize()); + +$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get()); +$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone); + +OCP\JSON::success(array('task' => $task)); |