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 Kolab implementation of the free/busy system.
  4:  *
  5:  * PHP version 5
  6:  *
  7:  * @category Kolab
  8:  * @package  Kolab_FreeBusy
  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_FreeBusy
 12:  */
 13: 
 14: /**
 15:  * The Horde_Kolab_FreeBusy class holds the Registry aka ServiceLocator for the
 16:  * Free/Busy application. It also provides the entry point into the the Horde
 17:  * MVC system and allows to dispatch a request.
 18:  *
 19:  * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
 20:  *
 21:  * See the enclosed file COPYING for license information (LGPL). If you did not
 22:  * receive this file, see
 23:  * http://www.horde.org/licenses/lgpl21.
 24:  *
 25:  * @category Kolab
 26:  * @package  Kolab_FreeBusy
 27:  * @author   Gunnar Wrobel <wrobel@pardus.de>
 28:  * @license  http://www.horde.org/licenses/lgpl21 LGPL 2.1
 29:  * @link     http://pear.horde.org/index.php?package=Kolab_FreeBusy
 30:  */
 31: class Horde_Kolab_FreeBusy
 32: {
 33:     /**
 34:      * The dependency injection container.
 35:      *
 36:      * @var Horde_Injector
 37:      */
 38:     private $_injector;
 39: 
 40:     /**
 41:      * The backend used for the export.
 42:      *
 43:      * @var string
 44:      */
 45:     private $_backend;
 46: 
 47:     /**
 48:      * The export type.
 49:      *
 50:      * @var string
 51:      */
 52:     private $_export;
 53: 
 54:     /**
 55:      * Class name of the factory.
 56:      *
 57:      * @var string
 58:      */
 59:     private $_factory;
 60: 
 61:     /**
 62:      * Constructor.
 63:      *
 64:      * @param string $type    The export type.
 65:      * @param string $backend The chosen backend.
 66:      * @param array  $params  The parameters required to initialize the
 67:      *                        application.
 68:      * <pre>
 69:      * 'script'  - (string) Script name in relation to the document root.
 70:      *                      [optional]
 71:      *
 72:      * 'config'  - (array)  Indicates where to find configuration options.
 73:      *                      [optional]
 74:      *
 75:      *     'dir'      - (string) Configuration files can be found in this
 76:      *                           directory.
 77:      *
 78:      * 'request' - (array)  Options for the request object. [optional]
 79:      *
 80:      *     'class'    - (string) The class of request object to use (should
 81:      *                           obviously match the request type).
 82:      *     'params'   - (array)  Additional parameters to use on request
 83:      *                           object construction.
 84:      *
 85:      * 'mapper'  - (array)  Options for the mapper object. [optional]
 86:      *
 87:      *     'params'   - (array)  Additional parameters to use on mapper
 88:      *                           object construction.
 89:      *
 90:      * 'request_config'- (array)  Options for the request configuration. [optional]
 91:      *
 92:      *     'prefix' - (string) The class prefix to use for controllers.
 93:      *
 94:      * 'logger'  - (array)  The keys of the array are log handler class names
 95:      *                      (e.g. Horde_Log_Handler_Stream) while the
 96:      *                      corresponding values are arrays. Each such array
 97:      *                      may contain a key 'params' that holds parameters
 98:      *                      passed to the constructor of the log handler. It
 99:      *                      may also hold a second key 'options' with options
100:      *                      passed to the instantiated log handler. [optional]
101:      * 'writer'  - (array)  Options for the response writer object. [optional]
102:      *
103:      *     'class'    - (string) The name of the response writer class.
104:      *
105:      * 'owner'  - (array)  Options for the data owner. [optional]
106:      *
107:      *     'domain'   - (string) The domain that will be assumed for
108:      *                           domainless owners.
109:      *
110:      * 'provider'     - (array)  Options for the data provider. [optional]
111:      *
112:      *     'server'   - (string) The URL that will be considered to be
113:      *                           provided locally rather than redirecting
114:      *                           to a remote server.
115:      *     'redirect' - (boolean) Should non-local requests be redirected
116:      *                            to the remote server or should the data
117:      *                            be fetched and passed through?
118:      * 'injector' - (Horde_Injector) An outside injector that allows to
119:      *                               inject arbitrary instance replacements.
120:      *                               [optional]
121:      *
122:      * </pre>
123:      */
124:     public function __construct($type, $backend, $params = array())
125:     {
126:         if (!isset($params['injector'])) {
127:             $this->_injector = new Horde_Injector(
128:                 new Horde_Injector_TopLevel()
129:             );
130:         } else {
131:             $this->_injector = $params['injector'];
132:         }
133: 
134:         $this->set(
135:             'Horde_Kolab_FreeBusy_Configuration',
136:             $params
137:         );
138: 
139:         $this->_export = $type;
140:         $this->_backend = $backend;
141:         $this->_factory = 'Horde_Kolab_FreeBusy_' . $type . '_Factory_' . $backend;
142: 
143:         $this->bindings();
144: 
145:         $this->_injector->setInstance('Horde_Kolab_FreeBusy', $this);
146:     }
147: 
148:     /**
149:      * Setup the basic injector bindings.
150:      *
151:      * @return NULL
152:      */
153:     public function bindings()
154:     {
155:         $this->_injector->bindImplementation(
156:             'Horde_Kolab_FreeBusy_Factory', $this->_factory
157:         );
158:         $this->_injector->bindFactory(
159:             'Horde_Routes_Mapper', $this->_factory, 'createMapper'
160:         );
161:         $this->_injector->bindFactory(
162:             'Horde_Kolab_FreeBusy_Controller_RequestConfiguration',
163:             $this->_factory,
164:             'createRequestConfiguration'
165:         );
166:         $this->_injector->bindFactory(
167:             'Horde_Controller_Request', $this->_factory, 'createRequest'
168:         );
169:         $this->_injector->bindFactory(
170:             'Horde_View_Base', $this->_factory, 'createView'
171:         );
172:         $this->_injector->bindFactory(
173:             'Horde_Controller_ResponseWriter',
174:             $this->_factory,
175:             'createResponseWriter'
176:         );
177:         $this->_injector->bindFactory(
178:             'Horde_Log_Logger', $this->_factory, 'createLogger'
179:         );
180:         $this->_injector->bindFactory(
181:             'Horde_Kolab_FreeBusy_User', $this->_factory, 'createUser'
182:         );
183:         $this->_injector->bindFactory(
184:             'Horde_Kolab_FreeBusy_Owner', $this->_factory, 'createOwner'
185:         );
186:         $this->_injector->bindFactory(
187:             'Horde_Kolab_FreeBusy_Resource', $this->_factory, 'createResource'
188:         );
189:         $this->_injector->bindFactory(
190:             'Horde_Kolab_FreeBusy_Provider', $this->_factory, 'createProvider'
191:         );
192:     }
193: 
194:     /**
195:      * Return the backend the application uses for the export.
196:      *
197:      * @return string The backend used for the export.
198:      */
199:     public function getBackend()
200:     {
201:         return $this->_backend;
202:     }
203: 
204:     /**
205:      * Return the export type.
206:      *
207:      * @return string The export type.
208:      */
209:     public function getExportType()
210:     {
211:         return $this->_export;
212:     }
213: 
214:     /**
215:      * Get an element.
216:      *
217:      * @param string $interface The element to retrieve.
218:      *
219:      * @return mixed The element.
220:      */
221:     public function get($interface)
222:     {
223:         return $this->_injector->getInstance($interface);
224:     }
225: 
226:     /**
227:      * Set an element to the given value.
228:      *
229:      * @param string $interface The element to set.
230:      * @param mixed  $instance  The value to set the element to.
231:      *
232:      * @return NULL
233:      */
234:     public function set($interface, $instance)
235:     {
236:         return $this->_injector->setInstance($interface, $instance);
237:     }
238: 
239:     /**
240:      * Handle the current request.
241:      *
242:      * @return NULL
243:      */
244:     public function dispatch()
245:     {
246:         try {
247:             $this->get('Horde_Controller_ResponseWriter')->writeResponse(
248:                 $this->get('Horde_Controller_Runner')->execute(
249:                     $this->_injector,
250:                     $this->get('Horde_Controller_Request'),
251:                     $this->get('Horde_Kolab_FreeBusy_Controller_RequestConfiguration')
252:                 )
253:             );
254:         } catch (Exception $e) {
255:             $this->_injector->bindFactory(
256:                 'Horde_Controller_ResponseWriter',
257:                 'Horde_Kolab_FreeBusy_Factory_Base',
258:                 'createResponseWriter'
259:             );
260:             $response = $this->_injector->createInstance('Horde_Controller_Response');
261:             $response->setHeaders(array('Status' => '404 Not Found', 'HTTP/1.0' => '404 Not Found'));
262:             $response->setBody($e->getMessage());
263:             $this->get('Horde_Controller_ResponseWriter')->writeResponse(
264:                 $response
265:             );
266:         }
267:     }
268: }
269: 
API documentation generated by ApiGen