1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16:
17: if (!defined('ULAFORM_BASE')) {
18: define('ULAFORM_BASE', dirname(__FILE__) . '/..');
19: }
20:
21: if (!defined('HORDE_BASE')) {
22: 23:
24: if (file_exists(ULAFORM_BASE . '/config/horde.local.php')) {
25: include ULAFORM_BASE . '/config/horde.local.php';
26: } else {
27: define('HORDE_BASE', ULAFORM_BASE . '/..');
28: }
29: }
30:
31: 32:
33: require_once HORDE_BASE . '/lib/core.php';
34:
35: class Ulaform_Application extends Horde_Registry_Application
36: {
37: public $version = 'H4 (1.0-git)';
38:
39: 40: 41: 42:
43: protected function _init()
44: {
45: $GLOBALS['ulaform_driver'] = new Ulaform_Driver($GLOBALS['injector']->getInstance('Horde_Db_Adapter'));
46: }
47:
48: 49: 50: 51: 52:
53: public function perms()
54: {
55: $perms['forms'] = array(
56: 'title' => _("Forms")
57: );
58:
59: try {
60: foreach ($GLOBALS['injector']->getInstance('Ulaform_Factory_Driver')->create()->getAvailableForms() as $form) {
61: $perms['forms:' . $form['form_id']] = array(
62: 'title' => $form['form_name'],
63: );
64: }
65: } catch (Ulaform_Exception $e) {}
66:
67: return $perms;
68: }
69:
70: 71: 72:
73: public function ($menu)
74: {
75: $menu->setMask(Horde_Menu::MASK_ALL & ~Horde_Menu::MASK_PREFS);
76:
77: $menu->add(Horde::url('forms.php'), _("_List Forms"), 'ulaform.png');
78: $menu->add(Horde::url('edit.php'), _("_New Form"), 'new.png');
79: }
80:
81: }
82: