1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15: 16: 17:
18: class Turba_Form_CreateAddressBook extends Horde_Form
19: {
20: public function __construct($vars)
21: {
22: parent::__construct($vars, _("Create Address Book"));
23:
24: $this->addVariable(_("Name"), 'name', 'text', true);
25: $this->addVariable(_("Description"), 'description', 'longtext', false, false, null, array(4, 60));
26:
27: $this->setButtons(array(_("Create")));
28: }
29:
30: 31: 32:
33: public function execute()
34: {
35:
36: $cfgSources = Turba::availableSources();
37:
38: $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($cfgSources[$GLOBALS['conf']['shares']['source']]);
39:
40: $params = array(
41: 'params' => array('source' => $GLOBALS['conf']['shares']['source']),
42: 'name' => $this->_vars->get('name'),
43: 'desc' => $this->_vars->get('description'),
44: );
45: return $driver->createShare(strval(new Horde_Support_Randomid()), $params);
46: }
47:
48: }
49: