Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Product_Attribute_Set_Main:

Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getGroupTreeHtml ()
 getSetFormHtml ()
 getMoveUrl ()
 getGroupUrl ()
 getGroupTreeJson ()
 getAttributeTreeJson ()
 getBackButtonHtml ()
 getResetButtonHtml ()
 getSaveButtonHtml ()
 getDeleteButtonHtml ()
 getDeleteGroupButton ()
 getAddGroupButton ()
 getRenameButton ()
 getIsCurrentSetDefault ()

Protected Member Functions

 _construct ()
 _prepareLayout ()
 _getHeader ()
 _getSetId ()
 _getSetData ()


Detailed Description

Definition at line 33 of file Main.php.


Member Function Documentation

_construct (  )  [protected]

Internal constructor, that is called from real constructor

Please override this one instead of overriding real __construct constructor

Please override this one instead of overriding real __construct constructor

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 35 of file Main.php.

00036     {
00037         $this->setTemplate('catalog/product/attribute/set/main.phtml');
00038     }

_getHeader (  )  [protected]

Definition at line 119 of file Main.php.

00120     {
00121         return Mage::helper('catalog')->__("Edit Attribute Set '%s'", $this->_getSetData()->getAttributeSetName());
00122     }

_getSetData (  )  [protected]

Definition at line 291 of file Main.php.

00292     {
00293         return Mage::getModel('eav/entity_attribute_set')->load( $this->_getSetId() );
00294     }

_getSetId (  )  [protected]

Definition at line 273 of file Main.php.

00274     {
00275         return Mage::registry('current_attribute_set')->getId();
00276     }

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 40 of file Main.php.

00041     {
00042         $setId = $this->_getSetId();
00043 
00044         $this->setChild('group_tree',
00045             $this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_main_tree_group')
00046         );
00047 
00048         $this->setChild('edit_set_form',
00049             $this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_main_formset')
00050         );
00051 
00052         $this->setChild('delete_group_button',
00053             $this->getLayout()->createBlock('adminhtml/widget_button')
00054                 ->setData(array(
00055                     'label'     => Mage::helper('catalog')->__('Delete Selected Group'),
00056                     'onclick'   => 'editSet.submit();',
00057                     'class' => 'delete'
00058         )));
00059 
00060         $this->setChild('add_group_button',
00061             $this->getLayout()->createBlock('adminhtml/widget_button')
00062                 ->setData(array(
00063                     'label'     => Mage::helper('catalog')->__('Add New'),
00064                     'onclick'   => 'editSet.addGroup();',
00065                     'class' => 'add'
00066         )));
00067 
00068         $this->setChild('back_button',
00069             $this->getLayout()->createBlock('adminhtml/widget_button')
00070                 ->setData(array(
00071                     'label'     => Mage::helper('catalog')->__('Back'),
00072                     'onclick'   => 'setLocation(\''.$this->getUrl('*/*/').'\')',
00073                     'class' => 'back'
00074         )));
00075 
00076         $this->setChild('reset_button',
00077             $this->getLayout()->createBlock('adminhtml/widget_button')
00078                 ->setData(array(
00079                     'label'     => Mage::helper('catalog')->__('Reset'),
00080                     'onclick'   => 'window.location.reload()'
00081         )));
00082 
00083         $this->setChild('save_button',
00084             $this->getLayout()->createBlock('adminhtml/widget_button')
00085                 ->setData(array(
00086                     'label'     => Mage::helper('catalog')->__('Save Attribute Set'),
00087                     'onclick'   => 'editSet.save();',
00088                     'class' => 'save'
00089         )));
00090 
00091         $this->setChild('delete_button',
00092             $this->getLayout()->createBlock('adminhtml/widget_button')
00093                 ->setData(array(
00094                     'label'     => Mage::helper('catalog')->__('Delete Attribute Set'),
00095                     'onclick'   => 'deleteConfirm(\''. $this->jsQuoteEscape(Mage::helper('catalog')->__('All products of this set will be deleted! Are you sure you want to delete this attribute set?')) . '\', \'' . $this->getUrl('*/*/delete', array('id' => $setId)) . '\')',
00096                     'class' => 'delete'
00097         )));
00098 
00099         $this->setChild('rename_button',
00100             $this->getLayout()->createBlock('adminhtml/widget_button')
00101                 ->setData(array(
00102                     'label'     => Mage::helper('catalog')->__('New Set Name'),
00103                     'onclick'   => 'editSet.rename()'
00104                 ))
00105         );
00106         return parent::_prepareLayout();
00107     }

getAddGroupButton (  ) 

Definition at line 263 of file Main.php.

00264     {
00265         return $this->getChildHtml('add_group_button');
00266     }

getAttributeTreeJson (  ) 

Definition at line 188 of file Main.php.

00189     {
00190         $setId = $this->_getSetId();
00191 
00192         $attributesIdsObj = Mage::getModel('eav/entity_attribute')
00193                             ->getResourceCollection()
00194                             ->setAttributeSetFilter($setId)
00195                             ->load();
00196         $attributesIds = array('0');
00197         foreach( $attributesIdsObj->getItems() as $item ) {
00198             $attributesIds[] = $item->getAttributeId();
00199         }
00200         $attributes = Mage::getModel('eav/entity_attribute')
00201                             ->getResourceCollection()
00202                             ->setEntityTypeFilter(Mage::registry('entityType'))
00203                             ->setAttributesExcludeFilter($attributesIds)
00204                             ->addVisibleFilter()
00205                             ->load();
00206 
00207         $items = array();
00208         foreach( $attributes as $node ) {
00209             $item = array();
00210             $item['text']= $node->getAttributeCode();
00211             $item['id']  = $node->getAttributeId();
00212             $item['cls'] = 'leaf';
00213             $item['allowDrop'] = false;
00214             $item['allowDrag'] = true;
00215             $item['leaf'] = true;
00216             $item['is_user_defined'] = $node->getIsUserDefined();
00217             $item['is_used_in_configurable'] = false;
00218 
00219             $items[] = $item;
00220         }
00221 
00222         if( count($items) == 0 ) {
00223             $items[] = array(
00224                 'text' => Mage::helper('catalog')->__('Empty'),
00225                 'id' => 'empty',
00226                 'cls' => 'folder',
00227                 'allowDrop' => false,
00228                 'allowDrag' => false,
00229             );
00230         }
00231 
00232         return Zend_Json::encode($items);
00233     }

