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_Report_Review_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('customers_grid');
41: $this->setDefaultSort('review_cnt');
42: $this->setDefaultDir('desc');
43: }
44:
45: protected function _prepareCollection()
46: {
47: $collection = Mage::getResourceModel('reports/review_customer_collection')
48: ->joinCustomers();
49:
50: $this->setCollection($collection);
51:
52: return parent::_prepareCollection();
53: }
54:
55: protected function _prepareColumns()
56: {
57: $this->addColumn('customer_name', array(
58: 'header' => Mage::helper('reports')->__('Customer Name'),
59: 'index' => 'customer_name',
60: 'default' => Mage::helper('reports')->__('Guest'),
61: ));
62:
63: $this->addColumn('review_cnt', array(
64: 'header' => Mage::helper('reports')->__('Number Of Reviews'),
65: 'width' => '40px',
66: 'align' => 'right',
67: 'index' => 'review_cnt'
68: ));
69:
70: $this->addColumn('action', array(
71: 'header' => Mage::helper('reports')->__('Action'),
72: 'width' => '100px',
73: 'align' => 'center',
74: 'filter' => false,
75: 'sortable' => false,
76: 'renderer' => 'adminhtml/report_grid_column_renderer_customer',
77: 'is_system' => true
78: ));
79:
80: $this->setFilterVisibility(false);
81:
82: $this->addExportType('*/*/exportCustomerCsv', Mage::helper('reports')->__('CSV'));
83: $this->addExportType('*/*/exportCustomerExcel', Mage::helper('reports')->__('Excel XML'));
84:
85: return parent::_prepareColumns();
86: }
87:
88: public function getRowUrl($row)
89: {
90: return $this->getUrl('*/catalog_product_review', array('customerId' => $row->getCustomerId()));
91: }
92: }
93: