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: class Mage_Adminhtml_Block_Api_Buttons extends Mage_Adminhtml_Block_Template
28: {
29:
30: public function __construct()
31: {
32: parent::__construct();
33: $this->setTemplate('api/userinfo.phtml');
34: }
35:
36: protected function _prepareLayout()
37: {
38: $this->setChild('backButton',
39: $this->getLayout()->createBlock('adminhtml/widget_button')
40: ->setData(array(
41: 'label' => Mage::helper('adminhtml')->__('Back'),
42: 'onclick' => 'window.location.href=\''.$this->getUrl('*/*/').'\'',
43: 'class' => 'back'
44: ))
45: );
46:
47: $this->setChild('resetButton',
48: $this->getLayout()->createBlock('adminhtml/widget_button')
49: ->setData(array(
50: 'label' => Mage::helper('adminhtml')->__('Reset'),
51: 'onclick' => 'window.location.reload()'
52: ))
53: );
54:
55: $this->setChild('saveButton',
56: $this->getLayout()->createBlock('adminhtml/widget_button')
57: ->setData(array(
58: 'label' => Mage::helper('adminhtml')->__('Save Role'),
59: 'onclick' => 'roleForm.submit();return false;',
60: 'class' => 'save'
61: ))
62: );
63:
64: $this->setChild('deleteButton',
65: $this->getLayout()->createBlock('adminhtml/widget_button')
66: ->setData(array(
67: 'label' => Mage::helper('adminhtml')->__('Delete Role'),
68: 'onclick' => 'deleteConfirm(\'' . Mage::helper('adminhtml')->__('Are you sure you want to do this?') . '\', \'' . $this->getUrl('*/*/delete', array('rid' => $this->getRequest()->getParam('rid'))) . '\')',
69: 'class' => 'delete'
70: ))
71: );
72: return parent::_prepareLayout();
73: }
74:
75: public function getBackButtonHtml()
76: {
77: return $this->getChildHtml('backButton');
78: }
79:
80: public function getResetButtonHtml()
81: {
82: return $this->getChildHtml('resetButton');
83: }
84:
85: public function getSaveButtonHtml()
86: {
87: return $this->getChildHtml('saveButton');
88: }
89:
90: public function getDeleteButtonHtml()
91: {
92: if( intval($this->getRequest()->getParam('rid')) == 0 ) {
93: return;
94: }
95: return $this->getChildHtml('deleteButton');
96: }
97:
98: public function getUser()
99: {
100: return Mage::registry('user_data');
101: }
102: }
103: