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_Catalog_Product_Edit_Action_Attribute_Tab_Attributes
36: extends Mage_Adminhtml_Block_Catalog_Form
37: implements Mage_Adminhtml_Block_Widget_Tab_Interface
38: {
39: protected function _construct()
40: {
41: parent::_construct();
42: $this->setShowGlobalIcon(true);
43: }
44:
45: protected function _prepareForm()
46: {
47: $this->setFormExcludedFieldList(array(
48: 'tier_price','gallery', 'media_gallery', 'recurring_profile', 'group_price'
49: ));
50: Mage::dispatchEvent('adminhtml_catalog_product_form_prepare_excluded_field_list', array('object'=>$this));
51:
52: $form = new Varien_Data_Form();
53: $fieldset = $form->addFieldset('fields', array('legend'=>Mage::helper('catalog')->__('Attributes')));
54: $attributes = $this->getAttributes();
55: 56: 57: 58:
59: $form->setDataObject(Mage::getModel('catalog/product'));
60: $this->_setFieldset($attributes, $fieldset, $this->getFormExcludedFieldList());
61: $form->setFieldNameSuffix('attributes');
62: $this->setForm($form);
63: }
64:
65: 66: 67: 68: 69:
70: public function getAttributes()
71: {
72: return $this->helper('adminhtml/catalog_product_edit_action_attribute')->getAttributes()->getItems();
73: }
74:
75: 76: 77: 78: 79:
80: protected function _getAdditionalElementTypes()
81: {
82: return array(
83: 'price' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_price'),
84: 'weight' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_weight'),
85: 'image' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_image'),
86: 'boolean' => Mage::getConfig()->getBlockClassName('adminhtml/catalog_product_helper_form_boolean')
87: );
88: }
89:
90: 91: 92: 93: 94: 95:
96: protected function _getAdditionalElementHtml($element)
97: {
98:
99: $nameAttributeHtml = ($element->getExtType() === 'multiple') ? 'name="' . $element->getId() . '_checkbox"'
100: : '';
101: return '<span class="attribute-change-checkbox"><input type="checkbox" id="' . $element->getId()
102: . '-checkbox" ' . $nameAttributeHtml . ' onclick="toogleFieldEditMode(this, \'' . $element->getId()
103: . '\')" /><label for="' . $element->getId() . '-checkbox">' . Mage::helper('catalog')->__('Change')
104: . '</label></span>
105: <script type="text/javascript">initDisableFields(\''.$element->getId().'\')</script>';
106: }
107:
108: 109: 110:
111: public function getTabLabel()
112: {
113: return Mage::helper('catalog')->__('Attributes');
114: }
115:
116: public function getTabTitle()
117: {
118: return Mage::helper('catalog')->__('Attributes');
119: }
120:
121: public function canShowTab()
122: {
123: return true;
124: }
125:
126: public function isHidden()
127: {
128: return false;
129: }
130: }
131: