/** * Constructor. * * @param Horde_Kolab_Storage_Folder $folder The storage folder * representing this * resource. * @param Horde_Kolab_FreeBusy_Owner_Freebusy $owner The resource owner. */ public function __construct(Horde_Kolab_Storage_Folder $folder, Horde_Kolab_FreeBusy_Owner_Event $owner) { if ($folder->getType() != 'event') { throw new Horde_Kolab_FreeBusy_Exception(sprintf('Resource %s has type "%s" not "event"!', $folder->getName(), $folder->getType())); } parent::__construct($folder, $owner); }
/** * Delete the specified messages from this folder. * * @param array|string $uids Backend id(s) of the message to be deleted. */ public function deleteBackendIds($uids) { if (!is_array($uids)) { $uids = array($uids); } $this->_driver->deleteMessages($this->_folder->getPath(), $uids); $this->_driver->expunge($this->_folder->getPath()); }
/** * Loads the object from the backend. * * @param string $backend_id The object ID within the * backend. * @param Horde_Kolab_Storage_Folder $folder The folder to retrieve * the data object from. * @param Horde_Kolab_Storage_Object_Writer $data The data parser. * @param Horde_Mime_Part $structure The MIME message * structure of the object. */ public function load($backend_id, Horde_Kolab_Storage_Folder $folder, Horde_Kolab_Storage_Object_Writer $data, Horde_Mime_Part $structure = null) { $this->_folder = $folder->getPath(); $this->_backend_id = $backend_id; $result = Horde_Kolab_Storage_Object_MimeType::matchMimePartToFolderType($structure, $folder->getType()); /* No object content matching the folder type: Try fetching the header * and look for a Kolab type deviating from the folder type. */ if ($result === false || $result[0] === false) { $result = Horde_Kolab_Storage_Object_MimeType::matchMimePartToHeaderType($structure, $this->getHeaders()); /* Seems to have no Kolab data part: mark invalid. */ if ($result === false || $result[0] === false) { $this->_type = self::TYPE_INVALID; $this->addParseError(self::ERROR_MISSING_KOLAB_PART); return; } } $this->_type = $result[1]; $mime_part = $structure->getPart($result[0]); if (empty($mime_part)) { $this->_type = self::TYPE_INVALID; $this->addParseError(self::ERROR_MISSING_KOLAB_PART); return; } $this->_mime_part_id = $result[0]; $mime_part->setContents($this->getContent()); $result = $data->load($mime_part->getContents(array('stream' => true)), $this); if ($result instanceof Exception) { $this->addParseError(self::ERROR_INVALID_KOLAB_PART, $result->getMessage()); } else { foreach ($structure->getParts() as $part) { if ($part->getMimeId() == $this->_mime_part_id || !$part->getName()) { continue; } $this->_data['_attachments'][$part->getName()] = array('type' => $part->getType(), 'content' => $this->_getDriver()->fetchBodypart($this->_getFolder(), $this->getBackendId(), $part->getMimeId())); } } $this->_structure = $structure; }
/** * Fetch the resource ACL. * * @return array ACL for this resource. * * @throws Horde_Kolab_FreeBusy_Exception If retrieving the ACL information * failed. */ public function getAcl() { $perm = $this->_folder->getPermission(); $acl =& $perm->acl; return $acl; }