Mage_Adminhtml_Block_Catalog_Category_Edit_Form Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Catalog_Category_Edit_Form:

Mage_Adminhtml_Block_Catalog_Category_Abstract Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRootIds ()
 getStoreConfigurationUrl ()
 getDeleteButtonHtml ()
 getSaveButtonHtml ()
 getResetButtonHtml ()
 getAdditionalButtonsHtml ()
 addAdditionalButton ($alias, $config)
 removeAdditionalButton ($alias)
 getTabsHtml ()
 getHeader ()
 getDeleteUrl (array $args=array())
 getProductsJson ()
 isAjax ()

Protected Member Functions

 _prepareLayout ()

Protected Attributes

 $_additionalButtons = array()


Detailed Description

Definition at line 34 of file Form.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Mage_Adminhtml_Block_Catalog_Category_Abstract.

Definition at line 43 of file Form.php.

00044     {
00045         parent::__construct();
00046         $this->setTemplate('catalog/category/edit/form.phtml');
00047     }


Member Function Documentation

_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 49 of file Form.php.

00050     {
00051         $this->setChild('tabs',
00052             $this->getLayout()->createBlock('adminhtml/catalog_category_tabs', 'tabs')
00053         );
00054 
00055         if (!$this->getCategory()->isReadonly()) {
00056             $this->setChild('save_button',
00057                 $this->getLayout()->createBlock('adminhtml/widget_button')
00058                     ->setData(array(
00059                         'label'     => Mage::helper('catalog')->__('Save Category'),
00060                         'onclick'   => "categorySubmit('".$this->getSaveUrl()."',true)",
00061                         'class' => 'save'
00062                     ))
00063             );
00064         }
00065         if (!in_array($this->getCategory()->getId(), $this->getRootIds()) &&
00066             $this->getCategory()->isDeleteable()) {
00067             $this->setChild('delete_button',
00068                 $this->getLayout()->createBlock('adminhtml/widget_button')
00069                     ->setData(array(
00070                         'label'     => Mage::helper('catalog')->__('Delete Category'),
00071                         'onclick'   => "categoryDelete('".$this->getUrl('*/*/delete', array('_current'=>true))."',true)",
00072                         'class' => 'delete'
00073                     ))
00074             );
00075         }
00076 
00077         if (!$this->getCategory()->isReadonly()) {
00078             $this->setChild('reset_button',
00079                 $this->getLayout()->createBlock('adminhtml/widget_button')
00080                     ->setData(array(
00081                         'label'     => Mage::helper('catalog')->__('Reset'),
00082                         'onclick'   => "categoryReset('".$this->getUrl('*/*/edit', array('_current'=>true))."',true)"
00083                     ))
00084             );
00085         }
00086 
00087         return parent::_prepareLayout();
00088     }

addAdditionalButton ( alias,
config 
)

Add additional button

Parameters:
string $alias
array $config
Returns:
Mage_Adminhtml_Block_Catalog_Category_Edit_Form

Definition at line 163 of file Form.php.

00164     {
00165         $this->setChild($alias . '_button',
00166                         $this->getLayout()->createBlock('adminhtml/widget_button')->addData($config));
00167         $this->_additionalButtons[$alias] = $alias . '_button';
00168         return $this;
00169     }

getAdditionalButtonsHtml (  ) 

Retrieve additional buttons html

Returns:
string

Definition at line 147 of file Form.php.

00148     {
00149         $html = '';
00150         foreach ($this->_additionalButtons as $childName) {
00151             $html .= $this->getChildHtml($childName);
00152         }
00153         return $html;
00154     }

getDeleteButtonHtml (  ) 

Definition at line 121 of file Form.php.

00122     {
00123         return $this->getChildHtml('delete_button');
00124     }

getDeleteUrl ( array args = array()  ) 

Definition at line 200 of file Form.php.

00201     {
00202         $params = array('_current'=>true);
00203         $params = array_merge($params, $args);
00204         return $this->getUrl('*/*/delete', $params);
00205     }

getHeader (  ) 

Definition at line 192 of file Form.php.

00193     {
00194         if ($this->hasStoreRootCategory()) {
00195             return $this->getCategoryId() ? $this->getCategoryName() : Mage::helper('catalog')->__('New Category');
00196         }
00197         return Mage::helper('catalog')->__('Set Root Category For Store');
00198     }

getProductsJson (  ) 

Definition at line 207 of file Form.php.

00208     {
00209         $products = $this->getCategory()->getProductsPosition();
00210         if (!empty($products)) {
00211             return Zend_Json::encode($products);
00212         }
00213         return '{}';
00214     }

getResetButtonHtml (  ) 

Definition at line 134 of file Form.php.

00135     {
00136         if ($this->hasStoreRootCategory()) {
00137             return $this->getChildHtml('reset_button');
00138         }
00139         return '';
00140     }

getRootIds (  ) 

Return array of root categories ids

Returns:
array

Definition at line 95 of file Form.php.

00096     {
00097         $ids = $this->getData('root_ids');
00098         if (is_null($ids)) {
00099             $ids = array();
00100             foreach (Mage::app()->getStores() as $store) {
00101                 $ids[] = $store->getRootCategoryId();
00102             }
00103             $this->setData('root_ids', $ids);
00104         }
00105         return $ids;
00106     }

getSaveButtonHtml (  ) 

Definition at line 126 of file Form.php.

00127     {
00128         if ($this->hasStoreRootCategory()) {
00129             return $this->getChildHtml('save_button');
00130         }
00131         return '';
00132     }

getStoreConfigurationUrl (  ) 

Definition at line 108 of file Form.php.

00109     {
00110         $storeId = (int) $this->getRequest()->getParam('store');
00111         $params = array();
00112 //        $params = array('section'=>'catalog');
00113         if ($storeId) {
00114             $store = Mage::app()->getStore($storeId);
00115             $params['website'] = $store->getWebsite()->getCode();
00116             $params['store']   = $store->getCode();
00117         }
00118         return $this->getUrl('*/system_store', $params);
00119     }

getTabsHtml (  ) 

Definition at line 187 of file Form.php.

00188     {
00189         return $this->getChildHtml('tabs');
00190     }

isAjax (  ) 

Definition at line 216 of file Form.php.

00217     {
00218         return Mage::app()->getRequest()->isXmlHttpRequest() || Mage::app()->getRequest()->getParam('isAjax');
00219     }

removeAdditionalButton ( alias  ) 

Remove additional button

Parameters:
string $alias
Returns:
Mage_Adminhtml_Block_Catalog_Category_Edit_Form

Definition at line 177 of file Form.php.

00178     {
00179         if (isset($this->_additionalButtons[$alias])) {
00180             $this->unsetChild($this->_additionalButtons[$alias]);
00181             unset($this->_additionalButtons[$alias]);
00182         }
00183 
00184         return $this;
00185     }


Member Data Documentation

$_additionalButtons = array() [protected]

Definition at line 41 of file Form.php.


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

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