00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class Mage_Adminhtml_Block_Api_Buttons extends Mage_Adminhtml_Block_Template
00028 {
00029
00030 public function __construct()
00031 {
00032 parent::__construct();
00033 $this->setTemplate('api/userinfo.phtml');
00034 }
00035
00036 protected function _prepareLayout()
00037 {
00038 $this->setChild('backButton',
00039 $this->getLayout()->createBlock('adminhtml/widget_button')
00040 ->setData(array(
00041 'label' => Mage::helper('adminhtml')->__('Back'),
00042 'onclick' => 'window.location.href=\''.$this->getUrl('*/*/').'\'',
00043 'class' => 'back'
00044 ))
00045 );
00046
00047 $this->setChild('resetButton',
00048 $this->getLayout()->createBlock('adminhtml/widget_button')
00049 ->setData(array(
00050 'label' => Mage::helper('adminhtml')->__('Reset'),
00051 'onclick' => 'window.location.reload()'
00052 ))
00053 );
00054
00055 $this->setChild('saveButton',
00056 $this->getLayout()->createBlock('adminhtml/widget_button')
00057 ->setData(array(
00058 'label' => Mage::helper('adminhtml')->__('Save Role'),
00059 'onclick' => 'roleForm.submit();return false;',
00060 'class' => 'save'
00061 ))
00062 );
00063
00064 $this->setChild('deleteButton',
00065 $this->getLayout()->createBlock('adminhtml/widget_button')
00066 ->setData(array(
00067 'label' => Mage::helper('adminhtml')->__('Delete Role'),
00068 'onclick' => 'deleteConfirm(\'' . Mage::helper('adminhtml')->__('Are you sure you want to do this?') . '\', \'' . $this->getUrl('*/*/delete', array('rid' => $this->getRequest()->getParam('rid'))) . '\')',
00069 'class' => 'delete'
00070 ))
00071 );
00072 return parent::_prepareLayout();
00073 }
00074
00075 public function getBackButtonHtml()
00076 {
00077 return $this->getChildHtml('backButton');
00078 }
00079
00080 public function getResetButtonHtml()
00081 {
00082 return $this->getChildHtml('resetButton');
00083 }
00084
00085 public function getSaveButtonHtml()
00086 {
00087 return $this->getChildHtml('saveButton');
00088 }
00089
00090 public function getDeleteButtonHtml()
00091 {
00092 if( intval($this->getRequest()->getParam('rid')) == 0 ) {
00093 return;
00094 }
00095 return $this->getChildHtml('deleteButton');
00096 }
00097
00098 public function getUser()
00099 {
00100 return Mage::registry('user_data');
00101 }
00102 }