Mage_Adminhtml_Block_Newsletter_Queue_Edit_Form Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Newsletter_Queue_Edit_Form:

Mage_Adminhtml_Block_Widget_Form Mage_Adminhtml_Block_Widget Mage_Adminhtml_Block_Template Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Protected Member Functions

 _prepareForm ()


Detailed Description

Definition at line 35 of file Form.php.


Member Function Documentation

_prepareForm (  )  [protected]

Prepare form before rendering HTML

Returns:
Mage_Adminhtml_Block_Widget_Form

Reimplemented from Mage_Adminhtml_Block_Widget_Form.

Definition at line 37 of file Form.php.

00038     {
00039         $queue = Mage::getSingleton('newsletter/queue');
00040 
00041         $form = new Varien_Data_Form();
00042 
00043         $fieldset = $form->addFieldset('base_fieldset', array(
00044             'legend'    =>  Mage::helper('newsletter')->__('Queue Information')
00045         ));
00046 
00047         $outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
00048 
00049         if($queue->getQueueStatus() == Mage_Newsletter_Model_Queue::STATUS_NEVER) {
00050             $fieldset->addField('date', 'date',array(
00051                 'name'      =>    'start_at',
00052                 'time'      =>    true,
00053                 'format'    =>    $outputFormat,
00054                 'label'     =>    Mage::helper('newsletter')->__('Queue Date Start'),
00055                 'image'     =>    $this->getSkinUrl('images/grid-cal.gif')
00056             ));
00057 
00058             if (!Mage::app()->isSingleStoreMode()) {
00059                 $fieldset->addField('stores','multiselect',array(
00060                     'name'          => 'stores[]',
00061                     'label'         => Mage::helper('newsletter')->__('Subscribers From'),
00062                     'image'         => $this->getSkinUrl('images/grid-cal.gif'),
00063                     'values'        => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
00064                     'value'         => $queue->getStores()
00065                 ));
00066             }
00067             else {
00068                 $fieldset->addField('stores', 'hidden', array(
00069                     'name'      => 'stores[]',
00070                     'value'     => Mage::app()->getStore(true)->getId()
00071                 ));
00072             }
00073         } else {
00074             $fieldset->addField('date','date',array(
00075                 'name'      => 'start_at',
00076                 'time'      => true,
00077                 'disabled'  => 'true',
00078                 'format'    => $outputFormat,
00079                 'label'     => Mage::helper('newsletter')->__('Queue Date Start'),
00080                 'image'     => $this->getSkinUrl('images/grid-cal.gif')
00081             ));
00082 
00083             if (!Mage::app()->isSingleStoreMode()) {
00084                 $fieldset->addField('stores','multiselect',array(
00085                     'name'          => 'stores[]',
00086                     'label'         => Mage::helper('newsletter')->__('Subscribers From'),
00087                     'image'         => $this->getSkinUrl('images/grid-cal.gif'),
00088                     'required'      => true,
00089                     'values'        => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
00090                     'value'         => $queue->getStores()
00091                 ));
00092             }
00093             else {
00094                 $fieldset->addField('stores', 'hidden', array(
00095                     'name'      => 'stores[]',
00096                     'value'     => Mage::app()->getStore(true)->getId()
00097                 ));
00098             }
00099         }
00100 
00101         if ($queue->getQueueStartAt()) {
00102             $form->getElement('date')->setValue(
00103                 Mage::app()->getLocale()->date($queue->getQueueStartAt(), Varien_Date::DATETIME_INTERNAL_FORMAT)
00104             );
00105         }
00106 
00107         $fieldset->addField('subject', 'text', array(
00108             'name'      =>'subject',
00109             'label'     => Mage::helper('newsletter')->__('Subject'),
00110             'required'  => true,
00111             'value'     => $queue->getTemplate()->getTemplateSubject()
00112         ));
00113 
00114         $fieldset->addField('sender_name', 'text', array(
00115             'name'      =>'sender_name',
00116             'label'     => Mage::helper('newsletter')->__('Sender Name'),
00117             'title'     => Mage::helper('newsletter')->__('Sender Name'),
00118             'required'  => true,
00119             'value'     => $queue->getTemplate()->getTemplateSenderName()
00120         ));
00121 
00122         $fieldset->addField('sender_email', 'text', array(
00123             'name'      =>'sender_email',
00124             'label'     => Mage::helper('newsletter')->__('Sender Email'),
00125             'title'     => Mage::helper('newsletter')->__('Sender Email'),
00126             'class'     => 'validate-email',
00127             'required'  => true,
00128             'value'     => $queue->getTemplate()->getTemplateSenderEmail()
00129         ));
00130 
00131         if (in_array($queue->getQueueStatus(), array(
00132                 Mage_Newsletter_Model_Queue::STATUS_NEVER,
00133                 Mage_Newsletter_Model_Queue::STATUS_PAUSE))) {
00134 
00135             $fieldset->addField('text','editor', array(
00136                 'name'      => 'text',
00137                 'wysiwyg'   => !$queue->getTemplate()->isPlain(),
00138                 'label'     => Mage::helper('newsletter')->__('Message'),
00139                 'state'     => 'html',
00140                 'theme'     => 'advanced',
00141                 'required'  => true,
00142                 'value'     => $queue->getTemplate()->getTemplateTextPreprocessed(),
00143                 'style'     => 'width:98%; height: 600px;',
00144             ));
00145         } else {
00146             $fieldset->addField('text','text', array(
00147                 'name'      =>    'text',
00148                 'label'     =>    Mage::helper('newsletter')->__('Message'),
00149                 'value'     =>    $this->getUrl('*/newsletter_template/preview',  array(
00150                                      'id' => $queue->getTemplate()->getId()
00151                                   ))
00152             ));
00153 
00154             $form->getElement('text')->setRenderer(Mage::getModel('adminhtml/newsletter_renderer_text'));
00155             $form->getElement('subject')->setDisabled('true');
00156             $form->getElement('sender_name')->setDisabled('true');
00157             $form->getElement('sender_email')->setDisabled('true');
00158             $form->getElement('stores')->setDisabled('true');
00159         }
00160 
00161     /*
00162         $form->getElement('template')->setRenderer(
00163             $this->getLayout()->createBlock('adminhtml/newsletter_queue_edit_form_renderer_template')
00164         );
00165         */
00166 
00167 
00168         $this->setForm($form);
00169         return parent::_prepareForm();
00170     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:22:51 2009 for Magento by  doxygen 1.5.8