1: <?php
2: /**
3: * The basic decorator definition for Kolab folders.
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: * The basic decorator definition for Kolab folders.
16: *
17: * Copyright 2010-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: * @author Gunnar Wrobel <wrobel@pardus.de>
23: * @package Kolab_Storage
24: */
25: class Horde_Kolab_Storage_Folder_Decorator_Base
26: implements Horde_Kolab_Storage_Folder
27: {
28:
29: /**
30: * The decorated folder.
31: *
32: * @var Horde_Kolab_Storage_Folder
33: */
34: protected $_folder;
35:
36: /**
37: * Constructor
38: *
39: * @param Horde_Kolab_Storage_Folder $folder The folder to be decorated.
40: */
41: public function __construct(Horde_Kolab_Storage_Folder $folder)
42: {
43: $this->_folder = $folder;
44: }
45:
46: /**
47: * Return the storage path of the folder.
48: *
49: * @return string The storage path of the folder.
50: */
51: public function getPath()
52: {
53: return $this->_folder->getPath();
54: }
55:
56: /**
57: * Returns a readable title for this folder.
58: *
59: * @return string The folder title.
60: */
61: public function getTitle()
62: {
63: return $this->_folder->getTitle();
64: }
65:
66: /**
67: * Return the namespace of the folder.
68: *
69: * @return string The namespace of the folder.
70: */
71: public function getNamespace()
72: {
73: return $this->_folder->getNamespace();
74: }
75:
76: /**
77: * Return the namespace prefix of the folder.
78: *
79: * @since Horde_Kolab_Storage 1.1.0
80: *
81: * @return string The namespace prefix of the folder.
82: */
83: public function getPrefix()
84: {
85: return $this->_folder->getPrefix();
86: }
87:
88: /**
89: * Returns the owner of the folder.
90: *
91: * @return string The owner of this folder.
92: */
93: public function getOwner()
94: {
95: return $this->_folder->getOwner();
96: }
97:
98: /**
99: * Returns the folder path without namespace components.
100: *
101: * @return string The subpath of this folder.
102: */
103: public function getSubpath()
104: {
105: return $this->_folder->getSubpath();
106: }
107:
108: /**
109: * Returns the folder parent.
110: *
111: * @return string The parent of this folder.
112: */
113: public function getParent()
114: {
115: return $this->_folder->getParent();
116: }
117:
118: /**
119: * Is this a default folder?
120: *
121: * @return boolean Boolean that indicates the default status.
122: */
123: public function isDefault()
124: {
125: return $this->_folder->isDefault();
126: }
127:
128:
129:
130: /**
131: * Set a new storage path for the folder. The new path will be
132: * realized when saving the folder.
133: *
134: * @param string $path The new folder path.
135: */
136: public function setPath($path)
137: {
138: $this->_folder->setPath($path);
139: }
140:
141: /**
142: * Set a new title for the folder. The new title will be realized when
143: * saving the folder.
144: *
145: * @param string $title The new folder title.
146: * @param string $namespace The new namespace of the folder.
147: *
148: * @return NULL
149: */
150: public function setTitle($title)
151: {
152: $this->_folder->setTitle($title);
153: }
154:
155: /**
156: * Set a new title for the folder and assign it to the namespace of other
157: * users. The new title will be realized when saving the folder.
158: *
159: * @param string $title The new folder title.
160: * @param string $owner The new owner of the folder.
161: *
162: * @return NULL
163: */
164: public function setTitleInOther($title, $owner)
165: {
166: $this->_folder->setTitleInOther($title, $owner);
167: }
168:
169: /**
170: * Set a new title for the folder and assign it to the shared namespace. The
171: * new title will be realized when saving the folder.
172: *
173: * @param string $title The new folder title.
174: *
175: * @return NULL
176: */
177: public function setTitleInShared($title)
178: {
179: $this->_folder->setTitleInShared($title);
180: }
181:
182: /**
183: * Retrieve the driver for this folder.
184: *
185: * @return Horde_Kolab_Storage_Driver The folder driver.
186: */
187: public function getDriver()
188: {
189: return $this->_folder->getDriver();
190: }
191:
192: /**
193: * Get the permissions for this folder.
194: *
195: * @return Horde_Kolab_Storage_Folder_Permission The permission handler.
196: */
197: public function getPermission()
198: {
199: return $this->_folder->getPermission();
200: }
201:
202: /**
203: * Sets the permissions on this folder.
204: *
205: * @param Horde_Kolab_Storage_Folder_Permission $perms Permission object.
206: * @param boolean $update Save the updated
207: * information?
208: *
209: * @return NULL
210: */
211: public function setPermission(Horde_Kolab_Storage_Folder_Permission $perms,
212: $update = true)
213: {
214: $this->_folder->setPermission($perms, $update);
215: }
216:
217: /**
218: * Saves the folder.
219: *
220: * @param array $attributes An array of folder attributes. You can
221: * set any attribute but there are a few
222: * special ones like 'type', 'default',
223: * 'owner' and 'desc'.
224: *
225: * @return NULL
226: */
227: public function save($attributes = null)
228: {
229: $this->_folder->save($attributes);
230: }
231:
232: /**
233: * Delete the specified message from this folder.
234: *
235: * @param string $id IMAP id of the message to be deleted.
236: * @param boolean $trigger Should the folder be triggered?
237: *
238: * @return NULL
239: */
240: public function deleteMessage($id, $trigger = true)
241: {
242: $this->_folder->deleteMessage($id, $trigger);
243: }
244:
245: /**
246: * Move the specified message to the specified folder.
247: *
248: * @param string $id IMAP id of the message to be moved.
249: * @param string $folder Name of the receiving folder.
250: *
251: * @return boolean True if successful.
252: */
253: public function moveMessage($id, $folder)
254: {
255: $this->_folder->moveMessage($id, $folder);
256: }
257:
258: /**
259: * Move the specified message to the specified share.
260: *
261: * @param string $id IMAP id of the message to be moved.
262: * @param string $share Name of the receiving share.
263: *
264: * @return NULL
265: */
266: public function moveMessageToShare($id, $share)
267: {
268: $this->_folder->moveMessageToShare($id, $share);
269: }
270:
271: /**
272: * Save an object in this folder.
273: *
274: * @param array $object The array that holds the data of the object.
275: * @param int $data_version The format handler version.
276: * @param string $object_type The type of the kolab object.
277: * @param string $id The IMAP id of the old object if it
278: * existed before
279: * @param array $old_object The array that holds the current data of the
280: * object.
281: *
282: * @return boolean True on success.
283: */
284: public function saveObject(&$object, $data_version, $object_type, $id = null,
285: &$old_object = null)
286: {
287: $this->_folder->saveObject($object, $data_version, $object_type, $id, $old_object = null);
288: }
289:
290: /**
291: * Return the IMAP ACL of this folder.
292: *
293: * @return array An array with IMAP ACL.
294: */
295: public function getAcl()
296: {
297: return $this->_folder->getAcl();
298: }
299:
300: /**
301: * Set the ACL of this folder.
302: *
303: * @param $user The user for whom the ACL should be set.
304: * @param $acl The new ACL value.
305: *
306: * @return NULL
307: */
308: public function setAcl($user, $acl)
309: {
310: $this->_folder->setAcl($user, $acl);
311: }
312:
313: /**
314: * Delete the ACL for a user on this folder.
315: *
316: * @param $user The user for whom the ACL should be deleted.
317: *
318: * @return NULL
319: */
320: public function deleteAcl($user)
321: {
322: $this->_folder->deleteAcl($user);
323: }
324:
325: }
326: