Overview

Packages

  • Kolab
    • FreeBusy

Classes

  • Horde_Kolab_FreeBusy
  • Horde_Kolab_FreeBusy_Cache
  • Horde_Kolab_FreeBusy_Cache_Base
  • Horde_Kolab_FreeBusy_Cache_DB
  • Horde_Kolab_FreeBusy_Cache_DB_acl
  • Horde_Kolab_FreeBusy_Cache_DB_xacl
  • Horde_Kolab_FreeBusy_Cache_File
  • Horde_Kolab_FreeBusy_Cache_File_acl
  • Horde_Kolab_FreeBusy_Cache_File_pvcal
  • Horde_Kolab_FreeBusy_Cache_File_vcal
  • Horde_Kolab_FreeBusy_Cache_File_xacl
  • Horde_Kolab_FreeBusy_Controller_Base
  • Horde_Kolab_FreeBusy_Controller_MatchDict
  • Horde_Kolab_FreeBusy_Controller_NotFound
  • Horde_Kolab_FreeBusy_Controller_RequestConfiguration
  • Horde_Kolab_FreeBusy_Driver_Base
  • Horde_Kolab_FreeBusy_Driver_Freebusy_Base
  • Horde_Kolab_FreeBusy_Driver_Freebusy_Kolab
  • Horde_Kolab_FreeBusy_Exception
  • Horde_Kolab_FreeBusy_Exception_NotFound
  • Horde_Kolab_FreeBusy_Exception_Unauthorized
  • Horde_Kolab_FreeBusy_Export_Freebusy_Backend_Kolab
  • Horde_Kolab_FreeBusy_Export_Freebusy_Base
  • Horde_Kolab_FreeBusy_Export_Freebusy_Decorator_Log
  • Horde_Kolab_FreeBusy_Factory_Base
  • Horde_Kolab_FreeBusy_Freebusy_Controller_Freebusy
  • Horde_Kolab_FreeBusy_Freebusy_Factory_Base
  • Horde_Kolab_FreeBusy_Freebusy_Factory_Kolab
  • Horde_Kolab_FreeBusy_Freebusy_Helper_Owa
  • Horde_Kolab_FreeBusy_Freebusy_Helper_StatusMap_Config
  • Horde_Kolab_FreeBusy_Freebusy_Helper_StatusMap_Default
  • Horde_Kolab_FreeBusy_Freebusy_Owner_Kolab
  • Horde_Kolab_FreeBusy_Freebusy_Params_Folder
  • Horde_Kolab_FreeBusy_Freebusy_UserDb_Kolab
  • Horde_Kolab_FreeBusy_Object_Event
  • Horde_Kolab_FreeBusy_Owner_Kolab
  • Horde_Kolab_FreeBusy_Params_Freebusy_Resource_Kolab
  • Horde_Kolab_FreeBusy_Params_User
  • Horde_Kolab_FreeBusy_Provider_Local
  • Horde_Kolab_FreeBusy_Provider_Remote
  • Horde_Kolab_FreeBusy_Provider_Remote_PassThrough
  • Horde_Kolab_FreeBusy_Provider_Remote_Redirect
  • Horde_Kolab_FreeBusy_Report
  • Horde_Kolab_FreeBusy_Resource_Decorator_Log
  • Horde_Kolab_FreeBusy_Resource_Decorator_Mcache
  • Horde_Kolab_FreeBusy_Resource_Event_Decorator_Log
  • Horde_Kolab_FreeBusy_Resource_Event_Decorator_Mcache
  • Horde_Kolab_FreeBusy_Resource_Event_Kolab
  • Horde_Kolab_FreeBusy_Resource_Event_Owa
  • Horde_Kolab_FreeBusy_Resource_Kolab
  • Horde_Kolab_FreeBusy_Translation
  • Horde_Kolab_FreeBusy_User_Anonymous
  • Horde_Kolab_FreeBusy_User_Decorator_Log
  • Horde_Kolab_FreeBusy_User_Kolab
  • Horde_Kolab_FreeBusy_UserDb_Kolab
  • Horde_Kolab_FreeBusy_UserDb_User_Kolab
  • Horde_Kolab_FreeBusy_View
  • Horde_Kolab_FreeBusy_View_error
  • Horde_Kolab_FreeBusy_View_vfb

