From 19d2b94837f19539c994157150f3f231f840d3f1 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 4 May 2012 20:20:37 +0200 Subject: [PATCH] Tasks: More updates to public API --- apps/tasks/ajax/addtask.php | 2 +- apps/tasks/ajax/edittask.php | 2 +- apps/tasks/ajax/gettasks.php | 4 ++-- apps/tasks/ajax/update_property.php | 4 ++-- apps/tasks/appinfo/app.php | 8 ++++---- apps/tasks/index.php | 2 +- apps/tasks/lib/app.php | 8 ++++---- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/tasks/ajax/addtask.php b/apps/tasks/ajax/addtask.php index 03eee7c5d9b..891fbdb96df 100644 --- a/apps/tasks/ajax/addtask.php +++ b/apps/tasks/ajax/addtask.php @@ -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)); diff --git a/apps/tasks/ajax/edittask.php b/apps/tasks/ajax/edittask.php index b50a6cee6a3..78d1f193938 100644 --- a/apps/tasks/ajax/edittask.php +++ b/apps/tasks/ajax/edittask.php @@ -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 ))); diff --git a/apps/tasks/ajax/gettasks.php b/apps/tasks/ajax/gettasks.php index aaf80a66776..011730d0a13 100644 --- a/apps/tasks/ajax/gettasks.php +++ b/apps/tasks/ajax/gettasks.php @@ -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); } } } diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php index 2067dd983ec..46521cf6c58 100644 --- a/apps/tasks/ajax/update_property.php +++ b/apps/tasks/ajax/update_property.php @@ -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)); diff --git a/apps/tasks/appinfo/app.php b/apps/tasks/appinfo/app.php index 657c56c0401..f346e2aa4c0 100644 --- a/apps/tasks/appinfo/app.php +++ b/apps/tasks/appinfo/app.php @@ -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'))); diff --git a/apps/tasks/index.php b/apps/tasks/index.php index 160fb5a2697..8ed5f410434 100644 --- a/apps/tasks/index.php +++ b/apps/tasks/index.php @@ -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; } diff --git a/apps/tasks/lib/app.php b/apps/tasks/lib/app.php index b1e92dc6b6e..7b908420333 100644 --- a/apps/tasks/lib/app.php +++ b/apps/tasks/lib/app.php @@ -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); -- 2.39.5