2011-09-12 23:28:28 +04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// Init owncloud
|
|
|
|
require_once('../../../lib/base.php');
|
2011-10-06 23:21:38 +04:00
|
|
|
OC_JSON::checkLoggedIn();
|
|
|
|
OC_JSON::checkAppEnabled('tasks');
|
2011-09-12 23:28:28 +04:00
|
|
|
|
2012-04-24 00:13:35 +04:00
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
|
|
|
$cid = reset($calendars)['id'];
|
2011-09-12 23:28:28 +04:00
|
|
|
|
2012-04-24 00:13:35 +04:00
|
|
|
$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);
|
2011-09-12 23:28:28 +04:00
|
|
|
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
|
|
|
|
|
2012-03-09 01:26:54 +04:00
|
|
|
$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
|
|
|
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
|
|
|
|
2012-04-24 00:13:35 +04:00
|
|
|
OC_JSON::success(array('task' => $task));
|