Mage_Adminhtml_Block_Api_User_Edit_Tab_Main Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Api_User_Edit_Tab_Main:

Mage_Adminhtml_Block_Widget_Form Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _prepareForm ()


Detailed Description

Definition at line 35 of file Main.php.


Member Function Documentation

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 38 of file Main.php.

00039     {
00040         $model = Mage::registry('api_user');
00041 
00042         $form = new Varien_Data_Form();
00043 
00044         $form->setHtmlIdPrefix('user_');
00045 
00046         $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Account Information')));
00047 
00048         if ($model->getUserId()) {
00049             $fieldset->addField('user_id', 'hidden', array(
00050                 'name' => 'user_id',
00051             ));
00052         } else {
00053             if (! $model->hasData('is_active')) {
00054                 $model->setIsActive(1);
00055             }
00056         }
00057 
00058         $fieldset->addField('username', 'text', array(
00059             'name'  => 'username',
00060             'label' => Mage::helper('adminhtml')->__('User Name'),
00061             'id'    => 'username',
00062             'title' => Mage::helper('adminhtml')->__('User Name'),
00063             'required' => true,
00064         ));
00065 
00066         $fieldset->addField('firstname', 'text', array(
00067             'name'  => 'firstname',
00068             'label' => Mage::helper('adminhtml')->__('First Name'),
00069             'id'    => 'firstname',
00070             'title' => Mage::helper('adminhtml')->__('First Name'),
00071             'required' => true,
00072         ));
00073 
00074         $fieldset->addField('lastname', 'text', array(
00075             'name'  => 'lastname',
00076             'label' => Mage::helper('adminhtml')->__('Last Name'),
00077             'id'    => 'lastname',
00078             'title' => Mage::helper('adminhtml')->__('Last Name'),
00079             'required' => true,
00080         ));
00081 
00082         $fieldset->addField('email', 'text', array(
00083             'name'  => 'email',
00084             'label' => Mage::helper('adminhtml')->__('Email'),
00085             'id'    => 'customer_email',
00086             'title' => Mage::helper('adminhtml')->__('User Email'),
00087             'class' => 'required-entry validate-email',
00088             'required' => true,
00089         ));
00090 
00091         if ($model->getUserId()) {
00092             $fieldset->addField('password', 'password', array(
00093                 'name'  => 'new_api_key',
00094                 'label' => Mage::helper('adminhtml')->__('New Api Key'),
00095                 'id'    => 'new_pass',
00096                 'title' => Mage::helper('adminhtml')->__('New Api Key'),
00097                 'class' => 'input-text validate-password',
00098             ));
00099 
00100             $fieldset->addField('confirmation', 'password', array(
00101                 'name'  => 'api_key_confirmation',
00102                 'label' => Mage::helper('adminhtml')->__('Api Key Confirmation'),
00103                 'id'    => 'confirmation',
00104                 'class' => 'input-text validate-cpassword',
00105             ));
00106         }
00107         else {
00108            $fieldset->addField('password', 'password', array(
00109                 'name'  => 'api_key',
00110                 'label' => Mage::helper('adminhtml')->__('Api Key'),
00111                 'id'    => 'customer_pass',
00112                 'title' => Mage::helper('adminhtml')->__('Api Key'),
00113                 'class' => 'input-text required-entry validate-password',
00114                 'required' => true,
00115             ));
00116            $fieldset->addField('confirmation', 'password', array(
00117                 'name'  => 'api_key_confirmation',
00118                 'label' => Mage::helper('adminhtml')->__('Api Key Confirmation'),
00119                 'id'    => 'confirmation',
00120                 'title' => Mage::helper('adminhtml')->__('Api Key Confirmation'),
00121                 'class' => 'input-text required-entry validate-cpassword',
00122                 'required' => true,
00123             ));
00124         }
00125 
00126         if (Mage::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
00127             $fieldset->addField('is_active', 'select', array(
00128                 'name'      => 'is_active',
00129                 'label'     => Mage::helper('adminhtml')->__('This account is'),
00130                 'id'        => 'is_active',
00131                 'title'     => Mage::helper('adminhtml')->__('Account status'),
00132                 'class'     => 'input-select',
00133                 'style'     => 'width: 80px',
00134                 'options'   => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive')),
00135             ));
00136         }
00137 
00138         $fieldset->addField('user_roles', 'hidden', array(
00139             'name' => 'user_roles',
00140             'id'   => '_user_roles',
00141         ));
00142 
00143         $data = $model->getData();
00144 
00145         unset($data['password']);
00146 
00147         $form->setValues($data);
00148 
00149         $this->setForm($form);
00150 
00151         return parent::_prepareForm();
00152     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:42 2009 for Magento by  doxygen 1.5.8