1: <?php
2: /**
3: * Handles a share parameters.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_Storage
9: * @author Gunnar Wrobel <wrobel@pardus.de>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
11: * @link http://pear.horde.org/index.php?package=Kolab_Storage
12: */
13:
14: /**
15: * Handles a share parameters.
16: *
17: * Copyright 2011-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @category Kolab
23: * @package Kolab_Storage
24: * @author Gunnar Wrobel <wrobel@pardus.de>
25: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
26: * @link http://pear.horde.org/index.php?package=Kolab_Storage
27: */
28: class Horde_Kolab_Storage_List_Query_Share_Base
29: implements Horde_Kolab_Storage_List_Query_Share
30: {
31: /** The folder description */
32: const ANNOTATION_DESCRIPTION = '/shared/comment';
33:
34: /** The share parameters */
35: /** @todo Shouldn't this be private data? */
36: const ANNOTATION_SHARE_PARAMETERS = '/shared/vendor/horde/share-params';
37:
38: /**
39: * The driver for accessing the Kolab storage system.
40: *
41: * @var Horde_Kolab_Storage_Driver
42: */
43: private $_driver;
44:
45: /**
46: * Constructor.
47: *
48: * @param Horde_Kolab_Storage_List $list The queriable list.
49: * @param array $params Additional parameters.
50: */
51: public function __construct(Horde_Kolab_Storage_List $list,
52: $params)
53: {
54: $this->_driver = $list->getDriver();
55: }
56:
57: /**
58: * Returns the share description.
59: *
60: * @param string $folder The folder name.
61: *
62: * @return string The folder/share description.
63: */
64: public function getDescription($folder)
65: {
66: return $this->_driver->getAnnotation(
67: $folder, self::ANNOTATION_DESCRIPTION
68: );
69: }
70:
71: /**
72: * Returns the share parameters.
73: *
74: * @param string $folder The folder name.
75: *
76: * @return string The folder/share parameters.
77: */
78: public function getParameters($folder)
79: {
80: $parameters = $this->_driver->getAnnotation(
81: $folder, self::ANNOTATION_SHARE_PARAMETERS
82: );
83: if (!empty($parameters)) {
84: return unserialize(base64_decode($parameters));
85: } else {
86: return array();
87: }
88: }
89:
90: /**
91: * Set the share description.
92: *
93: * @param string $folder The folder name.
94: * @param string $description The share description.
95: *
96: * @return NULL
97: */
98: public function setDescription($folder, $description)
99: {
100: $this->_driver->setAnnotation(
101: $folder, self::ANNOTATION_DESCRIPTION, $description
102: );
103: }
104:
105: /**
106: * Set the share parameters.
107: *
108: * @param string $folder The folder name.
109: * @param array $parameters The share parameters.
110: *
111: * @return string The encoded share parameters.
112: */
113: public function setParameters($folder, array $parameters)
114: {
115: $this->_driver->setAnnotation(
116: $folder,
117: self::ANNOTATION_SHARE_PARAMETERS,
118: base64_encode(serialize($parameters))
119: );
120: }
121:
122: /**
123: * Create a new folder.
124: *
125: * @param string $folder The path of the folder to create.
126: * @param string $type An optional type for the folder.
127: *
128: * @return NULL
129: */
130: public function createFolder($folder, $type = null)
131: {
132: }
133:
134: /**
135: * Delete a folder.
136: *
137: * @param string $folder The path of the folder to delete.
138: *
139: * @return NULL
140: */
141: public function deleteFolder($folder)
142: {
143: }
144:
145: /**
146: * Rename a folder.
147: *
148: * @param string $old The old path of the folder.
149: * @param string $new The new path of the folder.
150: *
151: * @return NULL
152: */
153: public function renameFolder($old, $new)
154: {
155: }
156:
157: /**
158: * Return the last sync stamp.
159: *
160: * @return string The stamp.
161: */
162: public function getStamp()
163: {
164: return $this->_list->getStamp();
165: }
166:
167: /**
168: * Synchronize the ACL information with the information from the backend.
169: *
170: * @param array $params Additional parameters.
171: *
172: * @return NULL
173: */
174: public function synchronize($params = array())
175: {
176: }
177: }