/**
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setData('use_container', true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #2
0
 /**
  * @return Varien_Data_Form
  */
 private function createForm()
 {
     /** @var Varien_Data_Form $result */
     $result = new Varien_Data_Form();
     $result->setData('html_id_prefix', 'rule_');
     $this->createFieldset($result);
     df_assert($result instanceof Varien_Data_Form);
     return $result;
 }
Example #3
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setData('use_container', true);
     $this->setForm($form);
     $this->_addBaseFieldset();
     $form->setValues($this->_getReport()->getData());
     return parent::_prepareForm();
 }
Example #4
0
 protected function _prepareForm()
 {
     //$form = new Varien_Data_Form(array("encrypt","multipart/form-data"));
     $form = new Varien_Data_Form(array('id' => 'addgiftvoucher', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setData('enctype', 'multipart/form-data');
     $form->setData('id', 'addgiftvoucher');
     $this->setForm($form);
     $fieldset = $form->addFieldset('customer', array('legend' => Mage::helper('giftcert')->__('Customer')));
     $fieldset->addField('customer_name', 'text', array('label' => Mage::helper('giftcert')->__('Customer name'), 'name' => 'customer_name'));
     $fieldset->addField('customer_email', 'text', array('label' => Mage::helper('giftcert')->__('Customer email'), 'name' => 'customer_email'));
     $fieldset_recipient = $form->addFieldset('recipient', array('legend' => Mage::helper('giftcert')->__('Recipient')));
     $fieldset_recipient->addField('recipient_name', 'text', array('label' => Mage::helper('giftcert')->__('Recipient name'), 'name' => 'recipient_name'));
     $fieldset_recipient->addField('recipient_email', 'text', array('label' => Mage::helper('giftcert')->__('Recipient email'), 'name' => 'recipient_email'));
     $fieldset_recipient->addField('recipient_address', 'textarea', array('label' => Mage::helper('giftcert')->__('Recipient Address'), 'name' => 'recipient_address'));
     $fieldsetmess = $form->addFieldset('message_set', array('legend' => Mage::helper('giftcert')->__('Message')));
     $fieldsetmess->addField('message', 'textarea', array('label' => Mage::helper('giftcert')->__('Message'), 'name' => 'message'));
     if (Mage::getSingleton('adminhtml/session')->getgiftcertData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getgiftcertData());
         Mage::getSingleton('adminhtml/session')->setgiftcertData(null);
     } elseif (Mage::registry('giftcert_data')) {
         $form->setValues(Mage::registry('giftcert_data')->getData());
     }
     return parent::_prepareForm();
 }
Example #5
0
 /**
  * @param Varien_Data_Form $form
  * @param RK_TypeCMS_Model_Page $page
  */
 public function init(Varien_Data_Form $form, RK_TypeCMS_Model_Page $page)
 {
     $attributes = $this->getAttributes();
     if (!count($attributes)) {
         return;
     }
     $fieldset = $form->addFieldset('typecms_fields', array('legend' => Mage::helper('typecms')->__('TypeCMS Fields'), 'class' => 'fieldset-wide'));
     foreach ($attributes as $code => $attribute) {
         $type = Mage::helper('typecms')->attributeTypeToFieldType($attribute['type']);
         $label = Mage::helper('typecms')->__($attribute['label']);
         if ($type == 'file') {
             $field = $fieldset->addField('typecms_' . $code, 'file', array('name' => 'typecms[' . $code . ']', 'label' => $label, 'after_element_html' => '<script type="text/javascript">setTimeout(function(){$(\'edit_form\').enctype = \'multipart/form-data\';}, 50);</script>'));
             if ($page->getData($code)) {
                 if ($attribute['type'] == 'image') {
                     $field->setData('after_element_html', '<br />
                     <img src="' . Mage::helper('typecms')->getBaseImageUrl() . $page->getData($code) . '" width="300" /><br />
                     <label><input type="checkbox" name="typecms[' . $code . '_delete]" value="1" /> Delete image</label>' . $field->getData('after_element_html'));
                 } else {
                     $field->setData('after_element_html', '<br />
                     ' . Mage::helper('typecms')->escapeHtml($page->getData($code)) . '<br />
                     <label><input type="checkbox" name="typecms[' . $code . '_delete]" value="1" /> Delete file</label>' . $field->getData('after_element_html'));
                 }
             }
             $form->setData('enctype', 'multipart/form-data');
         } else {
             $field = $fieldset->addField('typecms_' . $code, $type, array('name' => 'typecms[' . $code . ']', 'label' => $label));
         }
         if ($attribute['type'] == 'yesno') {
             $attribute['options'] = array(0 => 'No', 1 => 'Yes');
         }
         if ($type == 'editor') {
             $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => 'main'));
             $field->addData(array('style' => 'height:36em;', 'config' => $wysiwygConfig));
         } elseif ($type == 'select') {
             $field->addData(array('values' => $attribute['options']));
         }
     }
 }