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_Customer_Edit_Tab_Newsletter_Grid extends Mage_Adminhtml_Block_Widget_Grid
35: {
36:
37: public function __construct()
38: {
39: parent::__construct();
40: $this->setId('queueGrid');
41: $this->setDefaultSort('start_at');
42: $this->setDefaultDir('desc');
43:
44: $this->setUseAjax(true);
45:
46: $this->setEmptyText(Mage::helper('customer')->__('No Newsletter Found'));
47:
48: }
49:
50: public function getGridUrl()
51: {
52: return $this->getUrl('*/*/newsletter', array('_current'=>true));
53: }
54:
55: protected function _prepareCollection()
56: {
57: $collection = Mage::getResourceModel('newsletter/queue_collection')
58: ->addTemplateInfo()
59: ->addSubscriberFilter(Mage::registry('subscriber')->getId());
60:
61: $this->setCollection($collection);
62:
63: return parent::_prepareCollection();
64: }
65:
66: protected function _prepareColumns()
67: {
68: $this->addColumn('queue_id', array(
69: 'header' => Mage::helper('customer')->__('ID'),
70: 'align' => 'left',
71: 'index' => 'queue_id',
72: 'width' => 10
73: ));
74:
75: $this->addColumn('start_at', array(
76: 'header' => Mage::helper('customer')->__('Newsletter Start'),
77: 'type' => 'datetime',
78: 'align' => 'center',
79: 'index' => 'queue_start_at',
80: 'default' => ' ---- '
81: ));
82:
83: $this->addColumn('finish_at', array(
84: 'header' => Mage::helper('customer')->__('Newsletter Finish'),
85: 'type' => 'datetime',
86: 'align' => 'center',
87: 'index' => 'queue_finish_at',
88: 'gmtoffset' => true,
89: 'default' => ' ---- '
90: ));
91:
92: $this->addColumn('letter_sent_at', array(
93: 'header' => Mage::helper('customer')->__('Newsletter Received'),
94: 'type' => 'datetime',
95: 'align' => 'center',
96: 'index' => 'letter_sent_at',
97: 'gmtoffset' => true,
98: 'default' => ' ---- '
99: ));
100:
101: $this->addColumn('template_subject', array(
102: 'header' => Mage::helper('customer')->__('Subject'),
103: 'align' => 'center',
104: 'index' => 'template_subject'
105: ));
106:
107: $this->addColumn('status', array(
108: 'header' => Mage::helper('customer')->__('Status'),
109: 'align' => 'center',
110: 'filter' => 'adminhtml/customer_edit_tab_newsletter_grid_filter_status',
111: 'index' => 'queue_status',
112: 'renderer' => 'adminhtml/customer_edit_tab_newsletter_grid_renderer_status'
113: ));
114:
115: $this->addColumn('action', array(
116: 'header' => Mage::helper('customer')->__('Action'),
117: 'align' => 'center',
118: 'filter' => false,
119: 'sortable' => false,
120: 'renderer' => 'adminhtml/customer_edit_tab_newsletter_grid_renderer_action'
121: ));
122:
123: return parent::_prepareColumns();
124: }
125:
126: }
127: