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_Queue_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: $this->setSaveParametersInSession(true);
44: $this->setUseAjax(true);
45: }
46:
47: protected function _prepareCollection()
48: {
49: $collection = Mage::getResourceModel('newsletter/queue_collection')
50: ->addSubscribersInfo();
51:
52: $this->setCollection($collection);
53:
54: return parent::_prepareCollection();
55: }
56:
57: protected function _prepareColumns()
58: {
59: $this->addColumn('queue_id', array(
60: 'header' => Mage::helper('newsletter')->__('ID'),
61: 'index' => 'queue_id',
62: 'width' => 10
63: ));
64:
65: $this->addColumn('start_at', array(
66: 'header' => Mage::helper('newsletter')->__('Queue Start'),
67: 'type' => 'datetime',
68: 'index' => 'queue_start_at',
69: 'gmtoffset' => true,
70: 'default' => ' ---- '
71: ));
72:
73: $this->addColumn('finish_at', array(
74: 'header' => Mage::helper('newsletter')->__('Queue Finish'),
75: 'type' => 'datetime',
76: 'index' => 'queue_finish_at',
77: 'gmtoffset' => true,
78: 'default' => ' ---- '
79: ));
80:
81: $this->addColumn('newsletter_subject', array(
82: 'header' => Mage::helper('newsletter')->__('Subject'),
83: 'index' => 'newsletter_subject'
84: ));
85:
86: $this->addColumn('status', array(
87: 'header' => Mage::helper('newsletter')->__('Status'),
88: 'index' => 'queue_status',
89: 'type' => 'options',
90: 'options' => array(
91: Mage_Newsletter_Model_Queue::STATUS_SENT => Mage::helper('newsletter')->__('Sent'),
92: Mage_Newsletter_Model_Queue::STATUS_CANCEL => Mage::helper('newsletter')->__('Cancelled'),
93: Mage_Newsletter_Model_Queue::STATUS_NEVER => Mage::helper('newsletter')->__('Not Sent'),
94: Mage_Newsletter_Model_Queue::STATUS_SENDING => Mage::helper('newsletter')->__('Sending'),
95: Mage_Newsletter_Model_Queue::STATUS_PAUSE => Mage::helper('newsletter')->__('Paused'),
96: ),
97: 'width' => '100px',
98: ));
99:
100: $this->addColumn('subscribers_sent', array(
101: 'header' => Mage::helper('newsletter')->__('Processed'),
102: 'type' => 'number',
103: 'index' => 'subscribers_sent'
104: ));
105:
106: $this->addColumn('subscribers_total', array(
107: 'header' => Mage::helper('newsletter')->__('Recipients'),
108: 'type' => 'number',
109: 'index' => 'subscribers_total'
110: ));
111:
112: $this->addColumn('action', array(
113: 'header' => Mage::helper('newsletter')->__('Action'),
114: 'filter' => false,
115: 'sortable' => false,
116: 'no_link' => true,
117: 'width' => '100px',
118: 'renderer' => 'adminhtml/newsletter_queue_grid_renderer_action'
119: ));
120:
121: return parent::_prepareColumns();
122: }
123:
124: public function getRowUrl($row)
125: {
126: return $this->getUrl('*/*/edit', array('id'=>$row->getId()));
127: }
128:
129: }
130:
131: