/** * Prepare an array representing the folder data. * * @return array The folder data. */ public function toArray() { return array('folder' => $this->_path, 'type' => $this->_type->getType(), 'default' => $this->_type->isDefault(), 'owner' => $this->_namespace->getOwner($this->_path), 'name' => $this->_namespace->getTitle($this->_path), 'subpath' => $this->_namespace->getSubpath($this->_path), 'parent' => $this->_namespace->getParent($this->_path), 'namespace' => $this->_namespace->matchNamespace($this->_path)->getType(), 'prefix' => $this->_namespace->matchNamespace($this->_path)->getName(), 'delimiter' => $this->_namespace->matchNamespace($this->_path)->getDelimiter()); }
/** * Synchronize based on the given folder list. * * @param Horde_Kolab_Storage_List_Cache $cache The reference to the cache * that should reveive the update. * @param Horde_Kolab_Storage_Folder_Namespace $namespace The namespace handler * @param array $folder_list The list of folders. * @param array $annotation The list of folder annotations. * * @return NULL */ public function _synchronize(Horde_Kolab_Storage_Folder_Namespace $namespace, $folder_list, $annotations) { $folders = array(); $owners = array(); $types = array(); $by_type = array(); $mail_type = $this->_folder_types->create('mail'); $this->_defaults->reset(); foreach ($folder_list as $folder) { $folder = strval($folder); if (!isset($annotations[$folder])) { $type = $mail_type; } else { $type = $this->_folder_types->create($annotations[$folder]); } $folder_type = $type->getType(); $owner = $namespace->getOwner($folder); $owners[$folder] = $owner; $types[$folder] = $type->getType(); $data = new Horde_Kolab_Storage_Folder_Data($folder, $type, $namespace); $dataset = $data->toArray(); $folders[$folder] = $dataset; $by_type[$folder_type][$folder] = $dataset; if ($folders[$folder]['default']) { $this->_defaults->rememberDefault($folder, $folder_type, $owner, $folders[$folder]['namespace'] == Horde_Kolab_Storage_Folder_Namespace::PERSONAL); } } $this->_cache->store($folder_list, $annotations); if (!$this->_cache->hasNamespace()) { $this->_cache->setNamespace(serialize($namespace)); } $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::TYPES, $types); $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::FOLDERS, $folders); $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::OWNERS, $owners); $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::BY_TYPE, $by_type); $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::DEFAULTS, $this->_defaults->getDefaults()); $this->_cache->setQuery(Horde_Kolab_Storage_List_Query_List_Cache::PERSONAL_DEFAULTS, $this->_defaults->getPersonalDefaults()); $this->_cache->save(); }