1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Customer_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('customer_info_tabs');
41: $this->setDestElementId('edit_form');
42: $this->setTitle(Mage::helper('customer')->__('Customer Information'));
43: }
44:
45: protected function _beforeToHtml()
46: {
47: 48: 49: 50: 51: 52: 53: 54: 55:
56: $this->addTab('account', array(
57: 'label' => Mage::helper('customer')->__('Account Information'),
58: 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_account')->initForm()->toHtml(),
59: 'active' => Mage::registry('current_customer')->getId() ? false : true
60: ));
61:
62: $this->addTab('addresses', array(
63: 'label' => Mage::helper('customer')->__('Addresses'),
64: 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_addresses')->initForm()->toHtml(),
65: ));
66:
67:
68:
69:
70: if (Mage::registry('current_customer')->getId()) {
71:
72: if (Mage::getSingleton('admin/session')->isAllowed('sales/order/actions/view')) {
73: $this->addTab('orders', array(
74: 'label' => Mage::helper('customer')->__('Orders'),
75: 'class' => 'ajax',
76: 'url' => $this->getUrl('*/*/orders', array('_current' => true)),
77: ));
78: }
79:
80: $this->addTab('cart', array(
81: 'label' => Mage::helper('customer')->__('Shopping Cart'),
82: 'class' => 'ajax',
83: 'url' => $this->getUrl('*/*/carts', array('_current' => true)),
84: ));
85:
86: $this->addTab('wishlist', array(
87: 'label' => Mage::helper('customer')->__('Wishlist'),
88: 'class' => 'ajax',
89: 'url' => $this->getUrl('*/*/wishlist', array('_current' => true)),
90: ));
91:
92: if (Mage::getSingleton('admin/session')->isAllowed('newsletter/subscriber')) {
93: $this->addTab('newsletter', array(
94: 'label' => Mage::helper('customer')->__('Newsletter'),
95: 'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter')->initForm()->toHtml()
96: ));
97: }
98:
99: if (Mage::getSingleton('admin/session')->isAllowed('catalog/reviews_ratings')) {
100: $this->addTab('reviews', array(
101: 'label' => Mage::helper('customer')->__('Product Reviews'),
102: 'class' => 'ajax',
103: 'url' => $this->getUrl('*/*/productReviews', array('_current' => true)),
104: ));
105: }
106:
107: if (Mage::getSingleton('admin/session')->isAllowed('catalog/tag')) {
108: $this->addTab('tags', array(
109: 'label' => Mage::helper('customer')->__('Product Tags'),
110: 'class' => 'ajax',
111: 'url' => $this->getUrl('*/*/productTags', array('_current' => true)),
112: ));
113: }
114: }
115:
116: $this->_updateActiveTab();
117: Varien_Profiler::stop('customer/tabs');
118: return parent::_beforeToHtml();
119: }
120:
121: protected function _updateActiveTab()
122: {
123: $tabId = $this->getRequest()->getParam('tab');
124: if( $tabId ) {
125: $tabId = preg_replace("#{$this->getId()}_#", '', $tabId);
126: if($tabId) {
127: $this->setActiveTab($tabId);
128: }
129: }
130: }
131: }
132: