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_Tag_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('grid');
41: }
42:
43: protected function _prepareCollection()
44: {
45:
46: $collection = Mage::getResourceModel('reports/tag_customer_collection');
47:
48: $collection->addStatusFilter(Mage_Tag_Model_Tag::STATUS_APPROVED)
49: ->addGroupByCustomer()
50: ->addTagedCount();
51:
52: $this->setCollection($collection);
53: return parent::_prepareCollection();
54: }
55:
56: protected function _prepareColumns()
57: {
58:
59: $this->addColumn('entity_id', array(
60: 'header' =>Mage::helper('reports')->__('ID'),
61: 'width' => '50px',
62: 'align' =>'right',
63: 'index' =>'entity_id'
64: ));
65:
66: $this->addColumn('firstname', array(
67: 'header' =>Mage::helper('reports')->__('First Name'),
68: 'index' =>'firstname'
69: ));
70:
71: $this->addColumn('lastname', array(
72: 'header' =>Mage::helper('reports')->__('Last Name'),
73: 'index' =>'lastname'
74: ));
75:
76: $this->addColumn('taged', array(
77: 'header' =>Mage::helper('reports')->__('Total Tags'),
78: 'width' =>'50px',
79: 'align' =>'right',
80: 'index' =>'taged'
81: ));
82:
83: $this->addColumn('action',
84: array(
85: 'header' => Mage::helper('catalog')->__('Action'),
86: 'width' => '100%',
87: 'type' => 'action',
88: 'getter' => 'getId',
89: 'actions' => array(
90: array(
91: 'caption' => Mage::helper('catalog')->__('Show Tags'),
92: 'url' => array(
93: 'base'=>'*/*/customerDetail'
94: ),
95: 'field' => 'id'
96: )
97: ),
98: 'is_system' => true,
99: 'filter' => false,
100: 'sortable' => false,
101: 'index' => 'stores',
102: ));
103:
104: $this->setFilterVisibility(false);
105:
106: $this->addExportType('*/*/exportCustomerCsv', Mage::helper('reports')->__('CSV'));
107: $this->addExportType('*/*/exportCustomerExcel', Mage::helper('reports')->__('Excel XML'));
108:
109: return parent::_prepareColumns();
110: }
111:
112: public function getRowUrl($row)
113: {
114: return $this->getUrl('*/*/customerDetail', array('id'=>$row->getId()));
115: }
116:
117: }
118:
119: