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_Promo_Catalog_Grid extends Mage_Adminhtml_Block_Widget_Grid
00036 {
00037
00038 public function __construct()
00039 {
00040 parent::__construct();
00041 $this->setId('promo_catalog_grid');
00042 $this->setDefaultSort('name');
00043 $this->setDefaultDir('ASC');
00044 $this->setSaveParametersInSession(true);
00045 }
00046
00047 protected function _prepareCollection()
00048 {
00049 $collection = Mage::getModel('catalogrule/rule')
00050 ->getResourceCollection();
00051 $this->setCollection($collection);
00052 return parent::_prepareCollection();
00053 }
00054
00055 protected function _prepareColumns()
00056 {
00057 $this->addColumn('rule_id', array(
00058 'header' => Mage::helper('catalogrule')->__('ID'),
00059 'align' =>'right',
00060 'width' => '50px',
00061 'index' => 'rule_id',
00062 ));
00063
00064 $this->addColumn('name', array(
00065 'header' => Mage::helper('catalogrule')->__('Rule Name'),
00066 'align' =>'left',
00067 'index' => 'name',
00068 ));
00069
00070 $this->addColumn('from_date', array(
00071 'header' => Mage::helper('catalogrule')->__('Date Start'),
00072 'align' => 'left',
00073 'width' => '120px',
00074 'type' => 'date',
00075 'index' => 'from_date',
00076 ));
00077
00078 $this->addColumn('to_date', array(
00079 'header' => Mage::helper('catalogrule')->__('Date Expire'),
00080 'align' => 'left',
00081 'width' => '120px',
00082 'type' => 'date',
00083 'default' => '--',
00084 'index' => 'to_date',
00085 ));
00086
00087 $this->addColumn('is_active', array(
00088 'header' => Mage::helper('catalogrule')->__('Status'),
00089 'align' => 'left',
00090 'width' => '80px',
00091 'index' => 'is_active',
00092 'type' => 'options',
00093 'options' => array(
00094 1 => 'Active',
00095 0 => 'Inactive',
00096 ),
00097 ));
00098
00099 return parent::_prepareColumns();
00100 }
00101
00102 public function getRowUrl($row)
00103 {
00104 return $this->getUrl('*/*/edit', array('id' => $row->getRuleId()));
00105 }
00106
00107 }