1: <?php
2: /**
3: * Representation of a Kolab server object.
4: *
5: * PHP version 5
6: *
7: * @category Kolab
8: * @package Kolab_Server
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_Server
12: */
13:
14: /**
15: * This class provides methods to deal with the Kolab server configuration
16: * object.
17: *
18: * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
19: *
20: * See the enclosed file COPYING for license information (LGPL). If you
21: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
22: *
23: * @category Kolab
24: * @package Kolab_Server
25: * @author Gunnar Wrobel <wrobel@pardus.de>
26: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
27: * @link http://pear.horde.org/index.php?package=Kolab_Server
28: */
29: class Horde_Kolab_Server_Object_Kolab extends Horde_Kolab_Server_Object_Groupofnames
30: {
31: /** Define attributes specific to this object type */
32:
33: /** The name attribute for this type of object class */
34: const ATTRIBUTE_K = 'k';
35:
36: /**
37: * How many days into the past should the free/busy data on the server be
38: * calculated?
39: */
40: const ATTRIBUTE_FBPAST = 'kolabFreeBusyPast';
41:
42: /** The specific object class of this object type */
43: const OBJECTCLASS_KOLAB = 'kolab';
44:
45: /**
46: * A structure to initialize the attribute structure for this class.
47: *
48: * @var array
49: */
50: static public $init_attributes = array(
51: 'defined' => array(
52: self::ATTRIBUTE_K,
53: self::ATTRIBUTE_FBPAST,
54: ),
55: 'object_classes' => array(
56: self::OBJECTCLASS_KOLAB,
57: ),
58: );
59:
60: /**
61: * Return the filter string to retrieve this object type.
62: *
63: * @return string The filter to retrieve this object type from the server
64: * database.
65: */
66: public static function getFilter()
67: {
68: $criteria = array('AND' => array(
69: array('field' => self::ATTRIBUTE_K,
70: 'op' => '=',
71: 'test' => 'kolab'),
72: array('field' => self::ATTRIBUTE_OC,
73: 'op' => '=',
74: 'test' => self::OBJECTCLASS_KOLAB),
75: ),
76: );
77: return $criteria;
78: }
79:
80: /**
81: * Generates an ID for the given information.
82: *
83: * @param array &$info The data of the object.
84: *
85: * @static
86: *
87: * @return string|PEAR_Error The ID.
88: */
89: public function generateId(array &$info)
90: {
91: return self::ATTRIBUTE_K . '=kolab';
92: }
93: }
94: