1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34:
35: class Mage_Adminhtml_Block_System_Account_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
36: {
37: protected function _prepareForm()
38: {
39: $userId = Mage::getSingleton('admin/session')->getUser()->getId();
40: $user = Mage::getModel('admin/user')
41: ->load($userId);
42: $user->unsetData('password');
43:
44: $form = new Varien_Data_Form();
45:
46: $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('adminhtml')->__('Account Information')));
47:
48: $fieldset->addField('username', 'text', array(
49: 'name' => 'username',
50: 'label' => Mage::helper('adminhtml')->__('User Name'),
51: 'title' => Mage::helper('adminhtml')->__('User Name'),
52: 'required' => true,
53: )
54: );
55:
56: $fieldset->addField('firstname', 'text', array(
57: 'name' => 'firstname',
58: 'label' => Mage::helper('adminhtml')->__('First Name'),
59: 'title' => Mage::helper('adminhtml')->__('First Name'),
60: 'required' => true,
61: )
62: );
63:
64: $fieldset->addField('lastname', 'text', array(
65: 'name' => 'lastname',
66: 'label' => Mage::helper('adminhtml')->__('Last Name'),
67: 'title' => Mage::helper('adminhtml')->__('Last Name'),
68: 'required' => true,
69: )
70: );
71:
72: $fieldset->addField('user_id', 'hidden', array(
73: 'name' => 'user_id',
74: )
75: );
76:
77: $fieldset->addField('email', 'text', array(
78: 'name' => 'email',
79: 'label' => Mage::helper('adminhtml')->__('Email'),
80: 'title' => Mage::helper('adminhtml')->__('User Email'),
81: 'required' => true,
82: )
83: );
84:
85: $fieldset->addField('password', 'password', array(
86: 'name' => 'new_password',
87: 'label' => Mage::helper('adminhtml')->__('New Password'),
88: 'title' => Mage::helper('adminhtml')->__('New Password'),
89: 'class' => 'input-text validate-admin-password',
90: )
91: );
92:
93: $fieldset->addField('confirmation', 'password', array(
94: 'name' => 'password_confirmation',
95: 'label' => Mage::helper('adminhtml')->__('Password Confirmation'),
96: 'class' => 'input-text validate-cpassword',
97: )
98: );
99:
100: $form->setValues($user->getData());
101: $form->setAction($this->getUrl('*/system_account/save'));
102: $form->setMethod('post');
103: $form->setUseContainer(true);
104: $form->setId('edit_form');
105:
106: $this->setForm($form);
107:
108: return parent::_prepareForm();
109: }
110: }
111: