1: <?php
2: /**
3: * Operator application interface.
4: *
5: * This file defines Horde's core API interface. Other core Horde libraries
6: * can interact with Operator through this API.
7: *
8: * Copyright 2006-2010 Alkaloid Networks (http://projects.alkaloid.net/)
9: *
10: * See the enclosed file LICENSE for license information (BSD). If you did not
11: * did not receive this file, see
12: * http://www.opensource.org/licenses/bsd-license.html.
13: *
14: * @author Ben Klang <ben@alkaloid.net>
15: * @package Operator
16: */
17:
18: if (!defined('OPERATOR_BASE')) {
19: define('OPERATOR_BASE', dirname(__FILE__). '/..');
20: }
21:
22: if (!defined('HORDE_BASE')) {
23: /* If horde does not live directly under the app directory, the HORDE_BASE
24: * constant should be defined in config/horde.local.php. */
25: if (file_exists(OPERATOR_BASE. '/config/horde.local.php')) {
26: include OPERATOR_BASE . '/config/horde.local.php';
27: } else {
28: define('HORDE_BASE', OPERATOR_BASE . '/..');
29: }
30: }
31:
32: /* Load the Horde Framework core (needed to autoload
33: * Horde_Registry_Application::). */
34: require_once HORDE_BASE . '/lib/core.php';
35:
36: class Operator_Application extends Horde_Registry_Application
37: {
38: /**
39: */
40: public $version = 'H4 (1.0-git)';
41:
42: /**
43: * TODO
44: */
45: public $driver = null;
46:
47: /**
48: * Global variables defined:
49: * $cache - TODO
50: */
51: protected function _init()
52: {
53: // Operator backend.
54: $this->driver = Operator_Driver::factory();
55:
56: // Caching system for storing DB results
57: $GLOBALS['cache'] = $GLOBALS['injector']->getInstance('Horde_Cache');
58: }
59:
60: /**
61: */
62: public function perms()
63: {
64: $perms = array(
65: 'accountcodes' => array(
66: 'title' => _("Account Codes")
67: )
68: );
69:
70: $accountcodes = Operator::getAccountCodes();
71: foreach ($accountcodes as $accountcode) {
72: $perms['accountcodes:' . $accountcode] = array(
73: 'title' => $accountcode
74: );
75: }
76:
77: return $perms;
78: }
79:
80: }
81: