Mage_Adminhtml_Promo_WidgetController Class Reference

Inheritance diagram for Mage_Adminhtml_Promo_WidgetController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 chooserAction ()
 categoriesJsonAction ()

Protected Member Functions

 _isAllowed ()
 _initCategory ()


Detailed Description

Definition at line 28 of file WidgetController.php.


Member Function Documentation

_initCategory (  )  [protected]

Initialize category object in registry

Returns:
Mage_Catalog_Model_Category

Definition at line 83 of file WidgetController.php.

00084     {
00085         $categoryId = (int) $this->getRequest()->getParam('id',false);
00086 
00087         $storeId    = (int) $this->getRequest()->getParam('store');
00088 
00089         $category = Mage::getModel('catalog/category');
00090         $category->setStoreId($storeId);
00091 
00092         if ($categoryId) {
00093             $category->load($categoryId);
00094             if ($storeId) {
00095                 $rootId = Mage::app()->getStore($storeId)->getRootCategoryId();
00096                 if (!in_array($rootId, $category->getPathIds())) {
00097                     $this->_redirect('*/*/', array('_current'=>true, 'id'=>null));
00098                     return false;
00099                 }
00100             }
00101         }
00102 
00103         Mage::register('category', $category);
00104         Mage::register('current_category', $category);
00105         return $category;
00106     }

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 55 of file WidgetController.php.

00056     {
00057         return Mage::getSingleton('admin/session')->isAllowed('promo/catalog');
00058     }

categoriesJsonAction (  ) 

Get tree node (Ajax version)

Definition at line 63 of file WidgetController.php.

00064     {
00065         if ($categoryId = (int) $this->getRequest()->getPost('id')) {
00066             $this->getRequest()->setParam('id', $categoryId);
00067 
00068             if (!$category = $this->_initCategory()) {
00069                 return;
00070             }
00071             $this->getResponse()->setBody(
00072                 $this->getLayout()->createBlock('adminhtml/catalog_category_tree')
00073                     ->getTreeJson($category)
00074             );
00075         }
00076     }

chooserAction (  ) 

Definition at line 30 of file WidgetController.php.

00031     {
00032         $block = false;
00033         switch ($this->getRequest()->getParam('attribute')) {
00034             case 'sku':
00035                 $block = $this->getLayout()->createBlock(
00036                     'adminhtml/promo_widget_chooser_sku', 'promo_widget_chooser_sku',
00037                     array('js_form_object' => $this->getRequest()->getParam('form'),
00038                 ));
00039                 break;
00040 
00041             case 'category_ids':
00042                 $block = $this->getLayout()->createBlock(
00043                         'adminhtml/catalog_category_checkboxes_tree', 'promo_widget_chooser_category_ids',
00044                         array('js_form_object' => $this->getRequest()->getParam('form'))
00045                     )
00046                     ->setCategoryIds($this->getRequest()->getParam('selected', array()))
00047                 ;
00048                 break;
00049         }
00050         if ($block) {
00051             $this->getResponse()->setBody($block->toHtml());
00052         }
00053     }


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

Generated on Sat Jul 4 17:23:28 2009 for Magento by  doxygen 1.5.8