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_Notification_Grid extends Mage_Adminhtml_Block_Widget_Grid
00036 {
00037 protected function _construct()
00038 {
00039 $this->setSaveParametersInSession(true);
00040 $this->setId('notificationGrid');
00041 $this->setIdFieldName('notification_id');
00042 $this->setDefaultSort('date_added', 'desc');
00043 $this->setFilterVisibility(false);
00044 }
00045
00046
00047
00048
00049 protected function _prepareCollection()
00050 {
00051 $collection = Mage::getModel('adminnotification/inbox')
00052 ->getCollection()
00053 ->addRemoveFilter();
00054 $this->setCollection($collection);
00055 return parent::_prepareCollection();
00056 }
00057
00058
00059
00060
00061 protected function _prepareColumns()
00062 {
00063 $this->addColumn('severity', array(
00064 'header' => Mage::helper('adminnotification')->__('Severity'),
00065 'width' => '60px',
00066 'index' => 'severity',
00067 'renderer' => 'adminhtml/notification_grid_renderer_severity',
00068 ));
00069
00070 $this->addColumn('date_added', array(
00071 'header' => Mage::helper('adminnotification')->__('Date Added'),
00072 'index' => 'date_added',
00073 'width' => '150px',
00074 'type' => 'datetime'
00075 ));
00076
00077 $this->addColumn('title', array(
00078 'header' => Mage::helper('adminnotification')->__('Message'),
00079 'index' => 'title',
00080 'renderer' => 'adminhtml/notification_grid_renderer_notice',
00081 ));
00082
00083 $this->addColumn('actions', array(
00084 'header' => Mage::helper('adminnotification')->__('Actions'),
00085 'width' => '250px',
00086 'sortable' => false,
00087 'renderer' => 'adminhtml/notification_grid_renderer_actions',
00088 ));
00089
00090 return parent::_prepareColumns();
00091 }
00092
00093
00094
00095
00096 protected function _prepareMassaction()
00097 {
00098 $this->setMassactionIdField('notification_id');
00099 $this->getMassactionBlock()->setFormFieldName('notification');
00100
00101 $this->getMassactionBlock()->addItem('mark_as_read', array(
00102 'label' => Mage::helper('adminnotification')->__('Mark as Read'),
00103 'url' => $this->getUrl('*/*/massMarkAsRead', array('_current'=>true)),
00104 ));
00105
00106 $this->getMassactionBlock()->addItem('remove', array(
00107 'label' => Mage::helper('adminnotification')->__('Remove'),
00108 'url' => $this->getUrl('*/*/massRemove'),
00109 'confirm' => Mage::helper('adminnotification')->__('Are you sure?')
00110 ));
00111
00112
00113
00114 return $this;
00115 }
00116
00117 public function getRowClass(Varien_Object $row) {
00118 return $row->getIsRead() ? 'read' : 'unread';
00119 }
00120
00121 public function getRowClickCallback()
00122 {
00123 return false;
00124 }
00125 }