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_Product_Detail_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_product_collection');
00047
00048 $collection->addTagedCount()
00049 ->addProductFilter($this->getRequest()->getParam('id'))
00050 ->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus())
00051 ->addStoresVisibility()
00052 ->setActiveFilter()
00053 ->addGroupByTag()
00054 ->setRelationId();
00055
00056 $this->setCollection($collection);
00057 return parent::_prepareCollection();
00058 }
00059
00060 protected function _prepareColumns()
00061 {
00062
00063 $this->addColumn('tag_name', array(
00064 'header' =>Mage::helper('reports')->__('Tag Name'),
00065 'index' =>'tag_name'
00066 ));
00067
00068 $this->addColumn('taged', array(
00069 'header' =>Mage::helper('reports')->__('Tag use'),
00070 'index' =>'taged',
00071 'align' => 'right'
00072 ));
00073
00074 if (!Mage::app()->isSingleStoreMode()) {
00075 $this->addColumn('visible', array(
00076 'header' => Mage::helper('reports')->__('Visible In'),
00077 'sortable' => false,
00078 'index' => 'stores',
00079 'type' => 'store',
00080 'store_view'=> true
00081 ));
00082 }
00083
00084 $this->addExportType('*/*/exportProductDetailCsv', Mage::helper('reports')->__('CSV'));
00085 $this->addExportType('*/*/exportProductDetailExcel', Mage::helper('reports')->__('Excel'));
00086
00087 $this->setFilterVisibility(false);
00088
00089 return parent::_prepareColumns();
00090 }
00091
00092 }
00093