Mage_Adminhtml_Block_Review_Grid Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Review_Grid:

Mage_Adminhtml_Block_Widget_Grid Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 __construct ()
 getRowUrl ($row)
 getGridUrl ()

Protected Member Functions

 _prepareCollection ()
 _prepareColumns ()
 _prepareMassaction ()


Detailed Description

Definition at line 34 of file Grid.php.


Constructor & Destructor Documentation

__construct (  ) 

Constructor

By default is looking for first argument as array and assignes it as object attributes This behaviour may change in child classes

Reimplemented from Varien_Object.

Definition at line 37 of file Grid.php.

00038     {
00039         parent::__construct();
00040         $this->setId('reviwGrid');
00041         $this->setDefaultSort('created_at');
00042     }


Member Function Documentation

_prepareCollection (  )  [protected]

Prepare grid collection object

Returns:
this

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 44 of file Grid.php.

00045     {
00046         $model = Mage::getModel('review/review');
00047         $collection = $model->getProductCollection();
00048 
00049         if ($this->getProductId() || $this->getRequest()->getParam('productId', false)) {
00050             $this->setProductId(($this->getProductId() ? $this->getProductId() : $this->getRequest()->getParam('productId')));
00051             $collection->addEntityFilter($this->getProductId());
00052         }
00053 
00054         if ($this->getCustomerId() || $this->getRequest()->getParam('customerId', false)) {
00055             $this->setCustomerId(($this->getCustomerId() ? $this->getCustomerId() : $this->getRequest()->getParam('customerId')));
00056             $collection->addCustomerFilter($this->getCustomerId());
00057         }
00058 
00059         if (Mage::registry('usePendingFilter') === true) {
00060             $collection->addStatusFilter($model->getPendingStatus());
00061         }
00062 
00063         $collection->addStoreData();
00064 
00065         $this->setCollection($collection);
00066         return parent::_prepareCollection();
00067     }

_prepareColumns (  )  [protected]

Check is single store mode

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 69 of file Grid.php.

00070     {
00071         $statuses = Mage::getModel('review/review')
00072             ->getStatusCollection()
00073             ->load()
00074             ->toOptionArray();
00075 
00076         foreach( $statuses as $key => $status ) {
00077             $tmpArr[$status['value']] = $status['label'];
00078         }
00079 
00080         $statuses = $tmpArr;
00081 
00082         $this->addColumn('review_id', array(
00083             'header'        => Mage::helper('review')->__('ID'),
00084             'align'         => 'right',
00085             'width'         => '50px',
00086             'filter_index'  => 'rt.review_id',
00087             'index'         => 'review_id',
00088         ));
00089 
00090         $this->addColumn('created_at', array(
00091             'header'        => Mage::helper('review')->__('Created On'),
00092             'align'         => 'left',
00093             'type'          => 'datetime',
00094             'width'         => '100px',
00095             'filter_index'  => 'rt.created_at',
00096             'index'         => 'created_at',
00097         ));
00098 
00099         if( !Mage::registry('usePendingFilter') ) {
00100             $this->addColumn('status', array(
00101                 'header'        => Mage::helper('review')->__('Status'),
00102                 'align'         => 'left',
00103                 'type'          => 'options',
00104                 'options'       => $statuses,
00105                 'width'         => '100px',
00106                 'filter_index'  => 'rt.status_id',
00107                 'index'         => 'status_id',
00108             ));
00109         }
00110 
00111         $this->addColumn('title', array(
00112             'header'        => Mage::helper('review')->__('Title'),
00113             'align'         => 'left',
00114             'width'         => '100px',
00115             'filter_index'  => 'rdt.title',
00116             'index'         => 'title',
00117             'type'          => 'text',
00118             'truncate'      => 50,
00119             'escape'        => true,
00120         ));
00121 
00122         $this->addColumn('nickname', array(
00123             'header'        => Mage::helper('review')->__('Nickname'),
00124             'align'         => 'left',
00125             'width'         => '100px',
00126             'filter_index'  => 'rdt.nickname',
00127             'index'         => 'nickname',
00128             'type'          => 'text',
00129             'truncate'      => 50,
00130             'escape'        => true,
00131         ));
00132 
00133         $this->addColumn('detail', array(
00134             'header'        => Mage::helper('review')->__('Review'),
00135             'align'         => 'left',
00136             'index'         => 'detail',
00137             'filter_index'  => 'rdt.detail',
00138             'type'          => 'text',
00139             'truncate'      => 50,
00140             'nl2br'         => true,
00141             'escape'        => true,
00142         ));
00143 
00144         /**
00145          * Check is single store mode
00146          */
00147         if (!Mage::app()->isSingleStoreMode()) {
00148             $this->addColumn('visible_in', array(
00149                 'header'    => Mage::helper('review')->__('Visible In'),
00150                 'index'     => 'stores',
00151                 'type'      => 'store',
00152                 'store_view' => true,
00153             ));
00154         }
00155 
00156         $this->addColumn('type', array(
00157             'header'    => Mage::helper('review')->__('Type'),
00158             'type'      => 'select',
00159             'index'     => 'type',
00160             'filter'    => 'adminhtml/review_grid_filter_type',
00161             'renderer'  => 'adminhtml/review_grid_renderer_type'
00162         ));
00163 
00164         $this->addColumn('name', array(
00165             'header'    => Mage::helper('review')->__('Product Name'),
00166             'align'     =>'left',
00167             'type'      => 'text',
00168             'index'     => 'name',
00169         ));
00170 
00171         $this->addColumn('sku', array(
00172             'header'    => Mage::helper('review')->__('Product SKU'),
00173             'align'     => 'right',
00174             'type'      => 'text',
00175             'width'     => '50px',
00176             'index'     => 'sku',
00177         ));
00178 
00179         $this->addColumn('action',
00180             array(
00181                 'header'    => Mage::helper('adminhtml')->__('Action'),
00182                 'width'     => '50px',
00183                 'type'      => 'action',
00184                 'getter'     => 'getReviewId',
00185                 'actions'   => array(
00186                     array(
00187                         'caption' => Mage::helper('adminhtml')->__('Edit'),
00188                         'url'     => array(
00189                             'base'=>'*/catalog_product_review/edit',
00190                             'params'=> array(
00191                                 'productId' => $this->getProductId(),
00192                                 'customerId' => $this->getCustomerId(),
00193                                 'ret'       => ( Mage::registry('usePendingFilter') ) ? 'pending' : null
00194                             )
00195                          ),
00196                          'field'   => 'id'
00197                     )
00198                 ),
00199                 'filter'    => false,
00200                 'sortable'  => false
00201         ));
00202 
00203         $this->addRssList('rss/catalog/review', Mage::helper('catalog')->__('Pending Reviews RSS'));
00204 
00205         return parent::_prepareColumns();
00206     }

