44 lines
756 B
PHP
44 lines
756 B
PHP
<?php
|
|
|
|
namespace Aerex\TaskwarriorPlugin;
|
|
use Aerex\TaskwarriorPlugin\TW\TaskwarriorManager;
|
|
use Sabre\VObject\Component\VTodo;
|
|
|
|
/**
|
|
* Class CalendarProcessor
|
|
*
|
|
* @author Aerex
|
|
*/
|
|
class CalendarProcessor
|
|
{
|
|
|
|
public function __construct(TaskwarriorManager $taskwarriorManager){
|
|
$this->taskwarriorManager = $taskwarriorManager;
|
|
}
|
|
|
|
public function importTask(VTodo $Todo){
|
|
|
|
if($this->taskwarriorManager->taskExists($Todo->UID)){
|
|
$this->taskwarriorManager->updateTask($Todo);
|
|
}
|
|
|
|
try {
|
|
return $this->taskwarriorManager->addTask($Todo);
|
|
} catch(Exception $e){
|
|
echo $e->getMessage();
|
|
throw $e;
|
|
}
|
|
|
|
}
|
|
|
|
public function export(){
|
|
echo "Not yet implemented";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
?>
|
|
|
|
|