Skip to content
Snippets Groups Projects
Commit 19d2b948 authored by Bart Visscher's avatar Bart Visscher
Browse files

Tasks: More updates to public API

parent eae21f32
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ $request['description'] = null; ...@@ -20,7 +20,7 @@ $request['description'] = null;
$vcalendar = OC_Task_App::createVCalendarFromRequest($request); $vcalendar = OC_Task_App::createVCalendarFromRequest($request);
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize()); $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); $task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
OCP\JSON::success(array('task' => $task)); OCP\JSON::success(array('task' => $task));
...@@ -25,7 +25,7 @@ $tmpl->assign('details', $vcalendar->VTODO); ...@@ -25,7 +25,7 @@ $tmpl->assign('details', $vcalendar->VTODO);
$tmpl->assign('id', $id); $tmpl->assign('id', $id);
$page = $tmpl->fetchPage(); $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); $task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task ))); OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
...@@ -11,7 +11,7 @@ OCP\JSON::checkLoggedIn(); ...@@ -11,7 +11,7 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('tasks'); OCP\JSON::checkAppEnabled('tasks');
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true); $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(); $tasks = array();
foreach( $calendars as $calendar ){ foreach( $calendars as $calendar ){
...@@ -28,7 +28,7 @@ foreach( $calendars as $calendar ){ ...@@ -28,7 +28,7 @@ foreach( $calendars as $calendar ){
try { try {
$tasks[] = OC_Task_App::arrayForJSON($task['id'], $vtodo, $user_timezone); $tasks[] = OC_Task_App::arrayForJSON($task['id'], $vtodo, $user_timezone);
} catch(Exception $e) { } 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) { ...@@ -38,7 +38,7 @@ switch($property) {
$type = null; $type = null;
if ($due != 'false') { if ($due != 'false') {
try { 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); $timezone = new DateTimeZone($timezone);
$due = new DateTime('@'.$due); $due = new DateTime('@'.$due);
$due->setTimezone($timezone); $due->setTimezone($timezone);
...@@ -63,6 +63,6 @@ switch($property) { ...@@ -63,6 +63,6 @@ switch($property) {
} }
OC_Calendar_Object::edit($id, $vcalendar->serialize()); 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); $task_info = OC_Task_App::arrayForJSON($id, $vtodo, $user_timezone);
OCP\JSON::success(array('data' => $task_info)); OCP\JSON::success(array('data' => $task_info));
...@@ -3,14 +3,14 @@ $l=new OC_L10N('tasks'); ...@@ -3,14 +3,14 @@ $l=new OC_L10N('tasks');
OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php'; OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php';
OC::$CLASSPATH['OC_Task_App'] = 'apps/tasks/lib/app.php'; OC::$CLASSPATH['OC_Task_App'] = 'apps/tasks/lib/app.php';
OC_App::register( array( OCP\App::register( array(
'order' => 11, 'order' => 11,
'id' => 'tasks', 'id' => 'tasks',
'name' => 'Tasks' )); 'name' => 'Tasks' ));
OC_App::addNavigationEntry( array( OCP\App::addNavigationEntry( array(
'id' => 'tasks_index', 'id' => 'tasks_index',
'order' => 11, 'order' => 11,
'href' => OC_Helper::linkTo( 'tasks', 'index.php' ), 'href' => OCP\Util::linkTo( 'tasks', 'index.php' ),
'icon' => OC_Helper::imagePath( 'tasks', 'icon.png' ), 'icon' => OCP\Util::imagePath( 'tasks', 'icon.png' ),
'name' => $l->t('Tasks'))); 'name' => $l->t('Tasks')));
...@@ -13,7 +13,7 @@ OCP\App::checkAppEnabled('tasks'); ...@@ -13,7 +13,7 @@ OCP\App::checkAppEnabled('tasks');
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true); $calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
if( count($calendars) == 0 ) { if( count($calendars) == 0 ) {
header('Location: ' . OC_Helper::linkTo('calendar', 'index.php')); header('Location: ' . OCP\Util::linkTo('calendar', 'index.php'));
exit; exit;
} }
......
...@@ -82,7 +82,7 @@ class OC_Task_App { ...@@ -82,7 +82,7 @@ class OC_Task_App {
} }
try { 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); $timezone = new DateTimeZone($timezone);
new DateTime($request['due'], $timezone); new DateTime($request['due'], $timezone);
} catch (Exception $e) { } catch (Exception $e) {
...@@ -94,7 +94,7 @@ class OC_Task_App { ...@@ -94,7 +94,7 @@ class OC_Task_App {
} }
if ($request['percent_complete'] == 100 && !empty($request['completed'])){ if ($request['percent_complete'] == 100 && !empty($request['completed'])){
try { 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); $timezone = new DateTimeZone($timezone);
new DateTime($request['completed'], $timezone); new DateTime($request['completed'], $timezone);
} catch (Exception $e) { } catch (Exception $e) {
...@@ -147,7 +147,7 @@ class OC_Task_App { ...@@ -147,7 +147,7 @@ class OC_Task_App {
$vtodo->setString('PRIORITY', $priority); $vtodo->setString('PRIORITY', $priority);
if ($due) { 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); $timezone = new DateTimeZone($timezone);
$due = new DateTime($due, $timezone); $due = new DateTime($due, $timezone);
$vtodo->setDateTime('DUE', $due); $vtodo->setDateTime('DUE', $due);
...@@ -176,7 +176,7 @@ class OC_Task_App { ...@@ -176,7 +176,7 @@ class OC_Task_App {
$completed = null; $completed = null;
} }
if ($completed) { 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); $timezone = new DateTimeZone($timezone);
$completed = new DateTime($completed, $timezone); $completed = new DateTime($completed, $timezone);
$vtodo->setDateTime('COMPLETED', $completed); $vtodo->setDateTime('COMPLETED', $completed);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment