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: class Mage_Sales_Block_Adminhtml_Recurring_Profile_View extends Mage_Adminhtml_Block_Widget_Container
31: {
32: 33: 34: 35: 36:
37: protected function _prepareLayout()
38: {
39: $this->_addButton('back', array(
40: 'label' => Mage::helper('adminhtml')->__('Back'),
41: 'onclick' => "setLocation('{$this->getUrl('*/*/')}')",
42: 'class' => 'back',
43: ));
44:
45: $profile = Mage::registry('current_recurring_profile');
46: $comfirmationMessage = Mage::helper('sales')->__('Are you sure you want to do this?');
47:
48:
49: if ($profile->canCancel()) {
50: $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'cancel'));
51: $this->_addButton('cancel', array(
52: 'label' => Mage::helper('sales')->__('Cancel'),
53: 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')",
54: 'class' => 'delete',
55: ));
56: }
57:
58:
59: if ($profile->canSuspend()) {
60: $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'suspend'));
61: $this->_addButton('suspend', array(
62: 'label' => Mage::helper('sales')->__('Suspend'),
63: 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')",
64: 'class' => 'delete',
65: ));
66: }
67:
68:
69: if ($profile->canActivate()) {
70: $url = $this->getUrl('*/*/updateState', array('profile' => $profile->getId(), 'action' => 'activate'));
71: $this->_addButton('activate', array(
72: 'label' => Mage::helper('sales')->__('Activate'),
73: 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')",
74: 'class' => 'add',
75: ));
76: }
77:
78:
79: if ($profile->canFetchUpdate()) {
80: $url = $this->getUrl('*/*/updateProfile', array('profile' => $profile->getId(),));
81: $this->_addButton('update', array(
82: 'label' => Mage::helper('sales')->__('Get Update'),
83: 'onclick' => "confirmSetLocation('{$comfirmationMessage}', '{$url}')",
84: 'class' => 'add',
85: ));
86: }
87:
88: return parent::_prepareLayout();
89: }
90:
91: 92: 93: 94: 95:
96: protected function _beforeToHtml()
97: {
98: $profile = Mage::registry('current_recurring_profile');
99: $this->_headerText = Mage::helper('sales')->__('Recurring Profile # %s', $profile->getReferenceId());
100: $this->setViewHtml('<div id="' . $this->getDestElementId() . '"></div>');
101: return parent::_beforeToHtml();
102: }
103: }
104: