Mage_Adminhtml_Block_Poll_Edit_Tab_Form Class Reference

Inheritance diagram for Mage_Adminhtml_Block_Poll_Edit_Tab_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         $form = new Varien_Data_Form();
00040 
00041         $fieldset = $form->addFieldset('poll_form', array('legend'=>Mage::helper('poll')->__('Poll information')));
00042         $fieldset->addField('poll_title', 'text', array(
00043             'label'     => Mage::helper('poll')->__('Poll Question'),
00044             'class'     => 'required-entry',
00045             'required'  => true,
00046             'name'      => 'poll_title',
00047         ));
00048 
00049         $fieldset->addField('closed', 'select', array(
00050             'label'     => Mage::helper('poll')->__('Status'),
00051             'name'      => 'closed',
00052             'values'    => array(
00053                 array(
00054                     'value'     => 1,
00055                     'label'     => Mage::helper('poll')->__('Closed'),
00056                 ),
00057 
00058                 array(
00059                     'value'     => 0,
00060                     'label'     => Mage::helper('poll')->__('Open'),
00061                 ),
00062             ),
00063         ));
00064 
00065         if (!Mage::app()->isSingleStoreMode()) {
00066             $fieldset->addField('store_ids', 'multiselect', array(
00067                 'label'     => Mage::helper('poll')->__('Visible In'),
00068                 'required'  => true,
00069                 'name'      => 'store_ids[]',
00070                 'values'    => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(),
00071                 'value'     => Mage::registry('poll_data')->getStoreIds()
00072             ));
00073         }
00074         else {
00075             $fieldset->addField('store_ids', 'hidden', array(
00076                 'name'      => 'store_ids[]',
00077                 'value'     => Mage::app()->getStore(true)->getId()
00078             ));
00079             Mage::registry('poll_data')->setStoreIds(Mage::app()->getStore(true)->getId());
00080         }
00081 
00082 
00083         if( Mage::getSingleton('adminhtml/session')->getPollData() ) {
00084             $form->setValues(Mage::getSingleton('adminhtml/session')->getPollData());
00085             Mage::getSingleton('adminhtml/session')->setPollData(null);
00086         } elseif( Mage::registry('poll_data') ) {
00087             $form->setValues(Mage::registry('poll_data')->getData());
00088 
00089             $fieldset->addField('was_closed', 'hidden', array(
00090                 'name'      => 'was_closed',
00091                 'no_span'   => true,
00092                 'value'     => Mage::registry('poll_data')->getClosed()
00093             ));
00094         }
00095 
00096         $this->setForm($form);
00097         return parent::_prepareForm();
00098     }


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

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