/** * Create a new object. * * @param array &$object The array that holds the object data. * @param boolean $raw True if the data to be stored has been provided in * raw format. * * @return string The ID of the new object or true in case the backend does * not support this return value. * * @throws Horde_Kolab_Storage_Exception In case an error occured while * saving the data. */ public function create(&$object, $raw = false) { $this->_logger->debug(sprintf('Creating new data object in %s.', $this->_data->getPath())); $result = $this->_data->create($object, $raw); $this->_logger->debug(sprintf('Created data object %s in %s [backend: %s].', $object['uid'], $this->_data->getPath(), $result)); return $result; }
/** * Saves an event in the backend. * * @param Kronolith_Event $event The event to save. * * @return string The event id. * @throws Horde_Mime_Exception */ protected function _saveEvent($event, $edit) { $this->synchronize(); $action = $edit ? array('action' => 'modify') : array('action' => 'add'); if (!$event->uid) { $event->uid = $this->_data->generateUID(); $event->id = Horde_Url::uriB64Encode($event->uid); } $object = $event->toKolab(); if ($edit) { $this->_data->modify($object); } else { $this->_data->create($object); } /* Deal with tags */ if ($edit) { $this->_updateTags($event); } else { $this->_addTags($event); } /* Notify about the changed event. */ Kronolith::sendNotification($event, $edit ? 'edit' : 'add'); /* Log the creation/modification of this item in the history log. */ try { $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true); } catch (Exception $e) { Horde::log($e, 'ERR'); } // refresh IMAP cache $this->synchronize(true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { //Kolab::triggerFreeBusyUpdate($this->_data->parseFolder($event->calendar)); } return $event->id; }