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_Editroles extends Mage_Adminhtml_Block_Widget_Tabs {
28: public function __construct()
29: {
30: parent::__construct();
31: $this->setId('role_info_tabs');
32: $this->setDestElementId('role_edit_form');
33: $this->setTitle(Mage::helper('adminhtml')->__('Role Information'));
34: }
35:
36: protected function _beforeToHtml()
37: {
38: $roleId = $this->getRequest()->getParam('rid', false);
39: $role = Mage::getModel("api/roles")
40: ->load($roleId);
41:
42: $this->addTab('info', array(
43: 'label' => Mage::helper('adminhtml')->__('Role Info'),
44: 'title' => Mage::helper('adminhtml')->__('Role Info'),
45: 'content' => $this->getLayout()->createBlock('adminhtml/api_tab_roleinfo')->setRole($role)->toHtml(),
46: 'active' => true
47: ));
48:
49: $this->addTab('account', array(
50: 'label' => Mage::helper('adminhtml')->__('Role Resources'),
51: 'title' => Mage::helper('adminhtml')->__('Role Resources'),
52: 'content' => $this->getLayout()->createBlock('adminhtml/api_tab_rolesedit')->toHtml(),
53: ));
54:
55: if( intval($roleId) > 0 ) {
56: $this->addTab('roles', array(
57: 'label' => Mage::helper('adminhtml')->__('Role Users'),
58: 'title' => Mage::helper('adminhtml')->__('Role Users'),
59: 'content' => $this->getLayout()->createBlock('adminhtml/api_tab_rolesusers', 'role.users.grid')->toHtml(),
60: ));
61: }
62: return parent::_beforeToHtml();
63: }
64: }
65: