1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: class Whups_Form_Admin_AddUser extends Horde_Form
16: {
17:
18: public function __construct(&$vars)
19: {
20: parent::Horde_Form($vars, _("Add Users"));
21:
22: $this->addHidden('', 'queue', 'int', true, true);
23:
24: global $conf, $whups_driver;
25:
26: $auth = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Auth')->create();
27: if ($auth->hasCapability('list')) {
28: $queue = $vars->get('queue');
29: $current = $whups_driver->getQueueUsers($queue);
30:
31: try {
32: $list = $auth->listUsers();
33: sort($list);
34: $users = array();
35: foreach ($list as $user) {
36: if (!isset($current[$user])) {
37: $users[$user] = $GLOBALS['registry']->convertUsername($user, false);
38: }
39: }
40: $this->addVariable(_("User"), 'user', 'multienum', true, false, null, array($users));
41: } catch (Horde_Auth_Exception $e) {
42: $this->addVariable(
43: _("User"), 'user', 'invalid', true, false, null,
44: array(sprintf(_("There was an error listing users: %s; %s"), $list->getMessage(), $list->getUserInfo())));
45: }
46: } else {
47: $this->addVariable(_("User"), 'user', 'text', true);
48: }
49: }
50:
51: }