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_Poll_Grid extends Mage_Adminhtml_Block_Widget_Grid
00035 {
00036
00037 public function __construct()
00038 {
00039 parent::__construct();
00040 $this->setId('pollGrid');
00041 $this->setDefaultSort('poll_title');
00042 $this->setDefaultDir('ASC');
00043 $this->setSaveParametersInSession(true);
00044 }
00045
00046 protected function _prepareCollection()
00047 {
00048 $collection = Mage::getModel('poll/poll')->getCollection();
00049 $this->setCollection($collection);
00050 parent::_prepareCollection();
00051
00052 if (!Mage::app()->isSingleStoreMode()) {
00053 $this->getCollection()->addStoreData();
00054 }
00055
00056 return $this;
00057 }
00058
00059 protected function _prepareColumns()
00060 {
00061 $this->addColumn('poll_id', array(
00062 'header' => Mage::helper('poll')->__('ID'),
00063 'align' =>'right',
00064 'width' => '50px',
00065 'index' => 'poll_id',
00066 ));
00067
00068 $this->addColumn('poll_title', array(
00069 'header' => Mage::helper('poll')->__('Poll Question'),
00070 'align' =>'left',
00071 'index' => 'poll_title',
00072 ));
00073
00074 $this->addColumn('votes_count', array(
00075 'header' => Mage::helper('poll')->__('Number of Responses'),
00076 'width' => '50px',
00077 'type' => 'number',
00078 'index' => 'votes_count',
00079 ));
00080
00081 $this->addColumn('date_posted', array(
00082 'header' => Mage::helper('poll')->__('Date Posted'),
00083 'align' => 'left',
00084 'width' => '120px',
00085 'type' => 'date',
00086 'index' => 'date_posted',
00087 ));
00088
00089 $this->addColumn('date_closed', array(
00090 'header' => Mage::helper('poll')->__('Date Closed'),
00091 'align' => 'left',
00092 'width' => '120px',
00093 'type' => 'date',
00094 'default' => '--',
00095 'index' => 'date_closed',
00096 ));
00097
00098 if (!Mage::app()->isSingleStoreMode()) {
00099 $this->addColumn('visible_in', array(
00100 'header' => Mage::helper('review')->__('Visible In'),
00101 'index' => 'stores',
00102 'type' => 'store',
00103 'store_view' => true,
00104 'sortable' => false,
00105 ));
00106 }
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121 $this->addColumn('closed', array(
00122 'header' => Mage::helper('poll')->__('Status'),
00123 'align' => 'left',
00124 'width' => '80px',
00125 'index' => 'closed',
00126 'type' => 'options',
00127 'options' => array(
00128 1 => Mage::helper('poll')->__('Closed'),
00129 0 => Mage::helper('poll')->__('Open')
00130 ),
00131 ));
00132
00133 return parent::_prepareColumns();
00134 }
00135
00136 public function getRowUrl($row)
00137 {
00138 return $this->getUrl('*/*/edit', array('id' => $row->getId()));
00139 }
00140
00141 }