*/ class Mage_Adminhtml_Block_Notification_Grid extends Mage_Adminhtml_Block_Widget_Grid { protected function _construct() { $this->setSaveParametersInSession(true); $this->setId('notificationGrid'); $this->setIdFieldName('notification_id'); $this->setDefaultSort('date_added', 'desc'); $this->setFilterVisibility(false); } /** * Init backups collection */ protected function _prepareCollection() { $collection = Mage::getModel('adminnotification/inbox') ->getCollection() ->addRemoveFilter(); $this->setCollection($collection); return parent::_prepareCollection(); } /** * Configuration of grid */ protected function _prepareColumns() { $this->addColumn('severity', array( 'header' => Mage::helper('adminnotification')->__('Severity'), 'width' => '60px', 'index' => 'severity', 'renderer' => 'adminhtml/notification_grid_renderer_severity', )); $this->addColumn('date_added', array( 'header' => Mage::helper('adminnotification')->__('Date Added'), 'index' => 'date_added', 'width' => '150px', 'type' => 'datetime' )); $this->addColumn('title', array( 'header' => Mage::helper('adminnotification')->__('Message'), 'index' => 'title', 'renderer' => 'adminhtml/notification_grid_renderer_notice', )); $this->addColumn('actions', array( 'header' => Mage::helper('adminnotification')->__('Actions'), 'width' => '250px', 'sortable' => false, 'renderer' => 'adminhtml/notification_grid_renderer_actions', )); return parent::_prepareColumns(); } /** * Prepare mass action */ protected function _prepareMassaction() { $this->setMassactionIdField('notification_id'); $this->getMassactionBlock()->setFormFieldName('notification'); $this->getMassactionBlock()->addItem('mark_as_read', array( 'label' => Mage::helper('adminnotification')->__('Mark as Read'), 'url' => $this->getUrl('*/*/massMarkAsRead', array('_current'=>true)), )); $this->getMassactionBlock()->addItem('remove', array( 'label' => Mage::helper('adminnotification')->__('Remove'), 'url' => $this->getUrl('*/*/massRemove'), 'confirm' => Mage::helper('adminnotification')->__('Are you sure?') )); // $this->getColumn('massaction')->setWidth('30px'); return $this; } public function getRowClass(Varien_Object $row) { return $row->getIsRead() ? 'read' : 'unread'; } public function getRowClickCallback() { return false; } }