1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11: class Sesha_Forms_CategoryList extends Horde_Form {
12:
13: function __construct($vars)
14: {
15: parent::__construct($vars);
16:
17:
18: $sesha_driver = $GLOBALS['injector']->getInstance('Sesha_Factory_Driver')->create();
19: $this->setButtons(array(_("Edit Category"),
20: _("Delete Category")));
21: $categories = $sesha_driver->getCategories();
22: $params = array();
23: foreach ($categories as $category) {
24: $params[$category['category_id']] = $category['category'];
25: }
26: $title = !empty($title) ? $title : _("Edit a category");
27: $this->setTitle($title);
28:
29: $this->addHidden('', 'actionID', 'text', false, false, null, array('edit_category'));
30: if (!count($params)) {
31: $fieldtype = 'invalid';
32: $params = _("No categories are currently configured. Use the form below to add one.");
33: } else {
34: $fieldtype = 'enum';
35: }
36: $this->addVariable(_("Category"), 'category_id', $fieldtype, true, false, null, array($params));
37: }
38: }
39: