Mage_Adminhtml_Catalog_Product_SetController Class Reference

Inheritance diagram for Mage_Adminhtml_Catalog_Product_SetController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 editAction ()
 setGridAction ()
 saveAction ()
 addAction ()
 deleteAction ()

Protected Member Functions

 _setTypeId ()
 _isAllowed ()


Detailed Description

Definition at line 35 of file SetController.php.


Member Function Documentation

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 169 of file SetController.php.

00170     {
00171         return Mage::getSingleton('admin/session')->isAllowed('catalog/attributes/sets');
00172     }

_setTypeId (  )  [protected]

Definition at line 163 of file SetController.php.

00164     {
00165         Mage::register('entityType',
00166             Mage::getModel('catalog/product')->getResource()->getTypeId());
00167     }

addAction (  ) 

Definition at line 135 of file SetController.php.

00136     {
00137         $this->_setTypeId();
00138 
00139         $this->loadLayout();
00140         $this->_setActiveMenu('catalog/sets');
00141 
00142         $this->_addContent($this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_toolbar_add'));
00143 
00144         $this->renderLayout();
00145     }

deleteAction (  ) 

Definition at line 147 of file SetController.php.

00148     {
00149         $setId = $this->getRequest()->getParam('id');
00150         try {
00151             Mage::getModel('eav/entity_attribute_set')
00152                 ->setId($setId)
00153                 ->delete();
00154 
00155             $this->_getSession()->addSuccess($this->__('Attribute set was successfully removed.'));
00156             $this->getResponse()->setRedirect($this->getUrl('*/*/'));
00157         } catch (Exception $e) {
00158             $this->_getSession()->addError($this->__('Error while deleting this set.'));
00159             $this->_redirectReferer();
00160         }
00161     }

editAction (  ) 

Definition at line 53 of file SetController.php.

00054     {
00055         $this->_setTypeId();
00056         $attributeSet = Mage::getModel('eav/entity_attribute_set')
00057             ->load($this->getRequest()->getParam('id'));
00058 
00059         if (!$attributeSet->getId()) {
00060             $this->_redirect('*/*/index');
00061             return;
00062         }
00063 
00064         Mage::register('current_attribute_set', $attributeSet);
00065 
00066         $this->loadLayout();
00067         $this->_setActiveMenu('catalog/sets');
00068         $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
00069 
00070         $this->_addBreadcrumb(Mage::helper('catalog')->__('Catalog'), Mage::helper('catalog')->__('Catalog'));
00071         $this->_addBreadcrumb(Mage::helper('catalog')->__('Manage Product Sets'), Mage::helper('catalog')->__('Manage Product Sets'));
00072 
00073         $this->_addContent($this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_main'));
00074 
00075         $this->renderLayout();
00076     }

indexAction (  ) 

Definition at line 37 of file SetController.php.

00038     {
00039         $this->_setTypeId();
00040 
00041         $this->loadLayout();
00042         $this->_setActiveMenu('catalog/sets');
00043 
00044         $this->_addBreadcrumb(Mage::helper('catalog')->__('Catalog'), Mage::helper('catalog')->__('Catalog'));
00045         $this->_addBreadcrumb(Mage::helper('catalog')->__('Manage Attribute Sets'), Mage::helper('catalog')->__('Manage Attribute Sets'));
00046 
00047         $this->_addContent($this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_toolbar_main'));
00048         $this->_addContent($this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_grid'));
00049 
00050         $this->renderLayout();
00051     }

saveAction (  ) 

Definition at line 84 of file SetController.php.

00085     {
00086         $this->_setTypeId();
00087         $response = new Varien_Object();
00088         $response->setError(0);
00089 
00090         $modelSet = Mage::getModel('eav/entity_attribute_set')
00091             ->setId($this->getRequest()->getParam('id'))
00092             ->setEntityTypeId(Mage::registry('entityType'));
00093 
00094         if( $this->getRequest()->getParam('gotoEdit') ) {
00095             $modelSet = Mage::getModel('eav/entity_attribute_set');
00096             $modelSet->setAttributeSetName($this->getRequest()->getParam('attribute_set_name'))
00097                 ->setEntityTypeId(Mage::registry('entityType'));
00098         } else {
00099             $data = Zend_Json_Decoder::decode($this->getRequest()->getPost('data'));
00100             $modelSet->organizeData($data);
00101         }
00102 
00103         try {
00104             $modelSet->validate($modelSet->getAttributeSetName());
00105             $modelSet->save();
00106             if( $this->getRequest()->getParam('gotoEdit') == 1 ) {
00107                 $modelSet->initFromSkeleton($this->getRequest()->getParam('skeleton_set'))
00108                     ->save();
00109 
00110                 $this->_redirect('*/*/edit', array('id' => $modelSet->getId()));
00111                 $this->_getSession()->addSuccess($this->__('Attribute set successfully saved.'));
00112             } else {
00113                 $this->_getSession()->addSuccess($this->__('Attribute set successfully saved.'));
00114 //                $this->_initLayoutMessages('adminhtml/session');
00115 //                $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
00116                 $response->setUrl($this->getUrl('*/*/edit', array('id' => $modelSet->getId())));
00117                 //$this->_redirect('*/*/'); Why? there is Ajax.
00118             }
00119         }
00120         catch (Exception $e) {
00121             $this->_getSession()->addError($e->getMessage());
00122             if( $this->getRequest()->getParam('gotoEdit') == 1 ) {
00123                 $this->_redirectReferer();
00124             } else {
00125                 $this->_initLayoutMessages('adminhtml/session');
00126                 $response->setMessage($this->getLayout()->getMessagesBlock()->getGroupedHtml());
00127                 $response->setError(1);
00128             }
00129         }
00130         if( $this->getRequest()->getParam('gotoEdit') != 1 ) {
00131             $this->getResponse()->setBody($response->toJson());
00132         }
00133     }

setGridAction (  ) 

Definition at line 78 of file SetController.php.

00079     {
00080         $this->_setTypeId();
00081         $this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/catalog_product_attribute_set_grid')->toHtml());
00082     }


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

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