Protected Member Functions | |
_prepareForm () |
Definition at line 26 of file Useredit.php.
_prepareForm | ( | ) | [protected] |
Prepare form before rendering HTML
Reimplemented from Mage_Adminhtml_Block_Widget_Form.
Definition at line 29 of file Useredit.php.
00030 { 00031 $form = new Varien_Data_Form(); 00032 00033 $user = Mage::registry('user_data'); 00034 00035 $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Account Information'))); 00036 00037 $fieldset->addField('username', 'text', 00038 array( 00039 'name' => 'username', 00040 'label' => Mage::helper('adminhtml')->__('User Name'), 00041 'id' => 'username', 00042 'title' => Mage::helper('adminhtml')->__('User Name'), 00043 'class' => 'required-entry', 00044 'required' => true, 00045 ) 00046 ); 00047 00048 $fieldset->addField('firstname', 'text', 00049 array( 00050 'name' => 'firstname', 00051 'label' => Mage::helper('adminhtml')->__('First Name'), 00052 'id' => 'firstname', 00053 'title' => Mage::helper('adminhtml')->__('First Name'), 00054 'class' => 'required-entry', 00055 'required' => true, 00056 ) 00057 ); 00058 00059 $fieldset->addField('lastname', 'text', 00060 array( 00061 'name' => 'lastname', 00062 'label' => Mage::helper('adminhtml')->__('Last Name'), 00063 'id' => 'lastname', 00064 'title' => Mage::helper('adminhtml')->__('Last Name'), 00065 'class' => 'required-entry', 00066 'required' => true, 00067 ) 00068 ); 00069 00070 $fieldset->addField('user_id', 'hidden', 00071 array( 00072 'name' => 'user_id', 00073 'id' => 'user_id', 00074 ) 00075 ); 00076 00077 $fieldset->addField('email', 'text', 00078 array( 00079 'name' => 'email', 00080 'label' => Mage::helper('adminhtml')->__('Email'), 00081 'id' => 'customer_email', 00082 'title' => Mage::helper('adminhtml')->__('User Email'), 00083 'class' => 'required-entry validate-email', 00084 'required' => true, 00085 ) 00086 ); 00087 00088 if ($user->getUserId()) { 00089 $fieldset->addField('password', 'password', 00090 array( 00091 'name' => 'new_password', 00092 'label' => Mage::helper('adminhtml')->__('New Password'), 00093 'id' => 'new_pass', 00094 'title' => Mage::helper('adminhtml')->__('New Password'), 00095 'class' => 'input-text validate-password', 00096 ) 00097 ); 00098 00099 $fieldset->addField('confirmation', 'password', 00100 array( 00101 'name' => 'password_confirmation', 00102 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 00103 'id' => 'confirmation', 00104 'class' => 'input-text validate-cpassword', 00105 ) 00106 ); 00107 } 00108 else { 00109 $fieldset->addField('password', 'password', 00110 array( 00111 'name' => 'password', 00112 'label' => Mage::helper('adminhtml')->__('Password'), 00113 'id' => 'customer_pass', 00114 'title' => Mage::helper('adminhtml')->__('Password'), 00115 'class' => 'input-text required-entry validate-password', 00116 'required' => true, 00117 ) 00118 ); 00119 $fieldset->addField('confirmation', 'password', 00120 array( 00121 'name' => 'password_confirmation', 00122 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 00123 'id' => 'confirmation', 00124 'title' => Mage::helper('adminhtml')->__('Password Confirmation'), 00125 'class' => 'input-text required-entry validate-cpassword', 00126 'required' => true, 00127 ) 00128 ); 00129 } 00130 00131 $fieldset->addField('is_active', 'select', 00132 array( 00133 'name' => 'is_active', 00134 'label' => Mage::helper('adminhtml')->__('This account is'), 00135 'id' => 'is_active', 00136 'title' => Mage::helper('adminhtml')->__('Account status'), 00137 'class' => 'input-select', 00138 'required' => false, 00139 'style' => 'width: 80px', 00140 'value' => '1', 00141 'values' => array( 00142 array( 00143 'label' => Mage::helper('adminhtml')->__('Active'), 00144 'value' => '1', 00145 ), 00146 array( 00147 'label' => Mage::helper('adminhtml')->__('Inactive'), 00148 'value' => '0', 00149 ), 00150 ), 00151 ) 00152 ); 00153 00154 $data = $user->getData(); 00155 00156 unset($data['password']); 00157 00158 $form->setValues($data); 00159 00160 $this->setForm($form); 00161 }