1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15: 16: 17:
18: class Turba_Form_EditAddressBook extends Horde_Form
19: {
20: 21: 22: 23: 24:
25: protected $_addressbook;
26:
27: public function __construct($vars, Horde_Share_Object $addressbook)
28: {
29: $this->_addressbook = $addressbook;
30: parent::__construct($vars, sprintf(_("Edit %s"), $addressbook->get('name')));
31:
32: $this->addHidden('', 'a', 'text', true);
33: $this->addVariable(_("Name"), 'name', 'text', true);
34: $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
35:
36: $this->setButtons(array(_("Save")));
37: }
38:
39: public function execute()
40: {
41: $this->_addressbook->set('name', $this->_vars->get('name'));
42: $this->_addressbook->set('desc', $this->_vars->get('description'));
43: try {
44: $this->_addressbook->save();
45: return true;
46: } catch (Horde_Share_Exception $e) {
47: throw new Turba_Exception(sprintf(_("Unable to save address book \"%s\": %s"), $this->_vars->get('name'), $e->getMessage()));
48: }
49: }
50:
51: }
52: