1: <?php
2: /**
3: * Handles synchronization with the backend.
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 synchronization with the backend.
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_Synchronization
29: {
30: /**
31: * Synchronize the provided list in case the selected synchronization
32: * strategy requires it.
33: *
34: * @param Horde_Kolab_Storage_List $list The list to synchronize.
35: *
36: * @return NULL
37: */
38: public function synchronizeList(Horde_Kolab_Storage_List $list)
39: {
40: $list_id = $list->getId();
41: if (empty($_SESSION['kolab_storage']['synchronization']['list'][$list_id])) {
42: $list->synchronize();
43: $_SESSION['kolab_storage']['synchronization']['list'][$list_id] = true;
44: }
45: }
46:
47: /**
48: * Synchronize the provided data in case the selected synchronization
49: * strategy requires it.
50: *
51: * @param Horde_Kolab_Storage_Data $data The data to synchronize.
52: *
53: * @return NULL
54: */
55: public function synchronizeData(Horde_Kolab_Storage_Data $data)
56: {
57: $data_id = $data->getId();
58: if (empty($_SESSION['kolab_storage']['synchronization']['data'][$data_id])) {
59: $data->synchronize();
60: $_SESSION['kolab_storage']['synchronization']['data'][$data_id] = true;
61: }
62: }
63: }