2011-09-12 23:28:28 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Init owncloud
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('tasks');
|
2012-07-17 13:52:11 +04:00
|
|
|
OCP\JSON::callCheck();
|
2011-09-12 23:28:28 +04:00
|
|
|
|
2012-05-04 19:19:25 +04:00
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
2012-05-05 20:47:26 +04:00
|
|
|
$first_calendar = reset($calendars);
|
|
|
|
$cid = $first_calendar['id'];
|
2011-09-12 23:28:28 +04:00
|
|
|
|
2012-06-09 16:32:51 +04:00
|
|
|
$input = $_POST['text'];
|
2012-04-24 00:13:35 +04:00
|
|
|
$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);
|
2011-09-12 23:28:28 +04:00
|
|
|
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
|
|
|
|
|
2012-07-21 02:45:13 +04:00
|
|
|
$user_timezone = OC_Calendar_App::getTimezone();
|
2012-03-09 01:26:54 +04:00
|
|
|
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
|
|
|
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::success(array('task' => $task));
|