private function _callReadFromExisting(Timecard_Models_Timecard $timecard, array $options)
 {
     return Timecard_Models_VObjectReader::readBasedOnExistingTimecard($timecard, $this->_generateVEvent($options));
 }
Esempio n. 2
0
 /**
  * As defined in Sabre_CalDAV_Backend_Abstract
  *
  * Alters a calendar object. This is currently not supported if the event is recurring and any occurrences have been
  * modified in PHProjekt or if this operation would modify any speficic occurrences.
  *
  * @param string $calendarId   The id of the calendar. Equals to the id of the user it belongs to.
  * @param string $objectUri    The uri of the object.
  * @param string $calendarData The vobject data that the object should be modified to.
  *
  * @return void
  */
 public function updateCalendarObject($calendarId, $objectUri, $calendarData)
 {
     $vcalendar = Sabre_VObject_Reader::read($calendarData);
     $timecard = new Timecard_Models_Timecard();
     $timecard = $timecard->findByUri($objectUri);
     if (!$timecard) {
         throw new Sabre_DAV_Exception_NotFound("Timecard entry with uri {$objectUri} not found");
     }
     if ($timecard->ownerId != Phprojekt_Auth_Proxy::getEffectiveUserId()) {
         throw new Sabre_DAV_Exception_Forbidden("You are not allowed to modify this entry");
     }
     $timecard = Timecard_Models_VObjectReader::readBasedOnExistingTimecard($timecard, $vcalendar->vevent);
     $timecard->save();
 }