1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15: 16: 17: 18:
19: class Kronolith_Form_CreateResourceGroup extends Horde_Form
20: {
21: 22: 23:
24: public function __construct($vars)
25: {
26: parent::__construct($vars, _("Create Resource Group"));
27:
28: $resources = Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, array('type' => Kronolith_Resource::TYPE_SINGLE));
29: $enum = array();
30: foreach ($resources as $resource) {
31: $enum[$resource->getId()] = htmlspecialchars($resource->get('name'));
32: }
33: $this->addVariable(_("Name"), 'name', 'text', true);
34: $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
35: $this->addVariable(_("Resources"), 'members', 'multienum', false, false, null, array('enum' => $enum));
36: $this->setButtons(array(_("Create")));
37: }
38:
39: public function execute()
40: {
41: $new = array('name' => $this->_vars->get('name'),
42: 'description' => $this->_vars->get('description'),
43: 'members' => $this->_vars->get('members'));
44: return Kronolith_Resource::addResource(new Kronolith_Resource_Group($new));
45: }
46:
47: }
48: