summaryrefslogtreecommitdiffstats
path: root/apps/tasks
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-05-04 17:19:25 +0200
committerBart Visscher <bartv@thisnet.nl>2012-05-04 17:19:25 +0200
commit439467746a64ae3efbe85c08f29e14c823e4a0dc (patch)
treea094f5483e9792e9c8c129bf21be8f9e54067e92 /apps/tasks
parent1e471562268ff62c59708b724c22930bc1d01d95 (diff)
downloadnextcloud-server-439467746a64ae3efbe85c08f29e14c823e4a0dc.tar.gz
nextcloud-server-439467746a64ae3efbe85c08f29e14c823e4a0dc.zip
Tasks: Update to new public API
Diffstat (limited to 'apps/tasks')
-rw-r--r--apps/tasks/ajax/addtask.php10
-rw-r--r--apps/tasks/ajax/addtaskform.php8
-rw-r--r--apps/tasks/ajax/delete.php6
-rw-r--r--apps/tasks/ajax/edittask.php10
-rw-r--r--apps/tasks/ajax/edittaskform.php6
-rw-r--r--apps/tasks/ajax/getdetails.php8
-rw-r--r--apps/tasks/ajax/gettasks.php10
-rw-r--r--apps/tasks/ajax/update_property.php14
-rw-r--r--apps/tasks/index.php20
-rw-r--r--apps/tasks/lib/app.php8
10 files changed, 50 insertions, 50 deletions
diff --git a/apps/tasks/ajax/addtask.php b/apps/tasks/ajax/addtask.php
index 9d62a5fe707..9f5f382cacf 100644
--- a/apps/tasks/ajax/addtask.php
+++ b/apps/tasks/ajax/addtask.php
@@ -2,10 +2,10 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
$cid = reset($calendars)['id'];
$input = $_GET['text'];
@@ -21,7 +21,7 @@ $request['description'] = null;
$vcalendar = OC_Task_App::createVCalendarFromRequest($request);
$id = OC_Calendar_Object::add($cid, $vcalendar->serialize());
-$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
-OC_JSON::success(array('task' => $task));
+OCP\JSON::success(array('task' => $task));
diff --git a/apps/tasks/ajax/addtaskform.php b/apps/tasks/ajax/addtaskform.php
index 48e1bc8d897..e52c9b59329 100644
--- a/apps/tasks/ajax/addtaskform.php
+++ b/apps/tasks/ajax/addtaskform.php
@@ -2,10 +2,10 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
$category_options = OC_Calendar_App::getCategoryOptions();
$percent_options = range(0, 100, 10);
$priority_options = OC_Task_App::getPriorityOptions();
@@ -18,4 +18,4 @@ $tmpl->assign('details', new OC_VObject('VTODO'));
$tmpl->assign('categories', '');
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/tasks/ajax/delete.php b/apps/tasks/ajax/delete.php
index ce80191a560..7b18c70c4fe 100644
--- a/apps/tasks/ajax/delete.php
+++ b/apps/tasks/ajax/delete.php
@@ -22,11 +22,11 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
$id = $_GET['id'];
$task = OC_Calendar_App::getEventObject( $id );
OC_Calendar_Object::delete($id);
-OC_JSON::success(array('data' => array( 'id' => $id )));
+OCP\JSON::success(array('data' => array( 'id' => $id )));
diff --git a/apps/tasks/ajax/edittask.php b/apps/tasks/ajax/edittask.php
index ae937a7dcab..4b38bb6c97c 100644
--- a/apps/tasks/ajax/edittask.php
+++ b/apps/tasks/ajax/edittask.php
@@ -2,8 +2,8 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
@@ -12,7 +12,7 @@ $vcalendar = OC_Calendar_App::getVCalendar($id);
$errors = OC_Task_App::validateRequest($_POST);
if (!empty($errors)) {
- OC_JSON::error(array('data' => array( 'errors' => $errors )));
+ OCP\JSON::error(array('data' => array( 'errors' => $errors )));
exit();
}
@@ -26,7 +26,7 @@ $tmpl->assign('details', $vcalendar->VTODO);
$tmpl->assign('id', $id);
$page = $tmpl->fetchPage();
-$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$task = OC_Task_App::arrayForJSON($id, $vcalendar->VTODO, $user_timezone);
-OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
+OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page, 'task' => $task )));
diff --git a/apps/tasks/ajax/edittaskform.php b/apps/tasks/ajax/edittaskform.php
index 42a4bfead8d..d5d6c23eb4f 100644
--- a/apps/tasks/ajax/edittaskform.php
+++ b/apps/tasks/ajax/edittaskform.php
@@ -2,8 +2,8 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
$id = $_GET['id'];
$details = OC_Calendar_App::getVCalendar($id)->VTODO;
@@ -22,4 +22,4 @@ $tmpl->assign('details',$details);
$tmpl->assign('categories', $categories);
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'page' => $page )));
diff --git a/apps/tasks/ajax/getdetails.php b/apps/tasks/ajax/getdetails.php
index 2e6e8181f1b..34cbc16cc9e 100644
--- a/apps/tasks/ajax/getdetails.php
+++ b/apps/tasks/ajax/getdetails.php
@@ -2,8 +2,8 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
$l10n = new OC_L10N('tasks');
@@ -11,7 +11,7 @@ $id = $_GET['id'];
$task = OC_Calendar_Object::find($id);
$details = OC_VObject::parse($task['calendardata']);
if (!$details){
- OC_JSON::error();
+ OCP\JSON::error();
exit;
}
@@ -22,4 +22,4 @@ $tmpl->assign('details',$details->VTODO);
$tmpl->assign('id',$id);
$page = $tmpl->fetchPage();
-OC_JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
+OCP\JSON::success(array('data' => array( 'id' => $id, 'page' => $page )));
diff --git a/apps/tasks/ajax/gettasks.php b/apps/tasks/ajax/gettasks.php
index cd8d26f480e..d8a0ae1b74a 100644
--- a/apps/tasks/ajax/gettasks.php
+++ b/apps/tasks/ajax/gettasks.php
@@ -8,11 +8,11 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
-$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
+$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$tasks = array();
foreach( $calendars as $calendar ){
@@ -34,4 +34,4 @@ foreach( $calendars as $calendar ){
}
}
-OC_JSON::encodedPrint($tasks);
+OCP\JSON::encodedPrint($tasks);
diff --git a/apps/tasks/ajax/update_property.php b/apps/tasks/ajax/update_property.php
index b075489bd17..68fe32637cf 100644
--- a/apps/tasks/ajax/update_property.php
+++ b/apps/tasks/ajax/update_property.php
@@ -8,8 +8,8 @@
// Init owncloud
require_once('../../../lib/base.php');
-OC_JSON::checkLoggedIn();
-OC_JSON::checkAppEnabled('tasks');
+OCP\JSON::checkLoggedIn();
+OCP\JSON::checkAppEnabled('tasks');
$id = $_POST['id'];
$property = $_POST['type'];
@@ -39,7 +39,7 @@ switch($property) {
$type = null;
if ($due != 'false') {
try {
- $timezone = OC_Preferences::getValue(OC_User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$timezone = new DateTimeZone($timezone);
$due = new DateTime('@'.$due);
$due->setTimezone($timezone);
@@ -48,7 +48,7 @@ switch($property) {
$type = Sabre_VObject_Element_DateTime::DATE;
}
} catch (Exception $e) {
- OC_JSON::error(array('data'=>array('message'=>OC_Task_App::$l10n->t('Invalid date/time'))));
+ OCP\JSON::error(array('data'=>array('message'=>OC_Task_App::$l10n->t('Invalid date/time'))));
exit();
}
}
@@ -59,11 +59,11 @@ switch($property) {
OC_Task_App::setComplete($vtodo, $checked ? '100' : '0', null);
break;
default:
- OC_JSON::error(array('data'=>array('message'=>'Unknown type')));
+ OCP\JSON::error(array('data'=>array('message'=>'Unknown type')));
exit();
}
OC_Calendar_Object::edit($id, $vcalendar->serialize());
-$user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+$user_timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$task_info = OC_Task_App::arrayForJSON($id, $vtodo, $user_timezone);
-OC_JSON::success(array('data' => $task_info));
+OCP\JSON::success(array('data' => $task_info));
diff --git a/apps/tasks/index.php b/apps/tasks/index.php
index 1ec91feb17a..a9e8c56123a 100644
--- a/apps/tasks/index.php
+++ b/apps/tasks/index.php
@@ -9,22 +9,22 @@
*************************************************/
require_once ('../../lib/base.php');
-OC_Util::checkLoggedIn();
-OC_Util::checkAppEnabled('tasks');
+OCP\User::checkLoggedIn();
+OCP\App::checkAppEnabled('tasks');
-$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
+$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
if( count($calendars) == 0 ) {
header('Location: ' . OC_Helper::linkTo('calendar', 'index.php'));
exit;
}
-OC_Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
-OC_Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
-OC_UTIL::addScript('tasks', 'tasks');
-OC_UTIL::addStyle('tasks', 'style');
-OC_Util::addScript('contacts','jquery.multi-autocomplete');
-OC_Util::addScript('','oc-vcategories');
-OC_APP::setActiveNavigationEntry('tasks_index');
+OCP\Util::addScript('3rdparty/timepicker', 'jquery.ui.timepicker');
+OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
+OCP\Util::addScript('tasks', 'tasks');
+OCP\Util::addStyle('tasks', 'style');
+OCP\Util::addScript('contacts','jquery.multi-autocomplete');
+OCP\Util::addScript('','oc-vcategories');
+OCP\App::setActiveNavigationEntry('tasks_index');
$categories = OC_Calendar_App::getCategoryOptions();
$l10n = new OC_L10N('tasks');
diff --git a/apps/tasks/lib/app.php b/apps/tasks/lib/app.php
index 32d924c10df..b1e92dc6b6e 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(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
+ $timezone = OC_Preferences::getValue(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(OC_USER::getUser(), "calendar", "timezone", "Europe/London");
+ $timezone = OC_Preferences::getValue(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(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Preferences::getValue(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(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get());
+ $timezone = OC_Preferences::getValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
$timezone = new DateTimeZone($timezone);
$completed = new DateTime($completed, $timezone);
$vtodo->setDateTime('COMPLETED', $completed);