Protected Member Functions | |
_prepareLayout () |
Definition at line 34 of file Form.php.
_prepareLayout | ( | ) | [protected] |
Prepare form for render
Reimplemented from Mage_Adminhtml_Block_Widget_Form.
Definition at line 39 of file Form.php.
00040 { 00041 parent::_prepareLayout(); 00042 $form = new Varien_Data_Form(); 00043 $customerGroup = Mage::registry('current_group'); 00044 00045 $fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('customer')->__('Group Information'))); 00046 00047 $name = $fieldset->addField('customer_group_code', 'text', 00048 array( 00049 'name' => 'code', 00050 'label' => Mage::helper('customer')->__('Group Name'), 00051 'title' => Mage::helper('customer')->__('Group Name'), 00052 'class' => 'required-entry', 00053 'required' => true, 00054 ) 00055 ); 00056 00057 if ($customerGroup->getId()==0 && $customerGroup->getCustomerGroupCode() ) { 00058 $name->setDisabled(true); 00059 } 00060 00061 $fieldset->addField('tax_class_id', 'select', 00062 array( 00063 'name' => 'tax_class', 00064 'label' => Mage::helper('customer')->__('Tax class'), 00065 'title' => Mage::helper('customer')->__('Tax class'), 00066 'class' => 'required-entry', 00067 'required' => true, 00068 'values' => Mage::getSingleton('tax/class_source_customer')->toOptionArray() 00069 ) 00070 ); 00071 00072 if (!is_null($customerGroup->getId())) { 00073 // If edit add id 00074 $form->addField('id', 'hidden', 00075 array( 00076 'name' => 'id', 00077 'value' => $customerGroup->getId(), 00078 ) 00079 ); 00080 } 00081 00082 if( Mage::getSingleton('adminhtml/session')->getCustomerGroupData() ) { 00083 $form->addValues(Mage::getSingleton('adminhtml/session')->getCustomerGroupData()); 00084 Mage::getSingleton('adminhtml/session')->setCustomerGroupData(null); 00085 } else { 00086 $form->addValues($customerGroup->getData()); 00087 } 00088 00089 $form->setUseContainer(true); 00090 $form->setId('edit_form'); 00091 $form->setAction($this->getUrl('*/*/save')); 00092 $this->setForm($form); 00093 }