Exemplo n.º 1
0
 /**
  * @brief deletes an  object with the data provided by \Sabredav
  * @param integer $cid calendar id
  * @param string $uri the uri of the object
  * @param boolean $bLogActivity 
  * @return boolean
  */
 public function deleteObject($cid, $uri, $bLogActivity = true)
 {
     $this->setUserId(\OCP\User::getUser());
     $calendar = $this->find($cid);
     if ($calendar['userid'] !== $this->userId) {
         $sharedCalendar = $this->shareConnector->getItemSharedWithBySourceCalendar($cid);
         if (!$sharedCalendar || !($sharedCalendar['permissions'] & $this->shareConnector->getDeleteAccess())) {
             throw new \Sabre\DAV\Exception\Forbidden('You do not have the permissions to delete this event.');
         }
     }
     $oldobject = $this->findObjectWhereDAVDataIs($cid, $uri);
     $eventDB = new EventDAO($this->db, $this->userId, null);
     $eventDB->deleteEventFromDAV($cid, $uri);
     $calendarDB = new CalendarDAO($this->db, $this->userId);
     $calendarDB->touch($cid);
     if ($oldobject['repeating']) {
         $app = new Application();
         $c = $app->getContainer();
         $repeatController = $c->query('RepeatController');
         $repeatController->cleanEvent($oldobject['id']);
     }
     //\OCP\Util::emitHook('\OCA\CalendarPlus', 'deleteEvent', $oldobject['id']);
     if ($bLogActivity === true) {
         $params = array('mode' => 'deleted', 'link' => '', 'trans_type' => $oldobject['objecttype'], 'summary' => $oldobject['summary'], 'cal_user' => $calendar['userid'], 'cal_displayname' => $calendar['displayname']);
         ActivityData::logEventActivity($params, true);
     }
     return true;
 }
Exemplo n.º 2
0
 /**
  * @brief Updates ctag for calendar
  * @param integer $id
  * @return boolean
  */
 public static function touchCalendar($id)
 {
     $userid = \OCP\User::getUser();
     $dbObject = \OC::$server->getDb();
     $calendarDB = new CalendarDAO($dbObject, $userid);
     $bUpdateCalendar = $calendarDB->touch($id);
     return $bUpdateCalendar;
 }