Interfaces

  • Horde_Kolab_FreeBusy_Driver_Freebusy_Interface
  • Horde_Kolab_FreeBusy_Driver_Interface
  • Horde_Kolab_FreeBusy_Export_Freebusy
  • Horde_Kolab_FreeBusy_Export_Freebusy_Backend
  • Horde_Kolab_FreeBusy_Factory
  • Horde_Kolab_FreeBusy_Freebusy_Helper_StatusMap
  • Horde_Kolab_FreeBusy_Freebusy_Owner
  • Horde_Kolab_FreeBusy_Owner
  • Horde_Kolab_FreeBusy_Params_Owner
  • Horde_Kolab_FreeBusy_Params_Resource
  • Horde_Kolab_FreeBusy_Provider
  • Horde_Kolab_FreeBusy_Resource
  • Horde_Kolab_FreeBusy_Resource_Event
  • Horde_Kolab_FreeBusy_User
  • Horde_Kolab_FreeBusy_UserDb
  • Horde_Kolab_FreeBusy_UserDb_User
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * The free/busy Kolab backend.
  4:  *
  5:  * PHP version 5
  6:  *
  7:  * @category Kolab
  8:  * @package  Kolab_FreeBusy
  9:  * @author   Chuck Hagenbuch <chuck@horde.org>
 10:  * @author   Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
 11:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 12:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 13:  * @link     http://pear.horde.org/index.php?package=Kolab_FreeBusy
 14:  */
 15: 
 16: /**
 17:  * The free/busy Kolab backend.
 18:  *
 19:  * Copyright 2004-2008 Klarälvdalens Datakonsult AB
 20:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
 21:  *
 22:  * See the enclosed file COPYING for license information (LGPL). If you did not
 23:  * receive this file, see
 24:  * http://www.horde.org/licenses/lgpl21.
 25:  *
 26:  * @category Kolab
 27:  * @package  Kolab_FreeBusy
 28:  * @author   Chuck Hagenbuch <chuck@horde.org>
 29:  * @author   Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
 30:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 31:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 32:  * @link     http://pear.horde.org/index.php?package=Kolab_FreeBusy
 33:  */
 34: class Horde_Kolab_FreeBusy_Resource_Event_Kolab
 35: extends Horde_Kolab_FreeBusy_Resource_Kolab
 36: implements Horde_Kolab_FreeBusy_Resource_Event
 37: {
 38:     /**
 39:      * Constructor.
 40:      *
 41:      * @param Horde_Kolab_Storage_Folder          $folder The storage folder
 42:      *                                                    representing this
 43:      *                                                    resource.
 44:      * @param Horde_Kolab_FreeBusy_Owner_Freebusy $owner  The resource owner.
 45:      */
 46:     public function __construct(
 47:         Horde_Kolab_Storage_Folder $folder,
 48:         Horde_Kolab_FreeBusy_Owner_Event $owner
 49:     ) {
 50:         if ($folder->getType() != 'event') {
 51:             throw new Horde_Kolab_FreeBusy_Exception(
 52:                 sprintf(
 53:                     'Resource %s has type "%s" not "event"!',
 54:                     $folder->getName(), $folder->getType()
 55:                 )
 56:             );
 57:         }
 58:         parent::__construct($folder, $owner);
 59:     }
 60: 
 61:     /**
 62:      * Return for whom this resource exports relevant data.
 63:      *
 64:      * @return string The user type the exported data of this resource is
 65:      *                relevant for.
 66:      *
 67:      * @throws Horde_Kolab_FreeBusy_Exception If retrieving the relevance
 68:      *                                        information failed.
 69:      */
 70:     public function getRelevance()
 71:     {
 72:         return $this->getFolder()->getKolabAttribute('incidences-for');
 73:     }
 74: 
 75:     /**
 76:      * Fetch the access controls on specific attributes of this
 77:      * resource.
 78:      *
 79:      * @return array Attribute ACL for this resource.
 80:      *
 81:      * @throws Horde_Kolab_FreeBusy_Exception If retrieving the attribute ACL
 82:      *                                        information failed.
 83:      */
 84:     public function getAttributeAcl()
 85:     {
 86:         return $this->getFolder()->getXfbaccess();
 87:     }
 88: 
 89:     /**
 90:      * Lists all events in the given time range.
 91:      *
 92:      * @param Horde_Date $startDate Start of range date object.
 93:      * @param Horde_Date $endDate   End of range data object.
 94:      *
 95:      * @return array Events in the given time range.
 96:      *
 97:      * @throws Horde_Kolab_FreeBusy_Exception If retrieving the events failed.
 98:      */
 99:     public function listEvents(Horde_Date $startDate, Horde_Date $endDate)
100:     {
101:         try {
102:             $objects = $this->getData()->getObjects();
103:         } catch (Horde_Kolab_Storage_Exception $e) {
104:             //todo: prior exception
105:             throw new Horde_Kolab_FreeBusy_Exception($e);
106:         }
107:         $startts = $startDate->timestamp();
108:         $endts = $endDate->timestamp();
109: 
110:         $result = array();
111: 
112:         /**
113:          * PERFORMANCE START
114:          *
115:          * The following section has been performance optimized using
116:          * xdebug and kcachegrind.
117:          *
118:          * If there are many events it takes a lot of time and memory to create
119:          * new objects from the array and use those for time comparison. So the
120:          * code tries to use the original data array as long as possible and
121:          * only converts it to an object if really required (e.g. the event
122:          * actually lies in the time span or it recurs in which case the
123:          * calculations are more complex).
124:          */
125:         foreach($objects as $object) {
126:             /* check if event period intersects with given period */
127:             if (!(($object['start-date'] > $endts) ||
128:                   ($object['end-date'] < $startts))) {
129:                 $result[] = new Horde_Kolab_FreeBusy_Object_Event($object);
130:                 continue;
131:             }
132: 
133:             /* do recurrence expansion if not keeping anyway */
134:             if (isset($object['recurrence'])) {
135:                 $event = new Horde_Kolab_FreeBusy_Object_Event($object);
136:                 if ($event->recursIn($startDate, $endDate)) {
137:                     $result[] = $event;
138:                 }
139:             }
140:         }
141:         /** PERFORMANCE END */
142:          
143:         return $result;
144:     }
145: }
146: 
API documentation generated by ApiGen