예제 #1
0
 /**
  * @NoAdminRequired
  */
 public function addTask()
 {
     $taskName = $this->params('name');
     $calendarId = $this->params('calendarID');
     $starred = $this->params('starred');
     $due = $this->params('due');
     $start = $this->params('start');
     $response = new JSONResponse();
     $user_timezone = \OC_Calendar_App::getTimezone();
     $request = array('summary' => $taskName, 'categories' => null, 'priority' => $starred, 'location' => null, 'due' => $due, 'start' => $start, 'description' => null);
     $vcalendar = Helper::createVCalendarFromRequest($request);
     $taskId = \OC_Calendar_Object::add($calendarId, $vcalendar->serialize());
     $task = Helper::arrayForJSON($taskId, $vcalendar->VTODO, $user_timezone);
     $task['calendarid'] = $calendarId;
     $task['tmpID'] = $this->params('tmpID');
     $result = array('data' => array('task' => $task));
     $response->setData($result);
     return $response;
 }
예제 #2
0
 /**
  * create new task
  * 
  * @param  string $taskName
  * @param  int    $calendarId
  * @param  bool   $starred
  * @param  mixed  $due
  * @param  mixed  $start
  * @param  int    $tmpID
  * @return array
  */
 public function add($taskName, $calendarId, $starred, $due, $start, $tmpID)
 {
     $user_timezone = \OC_Calendar_App::getTimezone();
     $request = array('summary' => $taskName, 'categories' => null, 'priority' => $starred, 'location' => null, 'due' => $due, 'start' => $start, 'description' => null);
     $vcalendar = Helper::createVCalendarFromRequest($request);
     $taskID = \OC_Calendar_Object::add($calendarId, $vcalendar->serialize());
     $task = Helper::arrayForJSON($taskID, $vcalendar->VTODO, $user_timezone, $calendarId);
     $task['tmpID'] = $tmpID;
     return $task;
 }