To get access to the folder handling you would do the following:
require_once 'Horde/Kolab/Storage.php';
$folder = Horde_Kolab_Storage::getFolder('INBOX/Calendar');
or (in case you are dealing with share identifications):
require_once 'Horde/Kolab/Storage.php';
$folder = Horde_Kolab_Storage::getShare(Auth::getAuth(), 'event');
To access data in a share (or folder) you need to retrieve the
corresponding data object:
require_once 'Horde/Kolab/Storage.php';
$folder = Horde_Kolab_Storage::getShareData(Auth::getAuth(), 'event');
Copyright 2004-2016 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
/** * Return the Kolab data handler for the specified notepad. * * @param string $notepad The notepad name. * * @return Horde_Kolab_Storage_Data The data handler. */ protected function _getDataForNotepad($notepad) { try { return $this->_kolab->getData($GLOBALS['mnemo_shares']->getShare($notepad)->get('folder'), 'note'); } catch (Horde_Kolab_Storage_Exception $e) { throw new Mnemo_Exception(sprintf(_("Failed retrieving Kolab data for notepad %s: %s"), $notepad, $e->getMessage())); } }
/** * Returns a new Kolab data handler for the current address book. * * @param string $type An object type, either 'contact' or * 'distribution-list'. * * @return Horde_Kolab_Storage_Data A data handler. */ protected function _createData($type) { if (!empty($this->_share)) { $share = $this->_share; } else { if (empty($this->_name)) { throw new Turba_Exception('The addressbook has been left undefined but is required!'); } $share = $GLOBALS['injector']->getInstance('Turba_Shares')->getShare($this->_name); } $data = $this->_kolab->getData($share->get('folder'), $type); $this->setContactOwner($share->get('owner')); return $data; }
/** * Opens a connection to the Kolab server. * * @param boolean $create_missing Create a preferences folder if it is * missing. * * @return Horde_Kolab_Storage_Data The storage backend. * * @throws Horde_Prefs_Exception */ protected function _getStorage($create_missing = false) { $query = $this->_kolab->getList()->getQuery(); if ($folder = $query->getDefault('h-prefs')) { return $this->_kolab->getData($folder); } $folders = $query->listByType('h-prefs'); if (!empty($folders)) { return $this->_kolab->getData($folders[0]); } if (!$create_missing) { throw new Horde_Prefs_Exception('No Kolab storage backend available.'); } $params = $this->getParams(); $folder = $this->_kolab->getList()->getNamespace()->constructFolderName($params['user'], $this->_folder); $this->_kolab->getList()->getListManipulation()->createFolder($folder, 'h-prefs.default'); if ($this->_logger !== null) { $this->_logger->info(sprintf(__CLASS__ . ': Created default Kolab preferences folder "%s".', $this->_folder)); } return $this->_kolab->getData($folder); }
/** * Prepare an empty Kolab storage. * * @return Horde_Kolab_Storage_List The empty storage. */ public function prepareEmptyKolabStorage($params = null) { /** Prepare a Kolab test storage */ if (empty($params)) { $params = array('driver' => 'Mock', 'username' => 'test', 'password' => 'test'); } $storage = Horde_Kolab_Storage::singleton('imap', $params); return $storage; }
/** * Return the Kolab data handler for the specified tasklist. * * @param string $tasklist The tasklist name. * * @return Horde_Kolab_Storage_Date The data handler. */ protected function _getDataForTasklist($tasklist) { return $this->_kolab->getData($GLOBALS['nag_shares']->getShare($tasklist)->get('folder'), 'task'); }
/** * Return a data handler for accessing data in the specified * folder. * * @param string $folder The name of the folder. * @param string $object_type The type of data we want to * access in the folder. * @param int $data_version Format version of the object data. * * @return Horde_Kolab_Storage_Data The data object. */ public function getData($folder, $object_type = null, $data_version = 1) { return new Horde_Kolab_Storage_Data_Decorator_Log($this->_storage->getData($folder, $object_type, $data_version), $this->_logger); }
/** * Return a data handler for accessing data in the specified * folder. * * @param string $folder The name of the folder. * @param string $object_type The type of data we want to * access in the folder. * @param int $data_version Format version of the object data. * * @return Horde_Kolab_Storage_Data The data object. */ public function getData($folder, $object_type = null, $data_version = 1) { $data = $this->_storage->getData($folder, $object_type, $data_version); $this->_synchronization->synchronizeData($data); return $data; }