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:
35: class Mage_Adminhtml_Block_Newsletter_Queue_Grid_Renderer_Action extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
36: {
37: public function render(Varien_Object $row)
38: {
39: $actions = array();
40:
41: if($row->getQueueStatus()==Mage_Newsletter_Model_Queue::STATUS_NEVER) {
42: if(!$row->getQueueStartAt() && $row->getSubscribersTotal()) {
43: $actions[] = array(
44: 'url' => $this->getUrl('*/*/start', array('id'=>$row->getId())),
45: 'caption' => Mage::helper('newsletter')->__('Start')
46: );
47: }
48: } else if ($row->getQueueStatus()==Mage_Newsletter_Model_Queue::STATUS_SENDING) {
49: $actions[] = array(
50: 'url' => $this->getUrl('*/*/pause', array('id'=>$row->getId())),
51: 'caption' => Mage::helper('newsletter')->__('Pause')
52: );
53:
54: $actions[] = array(
55: 'url' => $this->getUrl('*/*/cancel', array('id'=>$row->getId())),
56: 'confirm' => Mage::helper('newsletter')->__('Do you really want to cancel the queue?'),
57: 'caption' => Mage::helper('newsletter')->__('Cancel')
58: );
59:
60:
61: } else if ($row->getQueueStatus()==Mage_Newsletter_Model_Queue::STATUS_PAUSE) {
62:
63: $actions[] = array(
64: 'url' => $this->getUrl('*/*/resume', array('id'=>$row->getId())),
65: 'caption' => Mage::helper('newsletter')->__('Resume')
66: );
67:
68: }
69:
70: $actions[] = array(
71: 'url' => $this->getUrl('*/newsletter_queue/preview',array('id'=>$row->getId())),
72: 'caption' => Mage::helper('newsletter')->__('Preview'),
73: 'popup' => true
74: );
75:
76: $this->getColumn()->setActions($actions);
77: return parent::render($row);
78: }
79: }
80: