1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
26:
27: 28: 29: 30: 31: 32: 33:
34: class Mage_Adminhtml_Block_Newsletter_Template_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36: protected function _construct()
37: {
38: $this->setEmptyText(Mage::helper('newsletter')->__('No Templates Found'));
39: }
40:
41: protected function _prepareCollection()
42: {
43: $collection = Mage::getResourceSingleton('newsletter/template_collection')
44: ->useOnlyActual();
45:
46: $this->setCollection($collection);
47:
48: return parent::_prepareCollection();
49: }
50:
51: protected function _prepareColumns()
52: {
53: $this->addColumn('template_code',
54: array('header'=>Mage::helper('newsletter')->__('ID'), 'align'=>'center', 'index'=>'template_id'));
55: $this->addColumn('code',
56: array(
57: 'header'=>Mage::helper('newsletter')->__('Template Name'),
58: 'index'=>'template_code'
59: ));
60:
61: $this->addColumn('added_at',
62: array(
63: 'header'=>Mage::helper('newsletter')->__('Date Added'),
64: 'index'=>'added_at',
65: 'gmtoffset' => true,
66: 'type'=>'datetime'
67: ));
68:
69: $this->addColumn('modified_at',
70: array(
71: 'header'=>Mage::helper('newsletter')->__('Date Updated'),
72: 'index'=>'modified_at',
73: 'gmtoffset' => true,
74: 'type'=>'datetime'
75: ));
76:
77: $this->addColumn('subject',
78: array(
79: 'header'=>Mage::helper('newsletter')->__('Subject'),
80: 'index'=>'template_subject'
81: ));
82:
83: $this->addColumn('sender',
84: array(
85: 'header'=>Mage::helper('newsletter')->__('Sender'),
86: 'index'=>'template_sender_email',
87: 'renderer' => 'adminhtml/newsletter_template_grid_renderer_sender'
88: ));
89:
90: $this->addColumn('type',
91: array(
92: 'header'=>Mage::helper('newsletter')->__('Template Type'),
93: 'index'=>'template_type',
94: 'type' => 'options',
95: 'options' => array(
96: Mage_Newsletter_Model_Template::TYPE_HTML => 'html',
97: Mage_Newsletter_Model_Template::TYPE_TEXT => 'text'
98: ),
99: ));
100:
101: $this->addColumn('action',
102: array(
103: 'header' => Mage::helper('newsletter')->__('Action'),
104: 'index' =>'template_id',
105: 'sortable' =>false,
106: 'filter' => false,
107: 'no_link' => true,
108: 'width' => '170px',
109: 'renderer' => 'adminhtml/newsletter_template_grid_renderer_action'
110: ));
111:
112: return $this;
113: }
114:
115: public function getRowUrl($row)
116: {
117: return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
118: }
119:
120: }
121:
122: