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
|
|
|
|
|
|
|
$l10n = new OC_L10N('tasks');
|
|
|
|
|
|
|
|
$id = $_GET['id'];
|
|
|
|
$task = OC_Calendar_Object::find( $id );
|
|
|
|
if( $task === false ){
|
2011-10-06 23:21:38 +04:00
|
|
|
OC_JSON::error(array('data' => array( 'message' => $l10n->t('Can not find Task!'))));
|
2011-09-12 23:28:28 +04:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] );
|
|
|
|
if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){
|
2011-10-06 23:21:38 +04:00
|
|
|
OC_JSON::error(array('data' => array( 'message' => $l10n->t('This is not your task!'))));
|
2011-09-12 23:28:28 +04:00
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
|
|
|
$details = Sabre_VObject_Reader::read($task['calendardata'])->VTODO;
|
2011-09-14 00:44:15 +04:00
|
|
|
$categories = array();
|
|
|
|
if (isset($details->CATEGORIES)){
|
|
|
|
$categories = explode(',', $details->CATEGORIES->value);
|
|
|
|
$categories = array_map('trim', $categories);
|
|
|
|
}
|
|
|
|
|
|
|
|
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
|
|
|
|
$percent_options = range(0, 100, 10);
|
|
|
|
$priority_options = OC_Task_VTodo::getPriorityOptions($l10n);
|
|
|
|
|
2011-09-12 23:28:28 +04:00
|
|
|
$tmpl = new OC_Template('tasks','part.edittaskform');
|
2011-09-14 00:44:15 +04:00
|
|
|
$tmpl->assign('category_options', $category_options);
|
|
|
|
$tmpl->assign('percent_options', $percent_options);
|
|
|
|
$tmpl->assign('priority_options', $priority_options);
|
2011-09-12 23:28:28 +04:00
|
|
|
$tmpl->assign('task',$task);
|
|
|
|
$tmpl->assign('details',$details);
|
2011-09-14 00:44:15 +04:00
|
|
|
$tmpl->assign('categories', $categories);
|
2011-09-12 23:28:28 +04:00
|
|
|
$page = $tmpl->fetchPage();
|
|
|
|
|
2011-10-06 23:21:38 +04:00
|
|
|
OC_JSON::success(array('data' => array( 'page' => $page )));
|