2012-02-22 23:21:27 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Init owncloud
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('tasks');
|
2012-02-22 23:21:27 +04:00
|
|
|
|
2012-05-04 19:19:25 +04:00
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
|
2012-05-04 22:20:37 +04:00
|
|
|
$user_timezone = OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone', date_default_timezone_get());
|
2012-02-22 23:21:27 +04:00
|
|
|
|
|
|
|
$tasks = array();
|
|
|
|
foreach( $calendars as $calendar ){
|
|
|
|
$calendar_tasks = OC_Calendar_Object::all($calendar['id']);
|
|
|
|
foreach( $calendar_tasks as $task ){
|
|
|
|
if($task['objecttype']!='VTODO'){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if(is_null($task['summary'])){
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$object = OC_VObject::parse($task['calendardata']);
|
|
|
|
$vtodo = $object->VTODO;
|
2012-04-20 20:18:07 +04:00
|
|
|
try {
|
|
|
|
$tasks[] = OC_Task_App::arrayForJSON($task['id'], $vtodo, $user_timezone);
|
|
|
|
} catch(Exception $e) {
|
2012-05-04 22:20:37 +04:00
|
|
|
OCP\Util::writeLog('tasks', $e->getMessage(), OCP\Util::ERROR);
|
2012-04-20 20:18:07 +04:00
|
|
|
}
|
2012-02-22 23:21:27 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-04 19:19:25 +04:00
|
|
|
OCP\JSON::encodedPrint($tasks);
|