Overview

Packages

  • Kolab
    • Server

Classes

  • Horde_Kolab_Server_Composite
  • Horde_Kolab_Server_Connection_File
  • Horde_Kolab_Server_Connection_Mock
  • Horde_Kolab_Server_Connection_Mock_Ldap
  • Horde_Kolab_Server_Connection_Mock_Search
  • Horde_Kolab_Server_Connection_Simpleldap
  • Horde_Kolab_Server_Connection_Splittedldap
  • Horde_Kolab_Server_Decorator_Clean
  • Horde_Kolab_Server_Decorator_Count
  • Horde_Kolab_Server_Decorator_Log
  • Horde_Kolab_Server_Decorator_Map
  • Horde_Kolab_Server_Exception
  • Horde_Kolab_Server_Exception_Bindfailed
  • Horde_Kolab_Server_Exception_Novalue
  • Horde_Kolab_Server_Factory
  • Horde_Kolab_Server_Ldap
  • Horde_Kolab_Server_Ldap_Changes
  • Horde_Kolab_Server_Ldap_Filtered
  • Horde_Kolab_Server_Ldap_Standard
  • Horde_Kolab_Server_List_Base
  • Horde_Kolab_Server_Object_Attribute_Base
  • Horde_Kolab_Server_Object_Attribute_Createtimestamp
  • Horde_Kolab_Server_Object_Attribute_Createtimestampdate
  • Horde_Kolab_Server_Object_Attribute_Decorator
  • Horde_Kolab_Server_Object_Attribute_Default
  • Horde_Kolab_Server_Object_Attribute_Empty
  • Horde_Kolab_Server_Object_Attribute_External
  • Horde_Kolab_Server_Object_Attribute_Field
  • Horde_Kolab_Server_Object_Attribute_Firstnamelastname
  • Horde_Kolab_Server_Object_Attribute_Guid
  • Horde_Kolab_Server_Object_Attribute_Id
  • Horde_Kolab_Server_Object_Attribute_Internal
  • Horde_Kolab_Server_Object_Attribute_Locked
  • Horde_Kolab_Server_Object_Attribute_Modifytimestamp
  • Horde_Kolab_Server_Object_Attribute_Modifytimestampdate
  • Horde_Kolab_Server_Object_Attribute_Objectclass
  • Horde_Kolab_Server_Object_Attribute_Openldapaci
  • Horde_Kolab_Server_Object_Attribute_Required
  • Horde_Kolab_Server_Object_Attribute_Single
  • Horde_Kolab_Server_Object_Attribute_Value
  • Horde_Kolab_Server_Object_Attribute_Writelock
  • Horde_Kolab_Server_Object_Base
  • Horde_Kolab_Server_Object_Factory
  • Horde_Kolab_Server_Object_Groupofnames
  • Horde_Kolab_Server_Object_Hash
  • Horde_Kolab_Server_Object_Inetorgperson
  • Horde_Kolab_Server_Object_Kolab
  • Horde_Kolab_Server_Object_Kolab_Address
  • Horde_Kolab_Server_Object_Kolab_Administrator
  • Horde_Kolab_Server_Object_Kolab_Adminrole
  • Horde_Kolab_Server_Object_Kolab_Distlist
  • Horde_Kolab_Server_Object_Kolab_Domainmaintainer
  • Horde_Kolab_Server_Object_Kolab_Maintainer
  • Horde_Kolab_Server_Object_Kolab_User
  • Horde_Kolab_Server_Object_Kolabgermanbankarrangement
  • Horde_Kolab_Server_Object_Kolabgroupofnames
  • Horde_Kolab_Server_Object_Kolabinetorgperson
  • Horde_Kolab_Server_Object_Kolabpop3account
  • Horde_Kolab_Server_Object_Kolabsharedfolder
  • Horde_Kolab_Server_Object_Mcached
  • Horde_Kolab_Server_Object_Organizationalperson
  • Horde_Kolab_Server_Object_Person
  • Horde_Kolab_Server_Object_Top
  • Horde_Kolab_Server_Objects_Base
  • Horde_Kolab_Server_Query_Element_And
  • Horde_Kolab_Server_Query_Element_Approx
  • Horde_Kolab_Server_Query_Element_Begins
  • Horde_Kolab_Server_Query_Element_Contains
  • Horde_Kolab_Server_Query_Element_Ends
  • Horde_Kolab_Server_Query_Element_Equals
  • Horde_Kolab_Server_Query_Element_Greater
  • Horde_Kolab_Server_Query_Element_Group
  • Horde_Kolab_Server_Query_Element_Less
  • Horde_Kolab_Server_Query_Element_Mapped
  • Horde_Kolab_Server_Query_Element_Not
  • Horde_Kolab_Server_Query_Element_Or
  • Horde_Kolab_Server_Query_Element_Single
  • Horde_Kolab_Server_Query_Ldap
  • Horde_Kolab_Server_Result_Ldap
  • Horde_Kolab_Server_Schema_Base
  • Horde_Kolab_Server_Schema_Decorator_Cache
  • Horde_Kolab_Server_Search_Base
  • Horde_Kolab_Server_Search_Operation_Addressesforuidormail
  • Horde_Kolab_Server_Search_Operation_Attributes
  • Horde_Kolab_Server_Search_Operation_Base
  • Horde_Kolab_Server_Search_Operation_Children
  • Horde_Kolab_Server_Search_Operation_Constraint_Single
  • Horde_Kolab_Server_Search_Operation_Constraint_Strict
  • Horde_Kolab_Server_Search_Operation_Groupsformember
  • Horde_Kolab_Server_Search_Operation_Guid
  • Horde_Kolab_Server_Search_Operation_Guidforalias
  • Horde_Kolab_Server_Search_Operation_Guidforcn
  • Horde_Kolab_Server_Search_Operation_Guidforkolabusers
  • Horde_Kolab_Server_Search_Operation_Guidformail
  • Horde_Kolab_Server_Search_Operation_Guidformailoralias
  • Horde_Kolab_Server_Search_Operation_Guidforuid
  • Horde_Kolab_Server_Search_Operation_Guidforuidormail
  • Horde_Kolab_Server_Search_Operation_Guidforuidormailoralias
  • Horde_Kolab_Server_Search_Operation_Mailforuidormail
  • Horde_Kolab_Server_Search_Operation_Restrictgroups
  • Horde_Kolab_Server_Search_Operation_Restrictkolab
  • Horde_Kolab_Server_Structure_Attribute_Double
  • Horde_Kolab_Server_Structure_Attribute_Value
  • Horde_Kolab_Server_Structure_Base
  • Horde_Kolab_Server_Structure_Kolab
  • Horde_Kolab_Server_Structure_Ldap