getBackButtonHtml (  ) 

Definition at line 235 of file Main.php.

00236     {
00237         return $this->getChildHtml('back_button');
00238     }

getDeleteButtonHtml (  ) 

Definition at line 250 of file Main.php.

00251     {
00252         if ($this->getIsCurrentSetDefault()) {
00253             return '';
00254         }
00255         return $this->getChildHtml('delete_button');
00256     }

getDeleteGroupButton (  ) 

Definition at line 258 of file Main.php.

00259     {
00260         return $this->getChildHtml('delete_group_button');
00261     }

getGroupTreeHtml (  ) 

Definition at line 109 of file Main.php.

00110     {
00111         return $this->getChildHtml('group_tree');
00112     }

getGroupTreeJson (  ) 

TODO: issue #5126

See also:
Mage_Eav_Model_Mysql4_Entity_Attribute_Collection

Definition at line 134 of file Main.php.

00135     {
00136         $setId = $this->_getSetId();
00137 
00138         $groups = Mage::getModel('eav/entity_attribute_group')
00139                     ->getResourceCollection()
00140                     ->setAttributeSetFilter($setId)
00141                     ->load();
00142 
00143         $items = array();
00144         foreach( $groups as $node ) {
00145             $item = array();
00146             $item['text']= $node->getAttributeGroupName();
00147             $item['id']  = $node->getAttributeGroupId();
00148             $item['cls'] = 'folder';
00149             $item['allowDrop'] = true;
00150             $item['allowDrag'] = true;
00151 
00152             $nodeChildren = Mage::getModel('eav/entity_attribute')
00153                                 ->getResourceCollection()
00154                                 ->setAttributeGroupFilter($node->getAttributeGroupId())
00155                                 ->addVisibleFilter()
00156                                 /**
00157                                  * TODO: issue #5126
00158                                  * @see Mage_Eav_Model_Mysql4_Entity_Attribute_Collection
00159                                  */
00160                                 ->checkConfigurableProducts()
00161                                 ->load();
00162 
00163             if ( $nodeChildren->getSize() > 0 ) {
00164                 $item['children'] = array();
00165                 foreach( $nodeChildren->getItems() as $child ) {
00166                     $tmpArr = array();
00167                     $tmpArr['text'] = $child->getAttributeCode();
00168                     $tmpArr['id']  = $child->getAttributeId();
00169                     $tmpArr['cls'] = ( $child->getIsUserDefined() == 0 ) ? 'system-leaf' : 'leaf';
00170                     $tmpArr['allowDrop'] = false;
00171                     $tmpArr['allowDrag'] = true;
00172                     $tmpArr['leaf'] = true;
00173                     $tmpArr['is_user_defined'] = $child->getIsUserDefined();
00174                     // TODO: issue #5126. Template already has reuqired changes
00175                     $tmpArr['is_used_in_configurable'] = false; // (bool)$child->getIsUsedInConfigurable(); // TODO: issue #5126
00176                     $tmpArr['entity_id'] = $child->getEntityAttributeId();
00177 
00178                     $item['children'][] = $tmpArr;
00179                 }
00180             }
00181 
00182             $items[] = $item;
00183         }
00184 
00185         return Zend_Json::encode($items);
00186     }

getGroupUrl (  ) 

Definition at line 129 of file Main.php.

00130     {
00131         return $this->getUrl('*/catalog_product_group/save', array('id' => $this->_getSetId()));
00132     }

getIsCurrentSetDefault (  ) 

Definition at line 278 of file Main.php.

00279     {
00280         $isDefault = $this->getData('is_current_set_default');
00281         if (is_null($isDefault)) {
00282             $defaultSetId = Mage::getModel('eav/entity_type')
00283                 ->load(Mage::registry('entityType'))
00284                 ->getDefaultAttributeSetId();
00285             $isDefault = $this->_getSetId() == $defaultSetId;
00286             $this->setData('is_current_set_default', $isDefault);
00287         }
00288         return $isDefault;
00289     }

getMoveUrl (  ) 

Definition at line 124 of file Main.php.

00125     {
00126         return $this->getUrl('*/catalog_product_set/save', array('id' => $this->_getSetId()));
00127     }

getRenameButton (  ) 

Definition at line 268 of file Main.php.

00269     {
00270         return $this->getChildHtml('rename_button');
00271     }

getResetButtonHtml (  ) 

Definition at line 240 of file Main.php.

00241     {
00242         return $this->getChildHtml('reset_button');
00243     }

getSaveButtonHtml (  ) 

Definition at line 245 of file Main.php.

00246     {
00247         return $this->getChildHtml('save_button');
00248     }

getSetFormHtml (  ) 

Definition at line 114 of file Main.php.

00115     {
00116         return $this->getChildHtml('edit_set_form');
00117     }


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

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