Mage_Adminhtml_Customer_GroupController Class Reference

Inheritance diagram for Mage_Adminhtml_Customer_GroupController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 newAction ()
 editAction ()
 saveAction ()
 deleteAction ()

Protected Member Functions

 _initGroup ()
 _isAllowed ()


Detailed Description

Definition at line 34 of file GroupController.php.


Member Function Documentation

_initGroup (  )  [protected]

Definition at line 36 of file GroupController.php.

00037     {
00038         Mage::register('current_group', Mage::getModel('customer/group'));
00039         $groupId = $this->getRequest()->getParam('id');
00040         if (!is_null($groupId)) {
00041             Mage::registry('current_group')->load($groupId);
00042         }
00043 
00044     }

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 146 of file GroupController.php.

00147     {
00148         return Mage::getSingleton('admin/session')->isAllowed('customer/group');
00149     }

deleteAction (  ) 

Delete customer group action

Definition at line 126 of file GroupController.php.

00127     {
00128         $customerGroup = Mage::getModel('customer/group');
00129         if ($id = (int)$this->getRequest()->getParam('id')) {
00130             try {
00131                 $customerGroup->load($id);
00132                 $customerGroup->delete();
00133                 Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('Customer Group was successfully deleted'));
00134                 $this->getResponse()->setRedirect($this->getUrl('*/customer_group'));
00135                 return;
00136             } catch (Exception $e) {
00137                 Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
00138                 $this->getResponse()->setRedirect($this->getUrl('*/customer_group/edit', array('id' => $id)));
00139                 return;
00140             }
00141         }
00142 
00143         $this->_redirect('*/customer_group');
00144     }

editAction (  ) 

Edit customer group action. Forward to new action.

Definition at line 87 of file GroupController.php.

00088     {
00089         $this->_forward('new');
00090     }

indexAction (  ) 

Customer groups list.

Definition at line 48 of file GroupController.php.

00049     {
00050         $this->loadLayout();
00051         $this->_setActiveMenu('customer/group');
00052         $this->_addBreadcrumb(Mage::helper('customer')->__('Customers'), Mage::helper('customer')->__('Customers'));
00053         $this->_addBreadcrumb(Mage::helper('customer')->__('Customer Groups'), Mage::helper('customer')->__('Customer Groups'));
00054 
00055         $this->_addContent($this->getLayout()->createBlock('adminhtml/customer_group', 'group'));
00056 
00057         $this->renderLayout();
00058     }

newAction (  ) 

Edit or create customer group.

Definition at line 63 of file GroupController.php.

00064     {
00065         $this->_initGroup();
00066         $this->loadLayout();
00067         $this->_setActiveMenu('customer/group');
00068         $this->_addBreadcrumb(Mage::helper('customer')->__('Customers'), Mage::helper('customer')->__('Customers'));
00069         $this->_addBreadcrumb(Mage::helper('customer')->__('Customer Groups'), Mage::helper('customer')->__('Customer Groups'), $this->getUrl('*/customer_group'));
00070 
00071         if (!is_null(Mage::registry('current_group')->getId())) {
00072             $this->_addBreadcrumb(Mage::helper('customer')->__('Edit Group'), Mage::helper('customer')->__('Edit Customer Groups'));
00073         } else {
00074             $this->_addBreadcrumb(Mage::helper('customer')->__('New Group'), Mage::helper('customer')->__('New Customer Groups'));
00075         }
00076 
00077         $this->getLayout()->getBlock('content')
00078             ->append($this->getLayout()->createBlock('adminhtml/customer_group_edit', 'group')
00079                         ->setEditMode((bool)Mage::registry('current_group')->getId()));
00080 
00081         $this->renderLayout();
00082     }

saveAction (  ) 

Create or save customer group.

Definition at line 95 of file GroupController.php.

00096     {
00097         $customerGroup = Mage::getModel('customer/group');
00098         $id = $this->getRequest()->getParam('id');
00099         if (!is_null($id)) {
00100             $customerGroup->load($id);
00101         }
00102 
00103         if ($taxClass = $this->getRequest()->getParam('tax_class')) {
00104             try {
00105                 $customerGroup->setCode($this->getRequest()->getParam('code'))
00106                     ->setTaxClassId($taxClass)
00107                     ->save();
00108                 Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('customer')->__('Customer Group was successfully saved'));
00109                 $this->getResponse()->setRedirect($this->getUrl('*/customer_group'));
00110                 return;
00111             } catch (Exception $e) {
00112                 Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
00113                 Mage::getSingleton('adminhtml/session')->setCustomerGroupData($customerGroup->getData());
00114                 $this->getResponse()->setRedirect($this->getUrl('*/customer_group/edit', array('id' => $id)));
00115                 return;
00116             }
00117         } else {
00118             $this->_forward('new');
00119         }
00120 
00121     }


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

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