Tasks: More updates to public API
This commit is contained in:
parent
eae21f3269
commit
19d2b94837
|
@ -20,7 +20,7 @@ $request['description'] = null;
|
|||
$vcalendar = OC_Task_App::createVCalendarFromRequest($request);
|
||||
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
|
||||
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
|
||||
|
||||
OCP\JSON::success(array('task' => $task));
|
||||
|
|
|
@ -25,7 +25,7 @@ $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());
|
||||
$user_timezone = OCP\Config::getUserValue(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 )));
|
||||
|
|
|
@ -11,7 +11,7 @@ OCP\JSON::checkLoggedIn();
|
|||
OCP\JSON::checkAppEnabled('tasks');
|
||||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
|
||||
$tasks = array();
|
||||
foreach( $calendars as $calendar ){
|
||||
|
@ -28,7 +28,7 @@ foreach( $calendars as $calendar ){
|
|||
try {
|
||||
$tasks[] = OC_Task_App::arrayForJSON($task['id'], $vtodo, $user_timezone);
|
||||
} catch(Exception $e) {
|
||||
OC_Log::write('tasks', $e->getMessage(), OC_Log::ERROR);
|
||||
OCP\Util::writeLog('tasks', $e->getMessage(), OCP\Util::ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ switch($property) {
|
|||
$type = null;
|
||||
if ($due != 'false') {
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$due = new DateTime('@'.$due);
|
||||
$due->setTimezone($timezone);
|
||||
|
@ -63,6 +63,6 @@ switch($property) {
|
|||
}
|
||||
OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
||||
|
||||
$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$task_info = OC_Task_App::arrayForJSON($id, $vtodo, $user_timezone);
|
||||
OCP\JSON::success(array('data' => $task_info));
|
||||
|
|
|
@ -3,14 +3,14 @@ $l=new OC_L10N('tasks');
|
|||
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
|
||||
OC::$CLASSPATH['OC_Task_App'] = 'apps/tasks/lib/app.php';
|
||||
|
||||
OC_App::register( array(
|
||||
OCP\App::register( array(
|
||||
'order' => 11,
|
||||
'id' => 'tasks',
|
||||
'name' => 'Tasks' ));
|
||||
|
||||
OC_App::addNavigationEntry( array(
|
||||
OCP\App::addNavigationEntry( array(
|
||||
'id' => 'tasks_index',
|
||||
'order' => 11,
|
||||
'href' => OC_Helper::linkTo( 'tasks', 'index.php' ),
|
||||
'icon' => OC_Helper::imagePath( 'tasks', 'icon.png' ),
|
||||
'href' => OCP\Util::linkTo( 'tasks', 'index.php' ),
|
||||
'icon' => OCP\Util::imagePath( 'tasks', 'icon.png' ),
|
||||
'name' => $l->t('Tasks')));
|
||||
|
|
|
@ -13,7 +13,7 @@ OCP\App::checkAppEnabled('tasks');
|
|||
|
||||
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
||||
if( count($calendars) == 0 ) {
|
||||
header('Location: ' . OC_Helper::linkTo('calendar', 'index.php'));
|
||||
header('Location: ' . OCP\Util::linkTo('calendar', 'index.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ class OC_Task_App {
|
|||
}
|
||||
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = OCP\Config::getUserValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
new DateTime($request['due'], $timezone);
|
||||
} catch (Exception $e) {
|
||||
|
@ -94,7 +94,7 @@ class OC_Task_App {
|
|||
}
|
||||
if ($request['percent_complete'] == 100 && !empty($request['completed'])){
|
||||
try {
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = OCP\Config::getUserValue(OCP\User::getUser(), "calendar", "timezone", "Europe/London");
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
new DateTime($request['completed'], $timezone);
|
||||
} catch (Exception $e) {
|
||||
|
@ -147,7 +147,7 @@ class OC_Task_App {
|
|||
$vtodo->setString('PRIORITY', $priority);
|
||||
|
||||
if ($due) {
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$due = new DateTime($due, $timezone);
|
||||
$vtodo->setDateTime('DUE', $due);
|
||||
|
@ -176,7 +176,7 @@ class OC_Task_App {
|
|||
$completed = null;
|
||||
}
|
||||
if ($completed) {
|
||||
$timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
||||
$timezone = new DateTimeZone($timezone);
|
||||
$completed = new DateTime($completed, $timezone);
|
||||
$vtodo->setDateTime('COMPLETED', $completed);
|
||||
|
|
Loading…
Reference in New Issue