1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: class Whups_Form_Admin_AddAttribute extends Horde_Form
15: {
16: public function __construct(&$vars)
17: {
18: parent::__construct($vars, _("Add Attribute"));
19:
20: $this->addHidden('', 'type', 'int', true, true);
21: $this->addVariable(_("Attribute Name"), 'attribute_name', 'text', true);
22: $this->addVariable(
23: _("Attribute Description"), 'attribute_description', 'text', true);
24: $this->addVariable(
25: _("Required Attribute?"), 'attribute_required', 'boolean', false);
26:
27: $v = &$this->addVariable(
28: _("Attribute Type"), 'attribute_type', 'enum', true, false, null,
29: array(Whups::fieldTypeNames()));
30: $v->setDefault('text');
31: $v->setAction(
32: Horde_Form_Action::factory(
33: array('whups', 'whups_reload'),
34: array('formname' => 'whups_form_admin_addattribute_reload')));
35:
36: $type = $vars->get('attribute_type');
37: if (empty($type)) {
38: $type = 'text';
39: }
40: foreach (Whups::fieldTypeParams($type) as $param => $info) {
41: $this->addVariable(
42: $info['label'], 'attribute_params[' . $param . ']', $info['type'],
43: false);
44: }
45: }
46:
47: }