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 billing agreement info tab
29: *
30: * @author Magento Core Team <core@magentocommerce.com>
31: */
32: class Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Tab_Info extends Mage_Adminhtml_Block_Abstract
33: implements Mage_Adminhtml_Block_Widget_Tab_Interface
34: {
35: /**
36: * Set custom template
37: *
38: */
39: protected function _construct()
40: {
41: parent::_construct();
42: $this->setTemplate('sales/billing/agreement/view/tab/info.phtml');
43: }
44:
45: /**
46: * Return Tab label
47: *
48: * @return string
49: */
50: public function getTabLabel()
51: {
52: return $this->__('General Information');
53: }
54:
55: /**
56: * Return Tab title
57: *
58: * @return string
59: */
60: public function getTabTitle()
61: {
62: return $this->__('General Information');
63: }
64:
65: /**
66: * Can show tab in tabs
67: *
68: * @return boolean
69: */
70: public function canShowTab()
71: {
72: return true;
73: }
74:
75: /**
76: * Tab is hidden
77: *
78: * @return boolean
79: */
80: public function isHidden()
81: {
82: return false;
83: }
84:
85: /**
86: * Retrieve billing agreement model
87: *
88: * @return Mage_Sales_Model_Billing_Agreement
89: */
90: protected function _getBillingAgreement()
91: {
92: return Mage::registry('current_billing_agreement');
93: }
94:
95: /**
96: * Set data to block
97: *
98: * @return string
99: */
100: protected function _toHtml()
101: {
102: $agreement = $this->_getBillingAgreement();
103: $this->setReferenceId($agreement->getReferenceId());
104: $customer = Mage::getModel('customer/customer')->load($agreement->getCustomerId());
105: $this->setCustomerUrl(
106: $this->getUrl('*/customer/edit', array('id' => $customer->getId()))
107: );
108: $this->setCustomerEmail($customer->getEmail());
109: $this->setStatus($agreement->getStatusLabel());
110: $this->setCreatedAt(
111: $this->helper('core')->formatDate($agreement->getCreatedAt(), 'short', true)
112: );
113: $this->setUpdatedAt(
114: ($agreement->getUpdatedAt())
115: ? $this->helper('core')->formatDate($agreement->getUpdatedAt(), 'short', true) : $this->__('N/A')
116: );
117:
118: return parent::_toHtml();
119: }
120: }
121: