예제 #1
0
 protected function _prepareLayout()
 {
     $addUrl = $this->getUrl("*/*/add", array('_current' => true, 'id' => null, '_query' => false));
     $this->setChild('add_sub_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Add Subcategory'), 'onclick' => "addNew('" . $addUrl . "', false)", 'class' => 'add', 'id' => 'add_subcategory_button', 'style' => $this->canAddSubCategory() ? '' : 'display: none;')));
     if ($this->canAddRootCategory()) {
         $this->setChild('add_root_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Add Root Category'), 'onclick' => "addNew('" . $addUrl . "', true)", 'class' => 'add', 'id' => 'add_root_category_button')));
     }
     $this->setChild('store_switcher', $this->getLayout()->createBlock('adminhtml/store_switcher')->setSwitchUrl($this->getUrl('*/*/*', array('_current' => true, '_query' => false, 'store' => null)))->setTemplate('store/switcher/enhanced.phtml'));
     return parent::_prepareLayout();
 }
예제 #2
0
 protected function _prepareLayout()
 {
     $category = $this->getCategory();
     $categoryId = (int) $category->getId();
     // 0 when we create category, otherwise some value for editing category
     $this->setChild('tabs', $this->getLayout()->createBlock('blog/adminhtml_category_tabs', 'tabs'));
     // Save button
     if (!$category->isReadonly()) {
         $this->setChild('save_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Save Category'), 'onclick' => "categorySubmit('" . $this->getSaveUrl() . "', true)", 'class' => 'save')));
     }
     // Delete button
     if (!in_array($categoryId, $this->getRootIds()) && $category->isDeleteable()) {
         $this->setChild('delete_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Delete Category'), 'onclick' => "categoryDelete('" . $this->getUrl('*/*/delete', array('_current' => true)) . "', true, {$categoryId})", 'class' => 'delete')));
     }
     // Reset button
     if (!$category->isReadonly()) {
         $resetPath = $categoryId ? '*/*/edit' : '*/*/add';
         $this->setChild('reset_button', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Reset'), 'onclick' => "categoryReset('" . $this->getUrl($resetPath, array('_current' => true)) . "',true)")));
     }
     return parent::_prepareLayout();
 }