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_Popular_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 if ($this->getRequest()->getParam('website')) {
00047 $storeId = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
00048 } else if ($this->getRequest()->getParam('group')) {
00049 $storeId = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
00050 } else if ($this->getRequest()->getParam('store')) {
00051 $storeId = (int)$this->getRequest()->getParam('store');
00052 } else {
00053 $storeId = '';
00054 }
00055
00056 $collection = Mage::getResourceModel('reports/tag_collection')
00057 ->addSummary($storeId)
00058 ->addStatusFilter(Mage::getModel('tag/tag')->getApprovedStatus());
00059
00060 if($storeId != '') {
00061 $collection->addStoreFilter($storeId);
00062 }
00063
00064 $this->setCollection($collection);
00065 return parent::_prepareCollection();
00066 }
00067
00068 protected function _prepareColumns()
00069 {
00070 $this->addColumn('name', array(
00071 'header' =>Mage::helper('reports')->__('Tag Name'),
00072 'sortable' =>false,
00073 'index' =>'name'
00074 ));
00075
00076 $this->addColumn('taged', array(
00077 'header' =>Mage::helper('reports')->__('Popularity'),
00078 'width' =>'50px',
00079 'align' =>'right',
00080 'sortable' =>false,
00081 'index' =>'popularity'
00082 ));
00083
00084 $this->addColumn('uses', array(
00085 'header' =>Mage::helper('reports')->__('Number Of Uses'),
00086 'width' =>'50px',
00087 'align' =>'right',
00088 'sortable' =>false,
00089 'index' =>'uses'
00090 ));
00091
00092 $this->addColumn('historical_uses', array(
00093 'header' =>Mage::helper('reports')->__('Number Of Historical Uses'),
00094 'width' =>'50px',
00095 'align' =>'right',
00096 'sortable' =>false,
00097 'index' =>'historical_uses'
00098 ));
00099
00100 $this->addColumn('action',
00101 array(
00102 'header' => Mage::helper('catalog')->__('Action'),
00103 'width' => '100%',
00104 'type' => 'action',
00105 'getter' => 'getId',
00106 'actions' => array(
00107 array(
00108 'caption' => Mage::helper('catalog')->__('Show Details'),
00109 'url' => array(
00110 'base'=>'*/*/tagDetail'
00111 ),
00112 'field' => 'id'
00113 )
00114 ),
00115 'filter' => false,
00116 'sortable' => false,
00117 'index' => 'stores',
00118 ));
00119 $this->setFilterVisibility(false);
00120
00121 $this->addExportType('*/*/exportPopularCsv', Mage::helper('reports')->__('CSV'));
00122 $this->addExportType('*/*/exportPopularExcel', Mage::helper('reports')->__('Excel'));
00123
00124 return parent::_prepareColumns();
00125 }
00126
00127 public function getRowUrl($row)
00128 {
00129 return $this->getUrl('*/*/tagDetail', array('id'=>$row->getTagId()));
00130 }
00131
00132 }