edittask.php 999 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. // Init owncloud
  3. OCP\JSON::checkLoggedIn();
  4. OCP\JSON::checkAppEnabled('tasks');
  5. $l10n = new OC_L10N('tasks');
  6. $id = $_POST['id'];
  7. $vcalendar = OC_Calendar_App::getVCalendar($id);
  8. $errors = OC_Task_App::validateRequest($_POST);
  9. if (!empty($errors)) {
  10. OCP\JSON::error(array('data' => array( 'errors' => $errors )));
  11. exit();
  12. }
  13. OC_Task_App::updateVCalendarFromRequest($_POST, $vcalendar);
  14. OC_Calendar_Object::edit($id, $vcalendar->serialize());
  15. $priority_options = OC_Task_App::getPriorityOptions();
  16. $tmpl = new OCP\Template('tasks','part.details');
  17. $tmpl->assign('priority_options', $priority_options);
  18. $tmpl->assign('details', $vcalendar->VTODO);
  19. $tmpl->assign('id', $id);
  20. $page = $tmpl->fetchPage();
  21. $user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
  22. $task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
  23. OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));