1: <?php
2: /**
3: * Handles a active sync 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 active sync 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: * @since Horde_Kolab_Storage 1.1.0
23: *
24: * @category Kolab
25: * @package Kolab_Storage
26: * @author Gunnar Wrobel <wrobel@pardus.de>
27: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
28: * @link http://pear.horde.org/index.php?package=Kolab_Storage
29: */
30: class Horde_Kolab_Storage_List_Query_ActiveSync_Base
31: implements Horde_Kolab_Storage_List_Query_ActiveSync
32: {
33: /** The active sync parameters */
34: /** @todo Shouldn't this be private data? */
35: const ANNOTATION_ACTIVE_SYNC = '/priv/vendor/kolab/activesync';
36:
37: /**
38: * The driver for accessing the Kolab storage system.
39: *
40: * @var Horde_Kolab_Storage_Driver
41: */
42: private $_driver;
43:
44: /**
45: * Constructor.
46: *
47: * @param Horde_Kolab_Storage_List $list The queriable list.
48: * @param array $params Additional parameters.
49: */
50: public function __construct(Horde_Kolab_Storage_List $list,
51: $params)
52: {
53: $this->_driver = $list->getDriver();
54: }
55:
56: /**
57: * Returns the active sync settings.
58: *
59: * @param string $folder The folder name.
60: *
61: * @return array The folder active sync parameters.
62: */
63: public function getActiveSync($folder)
64: {
65: return json_decode(
66: base64_decode(
67: $this->_driver->getAnnotation(
68: $folder, self::ANNOTATION_ACTIVE_SYNC
69: )
70: ),
71: true
72: );
73: }
74:
75: /**
76: * Set the active sync settings.
77: *
78: * @param string $folder The folder name.
79: * @param array $data The active sync settings.
80: *
81: * @return string The encoded share parameters.
82: */
83: public function setActiveSync($folder, array $data)
84: {
85: $this->_driver->setAnnotation(
86: $folder,
87: self::ANNOTATION_ACTIVE_SYNC,
88: base64_encode(json_encode($data))
89: );
90: }
91:
92: /**
93: * Create a new folder.
94: *
95: * @param string $folder The path of the folder to create.
96: * @param string $type An optional type for the folder.
97: *
98: * @return NULL
99: */
100: public function createFolder($folder, $type = null)
101: {
102: }
103:
104: /**
105: * Delete a folder.
106: *
107: * @param string $folder The path of the folder to delete.
108: *
109: * @return NULL
110: */
111: public function deleteFolder($folder)
112: {
113: }
114:
115: /**
116: * Rename a folder.
117: *
118: * @param string $old The old path of the folder.
119: * @param string $new The new path of the folder.
120: *
121: * @return NULL
122: */
123: public function renameFolder($old, $new)
124: {
125: }
126:
127: /**
128: * Return the last sync stamp.
129: *
130: * @return string The stamp.
131: */
132: public function getStamp()
133: {
134: return $this->_list->getStamp();
135: }
136:
137: /**
138: * Synchronize the ACL information with the information from the backend.
139: *
140: * @param array $params Additional parameters.
141: *
142: * @return NULL
143: */
144: public function synchronize($params = array())
145: {
146: }
147: }