Overview

Packages

  • None
  • Vilma

Classes

  • Vilma
  • Vilma_Api
  • Vilma_Driver
  • Vilma_Driver_Qmailldap
  • Vilma_Driver_Sql
  • Vilma_Form_DeleteDomain
  • Vilma_Form_EditAlias
  • Vilma_Form_EditDomain
  • Vilma_Form_EditForward
  • Vilma_Form_EditUser
  • Vilma_MailboxDriver
  • Vilma_MailboxDriver_Hooks
  • Vilma_MailboxDriver_Imap
  • Vilma_MailboxDriver_Maildrop
  • Vilma_MailboxDriver_Null
  • Vilma_Test
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Copyright 2006-2007 Alkaloid Networks <http://www.alkaloid.net>
 4:  *
 5:  * See the enclosed file LICENSE for license information (BSD). If you did
 6:  * did not receive this file, see http://cvs.horde.org/co.php/vilma/LICENSE.
 7:  *
 8:  * @author  Ben Klang <ben@alkaloid.net>
 9:  * @package Vilma
10:  */
11: class Vilma_Form_EditUser extends Horde_Form
12: {
13:     public function __construct($vars)
14:     {
15:         $type = $vars->get('type');
16:         $editing = $vars->get('mode') == 'edit';
17:         switch ($type) {
18:         case 'group':
19:             $title = sprintf(_("Edit Group for \"%s\""), $vars->get('domain'));
20:             $name = _("Group Name");
21:             break;
22:         case 'forward':
23:             $title = sprintf(_("Edit Forward for \"%s\""), $vars->get('domain'));
24:             $name = _("Forward Name");
25:             break;
26:         default:
27:             $title = sprintf(_("Edit User for \"%s\""), $vars->get('domain'));
28:             $name = _("User Name");
29:             break;
30:         }
31:         if (!$editing) {
32:             $title = sprintf(_("New User @%s"), $vars->get('domain'));
33:         }
34:         parent::Horde_Form($vars, $title);
35: 
36:         /* Set up the form. */
37:         $this->setButtons(true, true);
38:         $this->addHidden('', 'address', 'text', false);
39:         $this->addHidden('', 'mode', 'text', false);
40:         $this->addHidden('', 'domain', 'text', false);
41:         $this->addHidden('', 'id', 'text', false);
42:         if ($editing) {
43:             $this->addHidden('', 'user_name', 'text', false);
44:         }
45:         $this->addVariable($name, 'user_name', 'text', true, $editing, _("Name must begin with an alphanumeric character, must contain only alphanumeric and '._-' characters, and must end with an alphanumeric character."), array('~^[a-zA-Z0-9]{1,1}[a-zA-Z0-9._-]*[a-zA-Z0-9]$~'));
46:         if ($editing) {
47:             $this->addVariable(_("Password"), 'password', 'passwordconfirm', false, false, _("Only enter a password if you wish to change this user's password"));
48:         } else {
49:             $this->addVariable(_("Password"), 'password', 'passwordconfirm', true);
50:         }
51:         $this->addVariable(_("Full Name"), 'user_full_name', 'text', true);
52:         $attrs = $GLOBALS['vilma']->driver->getUserFormAttributes();
53:         foreach ($attrs as $attr) {
54:             $v = $this->addVariable($attr['label'], $attr['name'],
55:                                     $attr['type'], $attr['required'],
56:                                     $attr['readonly'], $attr['description'],
57:                                     $attr['params']);
58:             if (isset($attr['default'])) {
59:                 $v->setDefault($attr['default']);
60:             }
61:         }
62:     }
63: }
64: 
API documentation generated by ApiGen