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_Sitemap_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('sitemapGrid');
41: $this->setDefaultSort('sitemap_id');
42:
43: }
44:
45: protected function _prepareCollection()
46: {
47: $collection = Mage::getModel('sitemap/sitemap')->getCollection();
48:
49: $this->setCollection($collection);
50: return parent::_prepareCollection();
51: }
52:
53: protected function _prepareColumns()
54: {
55: $this->addColumn('sitemap_id', array(
56: 'header' => Mage::helper('sitemap')->__('ID'),
57: 'width' => '50px',
58: 'index' => 'sitemap_id'
59: ));
60:
61: $this->addColumn('sitemap_filename', array(
62: 'header' => Mage::helper('sitemap')->__('Filename'),
63: 'index' => 'sitemap_filename'
64: ));
65:
66: $this->addColumn('sitemap_path', array(
67: 'header' => Mage::helper('sitemap')->__('Path'),
68: 'index' => 'sitemap_path'
69: ));
70:
71: $this->addColumn('link', array(
72: 'header' => Mage::helper('sitemap')->__('Link for Google'),
73: 'index' => 'concat(sitemap_path, sitemap_filename)',
74: 'renderer' => 'adminhtml/sitemap_grid_renderer_link',
75: ));
76:
77: $this->addColumn('sitemap_time', array(
78: 'header' => Mage::helper('sitemap')->__('Last Time Generated'),
79: 'width' => '150px',
80: 'index' => 'sitemap_time',
81: 'type' => 'datetime',
82: ));
83:
84:
85: if (!Mage::app()->isSingleStoreMode()) {
86: $this->addColumn('store_id', array(
87: 'header' => Mage::helper('sitemap')->__('Store View'),
88: 'index' => 'store_id',
89: 'type' => 'store',
90: ));
91: }
92:
93: $this->addColumn('action', array(
94: 'header' => Mage::helper('sitemap')->__('Action'),
95: 'filter' => false,
96: 'sortable' => false,
97: 'width' => '100',
98: 'renderer' => 'adminhtml/sitemap_grid_renderer_action'
99: ));
100:
101: return parent::_prepareColumns();
102: }
103:
104: 105: 106: 107: 108:
109: public function getRowUrl($row)
110: {
111: return $this->getUrl('*/*/edit', array('sitemap_id' => $row->getId()));
112: }
113:
114: }
115: