00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 class Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main_Formgroup extends Mage_Adminhtml_Block_Widget_Form
00034 {
00035 public function __construct()
00036 {
00037 parent::__construct();
00038 }
00039
00040 protected function _prepareForm()
00041 {
00042 $form = new Varien_Data_Form();
00043
00044 $fieldset = $form->addFieldset('set_fieldset', array('legend'=>Mage::helper('catalog')->__('Add New Group')));
00045
00046 $fieldset->addField('attribute_group_name', 'text',
00047 array(
00048 'label' => Mage::helper('catalog')->__('Name'),
00049 'name' => 'attribute_group_name',
00050 'required' => true,
00051 )
00052 );
00053
00054 $fieldset->addField('submit', 'note',
00055 array(
00056 'text' => $this->getLayout()->createBlock('adminhtml/widget_button')
00057 ->setData(array(
00058 'label' => Mage::helper('catalog')->__('Add Group'),
00059 'onclick' => 'this.form.submit();',
00060 'class' => 'add'
00061 ))
00062 ->toHtml(),
00063 )
00064 );
00065
00066 $fieldset->addField('attribute_set_id', 'hidden',
00067 array(
00068 'name' => 'attribute_set_id',
00069 'value' => $this->_getSetId(),
00070 )
00071
00072 );
00073
00074 $form->setUseContainer(true);
00075 $form->setMethod('post');
00076 $form->setAction($this->getUrl('*/catalog_product_group/save'));
00077 $this->setForm($form);
00078 }
00079
00080 protected function _getSetId()
00081 {
00082 return ( intval($this->getRequest()->getParam('id')) > 0 )
00083 ? intval($this->getRequest()->getParam('id'))
00084 : Mage::getModel('eav/entity_type')
00085 ->load(Mage::registry('entityType'))
00086 ->getDefaultAttributeSetId();
00087 }
00088 }