1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13: class Sam_Form_List extends Horde_Form
14: {
15: protected $_attributes = array();
16:
17: public function __construct($vars, $title)
18: {
19: parent::__construct($vars, $title);
20: $this->setButtons(_("Save"), true);
21:
22: try {
23: $sam_driver = $GLOBALS['injector']->getInstance('Sam_Driver');
24: } catch (Sam_Exception $e) {
25: return;
26: }
27:
28: foreach ($this->_attributes as $key => $attribute) {
29: if (!$sam_driver->hasCapability($key)) {
30: continue;
31: }
32:
33: $var = $this->addVariable($attribute, $key, 'longtext',
34: false, false, null,
35: array('5', '40'));
36: $var->setHelp($key);
37:
38: if (!$vars->exists($key)) {
39: $vars->set($key, $sam_driver->getListOption($key));
40: }
41: }
42:
43: if ($sam_driver->hasCapability('global_defaults') &&
44: $GLOBALS['registry']->isAdmin()) {
45: $this->addVariable('', '', 'spacer', false);
46: $var = $this->addVariable(_("Make Settings Global"),
47: 'global_defaults', 'boolean', false);
48: $var->setHelp('global_defaults');
49: }
50: }
51: }
52: