2011-09-12 23:28:28 +04:00
|
|
|
<?php
|
|
|
|
/*************************************************
|
|
|
|
* ownCloud - Tasks Plugin *
|
|
|
|
* *
|
|
|
|
* (c) Copyright 2011 Bart Visscher *
|
|
|
|
* This file is licensed under the Affero General *
|
|
|
|
* Public License version 3 or later. *
|
|
|
|
* See the COPYING-README file. *
|
|
|
|
*************************************************/
|
|
|
|
|
|
|
|
require_once ('../../lib/base.php');
|
2011-10-06 23:21:38 +04:00
|
|
|
OC_Util::checkLoggedIn();
|
|
|
|
OC_Util::checkAppEnabled('tasks');
|
2011-09-12 23:28:28 +04:00
|
|
|
|
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), true);
|
|
|
|
if( count($calendars) == 0){
|
|
|
|
header('Location: ' . OC_HELPER::linkTo('calendar', 'index.php'));
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$id = isset( $_GET['id'] ) ? $_GET['id'] : null;
|
|
|
|
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
$tasks[] = array( 'name' => $task['summary'], 'id' => $task['id'] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-03 00:33:23 +04:00
|
|
|
$details = null;
|
2011-09-12 23:28:28 +04:00
|
|
|
if( !is_null($id) || count($tasks)){
|
|
|
|
if(is_null($id)) $id = $tasks[0]['id'];
|
|
|
|
$task = OC_Calendar_Object::find($id);
|
|
|
|
$details = Sabre_VObject_Reader::read($task['calendardata'])->VTODO;
|
|
|
|
}
|
|
|
|
|
|
|
|
OC_UTIL::addScript('tasks', 'tasks');
|
|
|
|
OC_UTIL::addStyle('tasks', 'style');
|
|
|
|
OC_APP::setActiveNavigationEntry('tasks_index');
|
2011-12-10 00:41:21 +04:00
|
|
|
|
|
|
|
$l10n = new OC_L10N('tasks');
|
2012-02-22 23:11:38 +04:00
|
|
|
$priority_options = OC_Task_App::getPriorityOptions();
|
2011-09-12 23:28:28 +04:00
|
|
|
$output = new OC_Template('tasks', 'tasks', 'user');
|
|
|
|
$output->assign('tasks', $tasks);
|
|
|
|
$output->assign('details', $details);
|
2011-12-10 00:41:21 +04:00
|
|
|
$output->assign('priority_options', $priority_options);
|
2011-09-12 23:28:28 +04:00
|
|
|
$output->assign('id',$id);
|
|
|
|
$output -> printPage();
|