Welcome to mirror list, hosted at ThFree Co, Russian Federation.

edittask.php « ajax « tasks « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4b38bb6c97c3beacd59c89b284dace94e382a3e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

// Init owncloud
require_once('../../../lib/base.php');
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks');

$l10n = new OC_L10N('tasks');

$id = $_POST['id'];
$vcalendar = OC_Calendar_App::getVCalendar($id);

$errors = OC_Task_App::validateRequest($_POST);
if (!empty($errors)) {
	OCP\JSON::error(array('data' => array( 'errors' => $errors )));
	exit();
}

OC_Task_App::updateVCalendarFromRequest($_POST, $vcalendar);
OC_Calendar_Object::edit($id, $vcalendar->serialize());

$priority_options = OC_Task_App::getPriorityOptions();
$tmpl = new OC_Template('tasks','part.details');
$tmpl->assign('priority_options', $priority_options);
$tmpl->assign('details', $vcalendar->VTODO);
$tmpl->assign('id', $id);
$page = $tmpl->fetchPage();

$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);

OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));