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
00035 class Mage_Adminhtml_Block_Dashboard_Searches_Top extends Mage_Adminhtml_Block_Dashboard_Grid
00036 {
00037 protected $_collection;
00038
00039 public function __construct()
00040 {
00041 parent::__construct();
00042 $this->setId('topSearchGrid');
00043 }
00044
00045 protected function _prepareCollection()
00046 {
00047 $this->_collection = Mage::getModel('catalogsearch/query')
00048 ->getResourceCollection();
00049
00050 if ($this->getRequest()->getParam('store')) {
00051 $storeIds = $this->getRequest()->getParam('store');
00052 } else if ($this->getRequest()->getParam('website')){
00053 $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds();
00054 } else if ($this->getRequest()->getParam('group')){
00055 $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds();
00056 } else {
00057 $storeIds = '';
00058 }
00059
00060 $this->_collection
00061 ->setPopularQueryFilter($storeIds);
00062
00063 $this->setCollection($this->_collection);
00064
00065 return parent::_prepareCollection();
00066 }
00067
00068 protected function _prepareColumns()
00069 {
00070 $this->addColumn('search_query', array(
00071 'header' => $this->__('Search Term'),
00072 'sortable' => false,
00073 'index' => 'query_text',
00074 'renderer' => 'adminhtml/dashboard_searches_renderer_searchquery',
00075 ));
00076
00077 $this->addColumn('num_results', array(
00078 'header' => $this->__('Results'),
00079 'sortable' => false,
00080 'index' => 'num_results',
00081 'type' => 'number'
00082 ));
00083
00084 $this->addColumn('popularity', array(
00085 'header' => $this->__('Number of Uses'),
00086 'sortable' => false,
00087 'index' => 'popularity',
00088 'type' => 'number'
00089 ));
00090
00091 $this->setFilterVisibility(false);
00092 $this->setPagerVisibility(false);
00093
00094 return parent::_prepareColumns();
00095 }
00096
00097 public function getRowUrl($row)
00098 {
00099 return $this->getUrl('*/catalog_search/edit', array('id'=>$row->getId()));
00100 }
00101 }