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
00035 class Mage_Adminhtml_Block_Newsletter_Queue_Edit extends Mage_Adminhtml_Block_Template
00036 {
00037
00038
00039
00040
00041
00042 public function getQueue()
00043 {
00044 return Mage::registry('current_queue');
00045 }
00046
00047 protected function _beforeToHtml() {
00048
00049 $this->setTemplate('newsletter/queue/edit.phtml');
00050
00051 $this->setChild('form',
00052 $this->getLayout()->createBlock('adminhtml/newsletter_queue_edit_form','form')
00053 );
00054
00055 return parent::_beforeToHtml();
00056 }
00057
00058 public function getSaveUrl()
00059 {
00060 return $this->getUrl('*/*/save',array('id'=>$this->getRequest()->getParam('id')));
00061 }
00062
00063 protected function _prepareLayout()
00064 {
00065 $this->setChild('save_button',
00066 $this->getLayout()->createBlock('adminhtml/widget_button')
00067 ->setData(array(
00068 'label' => Mage::helper('newsletter')->__('Save Newsletter'),
00069 'onclick' => 'queueControl.save()',
00070 'class' => 'save'
00071 ))
00072 );
00073
00074 $this->setChild('save_and_resume',
00075 $this->getLayout()->createBlock('adminhtml/widget_button')
00076 ->setData(array(
00077 'label' => Mage::helper('newsletter')->__('Save And Resume'),
00078 'onclick' => 'queueControl.resume()',
00079 'class' => 'save'
00080 ))
00081 );
00082
00083 $this->setChild('reset_button',
00084 $this->getLayout()->createBlock('adminhtml/widget_button')
00085 ->setData(array(
00086 'label' => Mage::helper('newsletter')->__('Reset'),
00087 'onclick' => 'window.location = window.location'
00088 ))
00089 );
00090
00091 $this->setChild('back_button',
00092 $this->getLayout()->createBlock('adminhtml/widget_button')
00093 ->setData(
00094 array(
00095 'label' => Mage::helper('newsletter')->__('Back'),
00096 'onclick' => "window.location.href = '" . $this->getUrl('*/*') . "'",
00097 'class' => 'back'
00098 )
00099 )
00100 );
00101
00102 $this->setChild('toggle_button',
00103 $this->getLayout()->createBlock('adminhtml/widget_button')
00104 ->setData(
00105 array(
00106 'label' => Mage::helper('newsletter')->__('Toggle Editor'),
00107 'onclick' => 'queueControl.toggleEditor();'
00108 )
00109 )
00110 );
00111 return parent::_prepareLayout();
00112 }
00113
00114 public function getToggleButtonHtml()
00115 {
00116 return $this->getChildHtml('toggle_button');
00117 }
00118
00119 public function getSaveButtonHtml()
00120 {
00121 return $this->getChildHtml('save_button');
00122 }
00123
00124 public function getResetButtonHtml()
00125 {
00126 return $this->getChildHtml('reset_button');
00127 }
00128
00129 public function getBackButtonHtml()
00130 {
00131 return $this->getChildHtml('back_button');
00132 }
00133
00134 public function getResumeButtonHtml()
00135 {
00136 return $this->getChildHtml('save_and_resume');
00137 }
00138
00139 public function getIsPreview()
00140 {
00141 return !in_array($this->getQueue()->getQueueStatus(), array(
00142 Mage_Newsletter_Model_Queue::STATUS_NEVER,
00143 Mage_Newsletter_Model_Queue::STATUS_PAUSE
00144 ));
00145 }
00146
00147 public function getIsTextType()
00148 {
00149 return $this->getQueue()->getTemplate()->isPlain();
00150 }
00151
00152 public function getCanResume()
00153 {
00154 return in_array($this->getQueue()->getQueueStatus(), array(
00155 Mage_Newsletter_Model_Queue::STATUS_PAUSE
00156 ));
00157 }
00158
00159 public function getHeaderText()
00160 {
00161 return ( $this->getIsPreview() ? Mage::helper('newsletter')->__('View Newsletter') : Mage::helper('newsletter')->__('Edit Newsletter'));
00162 }
00163 }