_prepareMassaction (  )  [protected]

Prepare grid massaction actions

Returns:
Mage_Adminhtml_Block_Widget_Grid

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 208 of file Grid.php.

00209     {
00210         if (Mage::registry('usePendingFilter') == true) {
00211             $this->setMassactionIdField('review_id');
00212             $this->setMassactionIdFieldOnlyIndexValue(true);
00213             $this->getMassactionBlock()->setFormFieldName('reviews');
00214 
00215             $this->getMassactionBlock()->addItem('delete', array(
00216                 'label'=> Mage::helper('review')->__('Delete'),
00217                 'url'  => $this->getUrl('*/*/massDelete'),
00218                 'confirm' => Mage::helper('review')->__('Are you sure?')
00219             ));
00220 
00221             $statuses = Mage::getModel('review/review')
00222                 ->getStatusCollection()
00223                 ->load()
00224                 ->toOptionArray();
00225             array_unshift($statuses, array('label'=>'', 'value'=>''));
00226             $this->getMassactionBlock()->addItem('update_status', array(
00227                 'label'         => Mage::helper('review')->__('Update status'),
00228                 'url'           => $this->getUrl('*/*/massUpdateStatus'),
00229                 'additional'    => array(
00230                     'status'    => array(
00231                         'name'      => 'status',
00232                         'type'      => 'select',
00233                         'class'     => 'required-entry',
00234                         'label'     => Mage::helper('review')->__('Status'),
00235                         'values'    => $statuses
00236                     )
00237                 )
00238             ));
00239 
00240         }
00241     }

getGridUrl (  ) 

Reimplemented from Mage_Adminhtml_Block_Widget_Grid.

Definition at line 253 of file Grid.php.

00254     {
00255         if( $this->getProductId() || $this->getCustomerId() ) {
00256             return $this->getUrl('*/catalog_product_review/' . (Mage::registry('usePendingFilter') ? 'pending' : ''), array(
00257                 'productId' => $this->getProductId(),
00258                 'customerId' => $this->getCustomerId(),
00259             ));
00260         } else {
00261             return $this->getCurrentUrl();
00262         }
00263     }

getRowUrl ( row  ) 

Definition at line 243 of file Grid.php.

00244     {
00245         return $this->getUrl('*/catalog_product_review/edit', array(
00246             'id' => $row->getReviewId(),
00247             'productId' => $this->getProductId(),
00248             'customerId' => $this->getCustomerId(),
00249             'ret'       => ( Mage::registry('usePendingFilter') ) ? 'pending' : null,
00250         ));
00251     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:57 2009 for Magento by  doxygen 1.5.8