1: <?php
2: /**
3: * Magento
4: *
5: * NOTICE OF LICENSE
6: *
7: * This source file is subject to the Open Software License (OSL 3.0)
8: * that is bundled with this package in the file LICENSE.txt.
9: * It is also available through the world-wide-web at this URL:
10: * http://opensource.org/licenses/osl-3.0.php
11: * If you did not receive a copy of the license and are unable to
12: * obtain it through the world-wide-web, please send an email
13: * to license@magentocommerce.com so we can send you a copy immediately.
14: *
15: * DISCLAIMER
16: *
17: * Do not edit or add to this file if you wish to upgrade Magento to newer
18: * versions in the future. If you wish to customize Magento for your
19: * needs please refer to http://www.magentocommerce.com for more information.
20: *
21: * @category Mage
22: * @package Mage_Sales
23: * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25: */
26:
27: /**
28: * Adminhtml customer recurring profiles tab
29: *
30: * @author Magento Core Team <core@magentocommerce.com>
31: */
32: class Mage_Sales_Block_Adminhtml_Customer_Edit_Tab_Recurring_Profile
33: extends Mage_Sales_Block_Adminhtml_Recurring_Profile_Grid
34: implements Mage_Adminhtml_Block_Widget_Tab_Interface
35: {
36: /**
37: * Disable filters and paging
38: *
39: */
40: public function __construct()
41: {
42: parent::__construct();
43: $this->setId('customer_edit_tab_recurring_profile');
44: }
45:
46: /**
47: * Return Tab label
48: *
49: * @return string
50: */
51: public function getTabLabel()
52: {
53: return $this->__('Recurring Profiles (beta)');
54: }
55:
56: /**
57: * Return Tab title
58: *
59: * @return string
60: */
61: public function getTabTitle()
62: {
63: return $this->__('Recurring Profiles (beta)');
64: }
65:
66: /**
67: * Can show tab in tabs
68: *
69: * @return boolean
70: */
71: public function canShowTab()
72: {
73: $customer = Mage::registry('current_customer');
74: return (bool)$customer->getId();
75: }
76:
77: /**
78: * Tab is hidden
79: *
80: * @return boolean
81: */
82: public function isHidden()
83: {
84: return false;
85: }
86:
87: /**
88: * Prepare collection for grid
89: *
90: * @return Mage_Sales_Block_Adminhtml_Customer_Edit_Tab_Recurring_Profile
91: */
92: protected function _prepareCollection()
93: {
94: $collection = Mage::getResourceModel('sales/recurring_profile_collection')
95: ->addFieldToFilter('customer_id', Mage::registry('current_customer')->getId());
96: if (!$this->getParam($this->getVarNameSort())) {
97: $collection->setOrder('profile_id', 'desc');
98: }
99: $this->setCollection($collection);
100: return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
101: }
102:
103: /**
104: * Defines after which tab, this tab should be rendered
105: *
106: * @return string
107: */
108: public function getAfter()
109: {
110: return 'orders';
111: }
112:
113: /**
114: * Return grid url
115: *
116: * @return string
117: */
118: public function getGridUrl()
119: {
120: return $this->getUrl('*/sales_recurring_profile/customerGrid', array('_current' => true));
121: }
122: }
123: