Mage_Adminhtml_Block_Catalog_Category_Tabs Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Category_Tabs:

Mage_Adminhtml_Block_Widget_Tabs Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getCategory ()
 getCatalogHelper ()
 getAttributeTabBlock ()

Protected Member Functions

 _prepareLayout ()

Protected Attributes

 $_attributeTabBlock = 'adminhtml/catalog_category_tab_attributes'


Detailed Description

Definition at line 34 of file Tabs.php.


Constructor & Destructor Documentation

__construct (  ) 

Initialize Tabs

Reimplemented from Varien_Object.

Definition at line 47 of file Tabs.php.

00048     {
00049         parent::__construct();
00050         $this->setId('category_info_tabs');
00051         $this->setDestElementId('category_tab_content');
00052         $this->setTitle(Mage::helper('catalog')->__('Category Data'));
00053         $this->setTemplate('widget/tabshoriz.phtml');
00054     }


Member Function Documentation

_prepareLayout (  )  [protected]

Prepare Layout Content

Returns:
Mage_Adminhtml_Block_Catalog_Category_Tabs

Todo:
Adding tab in observer

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 94 of file Tabs.php.

00095     {
00096         $categoryAttributes = $this->getCategory()->getAttributes();
00097         $attributeSetId     = $this->getCategory()->getDefaultAttributeSetId();
00098         $groupCollection    = Mage::getResourceModel('eav/entity_attribute_group_collection')
00099             ->setAttributeSetFilter($attributeSetId)
00100             ->load();
00101         $defaultGroupId = 0;
00102         foreach ($groupCollection as $group) {
00103             /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
00104             if ($defaultGroupId == 0 or $group->getIsDefault()) {
00105                 $defaultGroupId = $group->getId();
00106             }
00107         }
00108 
00109         foreach ($groupCollection as $group) {
00110             /* @var $group Mage_Eav_Model_Entity_Attribute_Group */
00111             $attributes = array();
00112             foreach ($categoryAttributes as $attribute) {
00113                 /* @var $attribute Mage_Eav_Model_Entity_Attribute */
00114                 if ($attribute->isInGroup($attributeSetId, $group->getId())) {
00115                     $attributes[] = $attribute;
00116                 }
00117             }
00118 
00119             // do not add grops without attributes
00120             if (!$attributes) {
00121                 continue;
00122             }
00123 
00124             $active  = $defaultGroupId == $group->getId();
00125             $block = $this->getLayout()->createBlock($this->getAttributeTabBlock(), '')
00126                 ->setGroup($group)
00127                 ->setAttributes($attributes)
00128                 ->setAddHiddenFields($active)
00129                 ->toHtml();
00130             $this->addTab('group_' . $group->getId(), array(
00131                 'label'     => Mage::helper('catalog')->__($group->getAttributeGroupName()),
00132                 'content'   => $block,
00133                 'active'    => $active
00134             ));
00135         }
00136 
00137 //        $this->addTab('general', array(
00138 //            'label'     => Mage::helper('catalog')->__('General Information'),
00139 //            'content'   => $this->getLayout()->createBlock('adminhtml/catalog_category_tab_general')->toHtml(),
00140 //            'active'    => true
00141 //        ));
00142 
00143         $this->addTab('products', array(
00144             'label'     => Mage::helper('catalog')->__('Category Products'),
00145             'content'   => $this->getLayout()->createBlock('adminhtml/catalog_category_tab_product', 'category.product.grid')->toHtml(),
00146         ));
00147 
00148         // dispatch event add custom tabs
00149         Mage::dispatchEvent('adminhtml_catalog_category_tabs', array(
00150             'tabs'  => $this
00151         ));
00152 
00153         /**
00154          * @todo Adding tab in observer
00155          */
00156         if (Mage::app()->getConfig()->getModuleConfig('Mage_GoogleOptimizer')->is('active', true)
00157             && Mage::helper('googleoptimizer')->isOptimizerActive($this->getCategory()->getStoreId())) {
00158             $this->addTab('googleoptimizer', array(
00159                 'label'     => Mage::helper('googleoptimizer')->__('Category View Optimization'),
00160                 'content'   => $this->getLayout()->createBlock('googleoptimizer/adminhtml_catalog_category_edit_tab_googleoptimizer')->toHtml(),
00161             ));
00162         }
00163 
00164         /*$this->addTab('features', array(
00165             'label'     => Mage::helper('catalog')->__('Feature Products'),
00166             'content'   => 'Feature Products'
00167         ));        */
00168         return parent::_prepareLayout();
00169     }

getAttributeTabBlock (  ) 

Getting attribute block name for tabs

Returns:
string

Definition at line 81 of file Tabs.php.

00082     {
00083         if ($block = $this->getCatalogHelper()->getCategoryAttributeTabBlock()) {
00084             return $block;
00085         }
00086         return $this->_attributeTabBlock;
00087     }

getCatalogHelper (  ) 

Return Adminhtml Catalog Helper

Returns:
Mage_Adminhtml_Helper_Catalog

Definition at line 71 of file Tabs.php.

00072     {
00073         return Mage::helper('adminhtml/catalog');
00074     }

getCategory (  ) 

Retrieve cattegory object

Returns:
Mage_Catalog_Model_Category

Definition at line 61 of file Tabs.php.

00062     {
00063         return Mage::registry('current_category');
00064     }


Member Data Documentation

$_attributeTabBlock = 'adminhtml/catalog_category_tab_attributes' [protected]

Definition at line 41 of file Tabs.php.


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