Interfaces

  • Horde_Kolab_Server_Connection_Interface
  • Horde_Kolab_Server_Interface
  • Horde_Kolab_Server_List_Interface
  • Horde_Kolab_Server_Object_Attribute_Interface
  • Horde_Kolab_Server_Object_Interface
  • Horde_Kolab_Server_Object_Searches
  • Horde_Kolab_Server_Objects_Interface
  • Horde_Kolab_Server_Query_Element_Interface
  • Horde_Kolab_Server_Query_Interface
  • Horde_Kolab_Server_Result_Interface
  • Horde_Kolab_Server_Schema_Interface
  • Horde_Kolab_Server_Search_Interface
  • Horde_Kolab_Server_Search_Operation_Interface
  • Horde_Kolab_Server_Structure_Attribute_Interface
  • Horde_Kolab_Server_Structure_Interface
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * A simple structural handler for a tree of objects.
  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:  * An abstract class definiing methods to deal with an object tree structure.
 16:  *
 17:  * Copyright 2009-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_Server
 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_Server
 27:  */
 28: abstract class Horde_Kolab_Server_Structure_Base
 29: implements Horde_Kolab_Server_Structure_Interface
 30: {
 31:     /** Maximum accepted level for the object class hierarchy */
 32:     const MAX_HIERARCHY = 100;
 33: 
 34:     /**
 35:      * A link to the composite server handler.
 36:      *
 37:      * @var Horde_Kolab_Server_Composite
 38:      */
 39:     private $_composite;
 40: 
 41:     /**
 42:      * Finds object data matching a given set of criteria.
 43:      *
 44:      * @param Horde_Kolab_Server_Query_Element $criteria The criteria for the search.
 45:      * @param array                            $params   Additional search parameters.
 46:      *
 47:      * @return Horde_Kolab_Server_Result The result object.
 48:      *
 49:      * @throws Horde_Kolab_Server_Exception
 50:      */
 51:     public function find(
 52:         Horde_Kolab_Server_Query_Element_Interface $criteria,
 53:         array $params = array()
 54:     ) {
 55:         $query = new Horde_Kolab_Server_Query_Ldap($criteria, $this);
 56:         return $this->_composite->server->find(
 57:             (string) $query, $params
 58:         );
 59:     }
 60: 
 61:     /**
 62:      * Finds all object data below a parent matching a given set of criteria.
 63:      *
 64:      * @param Horde_Kolab_Server_Query_Element $criteria The criteria for the search.
 65:      * @param string                           $parent   The parent to search below.
 66:      * @param array                            $params   Additional search parameters.
 67:      *
 68:      * @return Horde_Kolab_Server_Result The result object.
 69:      *
 70:      * @throws Horde_Kolab_Server_Exception
 71:      */
 72:     public function findBelow(
 73:         Horde_Kolab_Server_Query_Element_Interface $criteria,
 74:         $parent,
 75:         array $params = array()
 76:     ) {
 77:         $query = new Horde_Kolab_Server_Query_Ldap($criteria, $this);
 78:         return $this->_composite->server->findBelow(
 79:             (string) $query, $parent, $params
 80:         );
 81:     }
 82: 
 83:     /**
 84:      * Set the composite server reference for this object.
 85:      *
 86:      * @param Horde_Kolab_Server_Composite $composite A link to the composite
 87:      *                                                server handler.
 88:      *
 89:      * @return NULL
 90:      */
 91:     public function setComposite(
 92:         Horde_Kolab_Server_Composite $composite
 93:     ) {
 94:         $this->_composite = $composite;
 95:     }
 96: 
 97:     /**
 98:      * Get the composite server reference for this object.
 99:      *
100:      * @return Horde_Kolab_Server_Composite A link to the composite server
101:      *                                      handler.
102:      */
103:     public function getComposite()
104:     {
105:         return $this->_composite;
106:     }
107: 
108:     /**
109:      * Return the attributes supported by the given object class.
110:      *
111:      * @param string $class Determine the attributes for this class.
112:      *
113:      * @return array The supported attributes.
114:      *
115:      * @throws Horde_Kolab_Server_Exception If the schema analysis fails.
116:      */
117:     public function getExternalAttributes($class)
118:     {
119:         $childclass = get_class($class);
120:         $classes    = array();
121:         $level      = 0;
122:         while ($childclass != 'Horde_Kolab_Server_Object_Top'
123:                && $level < self::MAX_HIERARCHY) {
124:             $classes[]  = $childclass;
125:             $childclass = get_parent_class($childclass);
126:             $level++;
127:         }
128: 
129:         /** Finally add the basic object class */
130:         $classes[] = $childclass;
131: 
132:         //@todo: Throw exception here
133:         if ($level == self::MAX_HIERARCHY) {
134:             if (isset($this->logger)) {
135:                 $logger->err(sprintf('The maximal level of the object hierarchy has been exceeded for class \"%s\"!',
136:                                      $class));
137:             }
138:         }
139: 
140:         /**
141:          * Collect attributes from bottom to top.
142:          */
143:         $classes = array_reverse($classes);
144: 
145:         $attributes = array();
146: 
147:         foreach ($classes as $childclass) {
148:             $vars = get_class_vars($childclass);
149:             if (isset($vars['attributes'])) {
150:                 $attributes = array_merge($vars['attributes'], $attributes);
151:             }
152:         }
153: 
154:         return $attributes;
155:     }
156: 
157: 
158:     public function getInternalAttributes($class)
159:     {
160:         return $this->mapExternalToInternalAttributes(
161:             $this->getExternalAttributes($class)
162:         );
163:     }
164: 
165:     public function getInternalAttributesForExternal($class, $external)
166:     {
167:         return $this->mapExternalToInternalAttributes((array) $external);
168:     }
169: }
170: 
API documentation generated by ApiGen