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: 31: 32: 33:
34: class Mage_Adminhtml_Block_Permissions_User_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('permissionsUserGrid');
41: $this->setDefaultSort('username');
42: $this->setDefaultDir('asc');
43: $this->setUseAjax(true);
44: }
45:
46: protected function _prepareCollection()
47: {
48: $collection = Mage::getResourceModel('admin/user_collection');
49: $this->setCollection($collection);
50: return parent::_prepareCollection();
51: }
52:
53: protected function _prepareColumns()
54: {
55: $this->addColumn('user_id', array(
56: 'header' => Mage::helper('adminhtml')->__('ID'),
57: 'width' => 5,
58: 'align' => 'right',
59: 'sortable' => true,
60: 'index' => 'user_id'
61: ));
62:
63: $this->addColumn('username', array(
64: 'header' => Mage::helper('adminhtml')->__('User Name'),
65: 'index' => 'username'
66: ));
67:
68: $this->addColumn('firstname', array(
69: 'header' => Mage::helper('adminhtml')->__('First Name'),
70: 'index' => 'firstname'
71: ));
72:
73: $this->addColumn('lastname', array(
74: 'header' => Mage::helper('adminhtml')->__('Last Name'),
75: 'index' => 'lastname'
76: ));
77:
78: $this->addColumn('email', array(
79: 'header' => Mage::helper('adminhtml')->__('Email'),
80: 'width' => 40,
81: 'align' => 'left',
82: 'index' => 'email'
83: ));
84:
85: $this->addColumn('is_active', array(
86: 'header' => Mage::helper('adminhtml')->__('Status'),
87: 'index' => 'is_active',
88: 'type' => 'options',
89: 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive')),
90: ));
91:
92: return parent::_prepareColumns();
93: }
94:
95: public function getRowUrl($row)
96: {
97: return $this->getUrl('*/*/edit', array('user_id' => $row->getId()));
98: }
99:
100: public function getGridUrl()
101: {
102:
103: return $this->getUrl('*/*/roleGrid', array());
104: }
105:
106: }
107: