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 class Mage_Adminhtml_Block_Cms_Page_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('cmsPageGrid');
00041 $this->setDefaultSort('identifier');
00042 $this->setDefaultDir('ASC');
00043 }
00044
00045 protected function _prepareCollection()
00046 {
00047 $collection = Mage::getModel('cms/page')->getCollection();
00048
00049 $collection->setFirstStoreFlag(true);
00050 $this->setCollection($collection);
00051
00052 return parent::_prepareCollection();
00053 }
00054
00055 protected function _prepareColumns()
00056 {
00057 $baseUrl = $this->getUrl();
00058
00059 $this->addColumn('title', array(
00060 'header' => Mage::helper('cms')->__('Title'),
00061 'align' => 'left',
00062 'index' => 'title',
00063 ));
00064
00065 $this->addColumn('identifier', array(
00066 'header' => Mage::helper('cms')->__('Identifier'),
00067 'align' => 'left',
00068 'index' => 'identifier'
00069 ));
00070
00071
00072
00073 $this->addColumn('root_template', array(
00074 'header' => Mage::helper('cms')->__('Layout'),
00075 'index' => 'root_template',
00076 'type' => 'options',
00077 'options' => Mage::getSingleton('page/source_layout')->getOptions(),
00078 ));
00079
00080
00081
00082
00083 if (!Mage::app()->isSingleStoreMode()) {
00084 $this->addColumn('store_id', array(
00085 'header' => Mage::helper('cms')->__('Store View'),
00086 'index' => 'store_id',
00087 'type' => 'store',
00088 'store_all' => true,
00089 'store_view' => true,
00090 'sortable' => false,
00091 'filter_condition_callback'
00092 => array($this, '_filterStoreCondition'),
00093 ));
00094 }
00095
00096 $this->addColumn('is_active', array(
00097 'header' => Mage::helper('cms')->__('Status'),
00098 'index' => 'is_active',
00099 'type' => 'options',
00100 'options' => array(
00101 0 => Mage::helper('cms')->__('Disabled'),
00102 1 => Mage::helper('cms')->__('Enabled')
00103 ),
00104 ));
00105
00106 $this->addColumn('creation_time', array(
00107 'header' => Mage::helper('cms')->__('Date Created'),
00108 'index' => 'creation_time',
00109 'type' => 'datetime',
00110 ));
00111
00112 $this->addColumn('update_time', array(
00113 'header' => Mage::helper('cms')->__('Last Modified'),
00114 'index' => 'update_time',
00115 'type' => 'datetime',
00116 ));
00117
00118 $this->addColumn('page_actions', array(
00119 'header' => Mage::helper('cms')->__('Action'),
00120 'width' => 10,
00121 'sortable' => false,
00122 'filter' => false,
00123 'renderer' => 'adminhtml/cms_page_grid_renderer_action',
00124 ));
00125
00126 return parent::_prepareColumns();
00127 }
00128
00129 protected function _afterLoadCollection()
00130 {
00131 $this->getCollection()->walk('afterLoad');
00132 parent::_afterLoadCollection();
00133 }
00134
00135 protected function _filterStoreCondition($collection, $column)
00136 {
00137 if (!$value = $column->getFilter()->getValue()) {
00138 return;
00139 }
00140
00141 $this->getCollection()->addStoreFilter($value);
00142 }
00143
00144
00145
00146
00147
00148
00149 public function getRowUrl($row)
00150 {
00151 return $this->getUrl('*/*/edit', array('page_id' => $row->getId()));
00152 }
00153 }