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_GoogleBase_Block_Adminhtml_Items_Item extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036 public function __construct()
00037 {
00038 parent::__construct();
00039 $this->setId('items');
00040 $this->setUseAjax(true);
00041 }
00042
00043 protected function _prepareCollection()
00044 {
00045 $collection = Mage::getResourceModel('googlebase/item_collection');
00046 $store = $this->_getStore();
00047 $collection->addStoreFilterId($store->getId());
00048 $this->setCollection($collection);
00049 parent::_prepareCollection();
00050 return $this;
00051 }
00052
00053 protected function _prepareColumns()
00054 {
00055 $this->addColumn('name',
00056 array(
00057 'header' => $this->__('Product Name'),
00058 'width' => '30%',
00059 'index' => 'name',
00060 ));
00061
00062 $this->addColumn('gbase_item_id',
00063 array(
00064 'header' => $this->__('Google Base ID'),
00065 'width' => '150px',
00066 'index' => 'gbase_item_id',
00067 'renderer' => 'googlebase/adminhtml_items_renderer_id',
00068
00069 ));
00070
00071 $this->addColumn('gbase_itemtype',
00072 array(
00073 'header' => $this->__('Google Base Item Type'),
00074 'width' => '150px',
00075 'index' => 'gbase_itemtype',
00076 ));
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 $this->addColumn('expires',
00087 array(
00088 'header' => $this->__('Expires'),
00089 'type' => 'datetime',
00090 'width' => '100px',
00091 'index' => 'expires',
00092 ));
00093
00094 $this->addColumn('impr',
00095 array(
00096 'header' => $this->__('Impr.'),
00097 'width' => '150px',
00098 'index' => 'impr',
00099 'filter' => false,
00100 ));
00101
00102 $this->addColumn('clicks',
00103 array(
00104 'header' => $this->__('Clicks'),
00105 'width' => '150px',
00106 'index' => 'clicks',
00107 'filter' => false,
00108 ));
00109
00110 $this->addColumn('views',
00111 array(
00112 'header' => $this->__('Page views'),
00113 'width' => '150px',
00114 'index' => 'views',
00115 'filter' => false,
00116 ));
00117
00118 $this->addColumn('active',
00119 array(
00120 'header' => $this->__('Active'),
00121 'width' => '150px',
00122 'type' => 'options',
00123 'width' => '70px',
00124 'options' => Mage::getSingleton('googlebase/source_statuses')->getStatuses(),
00125 'index' => 'is_hidden',
00126 ));
00127
00128 return parent::_prepareColumns();
00129 }
00130
00131 protected function _prepareMassaction()
00132 {
00133 $this->setMassactionIdField('item_id');
00134 $this->getMassactionBlock()->setFormFieldName('item');
00135 $this->setNoFilterMassactionColumn(true);
00136
00137 $this->getMassactionBlock()->addItem('delete', array(
00138 'label' => $this->__('Delete'),
00139 'url' => $this->getUrl('*/*/massDelete', array('_current'=>true)),
00140 'confirm' => $this->__('Are you sure?')
00141 ));
00142
00143 $this->getMassactionBlock()->addItem('publish', array(
00144 'label' => $this->__('Publish'),
00145 'url' => $this->getUrl('*/*/massPublish', array('_current'=>true))
00146 ));
00147
00148 $this->getMassactionBlock()->addItem('unpublish', array(
00149 'label' => $this->__('Hide'),
00150 'url' => $this->getUrl('*/*/massHide', array('_current'=>true))
00151 ));
00152
00153 $this->getMassactionBlock()->addItem('refresh', array(
00154 'label' => $this->__('Synchronize'),
00155 'url' => $this->getUrl('*/*/refresh', array('_current'=>true)),
00156 'confirm' => $this->__('This action will update items statistics and remove the items which are not available in Google Base. Continue?')
00157 ));
00158 return $this;
00159 }
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 public function getGridUrl()
00184 {
00185 return $this->getUrl('*/*/grid', array('_current'=>true));
00186 }
00187
00188 protected function _getStore()
00189 {
00190 return Mage::app()->getStore($this->getRequest()->getParam('store'));
00191 }
00192 }