00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 class Mage_Adminhtml_Block_Report_Tag_Customer_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('grid');
00041 }
00042
00043 protected function _prepareCollection()
00044 {
00045
00046 $collection = Mage::getResourceModel('reports/tag_customer_collection');
00047
00048 $collection->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus())
00049 ->addGroupByCustomer()
00050 ->addTagedCount();
00051
00052 $this->setCollection($collection);
00053 return parent::_prepareCollection();
00054 }
00055
00056 protected function _prepareColumns()
00057 {
00058
00059 $this->addColumn('entity_id', array(
00060 'header' =>Mage::helper('reports')->__('ID'),
00061 'width' => '50px',
00062 'align' =>'right',
00063 'index' =>'entity_id'
00064 ));
00065
00066 $this->addColumn('firstname', array(
00067 'header' =>Mage::helper('reports')->__('First Name'),
00068 'index' =>'firstname'
00069 ));
00070
00071 $this->addColumn('lastname', array(
00072 'header' =>Mage::helper('reports')->__('Last Name'),
00073 'index' =>'lastname'
00074 ));
00075
00076 $this->addColumn('taged', array(
00077 'header' =>Mage::helper('reports')->__('Total Tags'),
00078 'width' =>'50px',
00079 'align' =>'right',
00080 'index' =>'taged'
00081 ));
00082
00083 $this->addColumn('action',
00084 array(
00085 'header' => Mage::helper('catalog')->__('Action'),
00086 'width' => '100%',
00087 'type' => 'action',
00088 'getter' => 'getId',
00089 'actions' => array(
00090 array(
00091 'caption' => Mage::helper('catalog')->__('Show Tags'),
00092 'url' => array(
00093 'base'=>'*/*/customerDetail'
00094 ),
00095 'field' => 'id'
00096 )
00097 ),
00098 'filter' => false,
00099 'sortable' => false,
00100 'index' => 'stores',
00101 ));
00102
00103 $this->setFilterVisibility(false);
00104
00105 $this->addExportType('*/*/exportCustomerCsv', Mage::helper('reports')->__('CSV'));
00106 $this->addExportType('*/*/exportCustomerExcel', Mage::helper('reports')->__('Excel'));
00107
00108 return parent::_prepareColumns();
00109 }
00110
00111 public function getRowUrl($row)
00112 {
00113 return $this->getUrl('*/*/customerDetail', array('id'=>$row->getId()));
00114 }
00115
00116 }
00117