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_Urlrewrite_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('urlrewriteGrid');
41: $this->setDefaultSort('url_rewrite_id');
42: }
43:
44: protected function _prepareCollection()
45: {
46: $collection = Mage::getResourceModel('core/url_rewrite_collection');
47: $this->setCollection($collection);
48: return parent::_prepareCollection();
49: }
50:
51: protected function _prepareColumns()
52: {
53: $this->addColumn('url_rewrite_id', array(
54: 'header' => $this->__('ID'),
55: 'width' => '50px',
56: 'index' => 'url_rewrite_id'
57: ));
58:
59: if (!Mage::app()->isSingleStoreMode()) {
60: $this->addColumn('store_id', array(
61: 'header' => $this->__('Store View'),
62: 'width' => '200px',
63: 'index' => 'store_id',
64: 'type' => 'store',
65: 'store_view' => true,
66: ));
67: }
68:
69: $this->addColumn('is_system', array(
70: 'header' =>$this->__('Type'),
71: 'width' => '50px',
72: 'index' => 'is_system',
73: 'type' => 'options',
74: 'options' => array(
75: 1 => $this->__('System'),
76: 0 => $this->__('Custom')
77: ),
78: ));
79:
80: $this->addColumn('id_path', array(
81: 'header' => $this->__('ID Path'),
82: 'width' => '50px',
83: 'index' => 'id_path'
84: ));
85: $this->addColumn('request_path', array(
86: 'header' => $this->__('Request Path'),
87: 'width' => '50px',
88: 'index' => 'request_path'
89: ));
90: $this->addColumn('target_path', array(
91: 'header' => $this->__('Target Path'),
92: 'width' => '50px',
93: 'index' => 'target_path'
94: ));
95: $this->addColumn('options', array(
96: 'header' => $this->__('Options'),
97: 'width' => '50px',
98: 'index' => 'options'
99: ));
100: $this->addColumn('actions', array(
101: 'header' => $this->__('Action'),
102: 'width' => '15px',
103: 'sortable' => false,
104: 'filter' => false,
105: 'type' => 'action',
106: 'actions' => array(
107: array(
108: 'url' => $this->getUrl('*/*/edit') . 'id/$url_rewrite_id',
109: 'caption' => $this->__('Edit'),
110: ),
111: )
112: ));
113:
114:
115: return parent::_prepareColumns();
116: }
117:
118: public function getRowUrl($row)
119: {
120: return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
121:
122: }
123:
124: }
125:
126: