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 class Mage_Adminhtml_Block_Checkout_Agreement_Grid extends Mage_Adminhtml_Block_Widget_Grid
00027 {
00028
00029 public function __construct()
00030 {
00031 parent::__construct();
00032 $this->setDefaultSort('agreement_id');
00033 $this->setId('agreementGrid');
00034 $this->setDefaultDir('asc');
00035 $this->setSaveParametersInSession(true);
00036 }
00037
00038 protected function _prepareCollection()
00039 {
00040 $collection = Mage::getModel('checkout/agreement')
00041 ->getCollection();
00042 $this->setCollection($collection);
00043 return parent::_prepareCollection();
00044 }
00045
00046 protected function _prepareColumns()
00047 {
00048 $this->addColumn('agreement_id',
00049 array(
00050 'header'=>Mage::helper('checkout')->__('ID'),
00051 'align' =>'right',
00052 'width' => '50px',
00053 'index' => 'agreement_id'
00054 )
00055 );
00056
00057 $this->addColumn('name',
00058 array(
00059 'header'=>Mage::helper('checkout')->__('Condition Name'),
00060 'index' => 'name'
00061 )
00062 );
00063
00064 if (!Mage::app()->isSingleStoreMode()) {
00065 $this->addColumn('store_id', array(
00066 'header' => Mage::helper('adminhtml')->__('Store View'),
00067 'index' => 'store_id',
00068 'type' => 'store',
00069 'store_all' => true,
00070 'store_view' => true,
00071 'sortable' => false,
00072 'filter_condition_callback'
00073 => array($this, '_filterStoreCondition'),
00074 ));
00075 }
00076
00077 $this->addColumn('is_active', array(
00078 'header' => Mage::helper('adminhtml')->__('Status'),
00079 'index' => 'is_active',
00080 'type' => 'options',
00081 'options' => array(
00082 0 => Mage::helper('adminhtml')->__('Disabled'),
00083 1 => Mage::helper('adminhtml')->__('Enabled')
00084 ),
00085 ));
00086
00087 return parent::_prepareColumns();
00088 }
00089
00090 protected function _afterLoadCollection()
00091 {
00092 $this->getCollection()->walk('afterLoad');
00093 parent::_afterLoadCollection();
00094 }
00095
00096 protected function _filterStoreCondition($collection, $column)
00097 {
00098 if (!$value = $column->getFilter()->getValue()) {
00099 return;
00100 }
00101
00102 $this->getCollection()->addStoreFilter($value);
00103 }
00104
00105 public function getRowUrl($row)
00106 {
00107 return $this->getUrl('*/*/edit', array('id' => $row->getId()));
00108 }
00109
00110 }