PHP Varien_Data_Form Code Examples

This page contains top rated real world PHP examples of Varien_Data_Form extracted from open source projects. You can rate examples to help us improve the quality of examples
Example #1
Show file File: Form.php Project: hyhoocchan/mage-local
0
 /**
  * Prepare form before rendering HTML
  *
  * @return Enterprise_Staging_Block_Manage_Staging_Edit_Tabs_Website
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $config = Mage::getSingleton('enterprise_staging/staging_config');
     $log = $this->getLog();
     $staging = $log->getStaging();
     $fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('enterprise_staging')->__('General Information')));
     $fieldset->addField('created_at', 'label', array('label' => Mage::helper('enterprise_staging')->__('Logged At'), 'value' => $this->formatDate($log->getCreatedAt(), 'medium', true)));
     $fieldset->addField('action', 'label', array('label' => Mage::helper('enterprise_staging')->__('Action'), 'value' => Mage::helper('enterprise_staging')->__($config->getActionLabel($log->getAction()))));
     $fieldset->addField('status', 'label', array('label' => Mage::helper('enterprise_staging')->__('Status'), 'value' => Mage::helper('enterprise_staging')->__($config->getStatusLabel($log->getStatus()))));
     $additionalData = $log->getAdditionalData();
     if (!empty($additionalData)) {
         $additionalData = unserialize($additionalData);
         if (is_array($additionalData)) {
             if (isset($additionalData['schedule_date'])) {
                 $fieldset->addField('schedule_date', 'label', array('label' => Mage::helper('enterprise_staging')->__('Schedule Date'), 'value' => Mage::helper('core')->formatDate($additionalData['schedule_date'], Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true)));
             }
             if (isset($additionalData['action_before_reset'])) {
                 $fieldset->addField('action_before_reset', 'label', array('label' => Mage::helper('enterprise_staging')->__('Action Before Resetting'), 'value' => Mage::helper('enterprise_staging')->__($config->getActionLabel($additionalData['action_before_reset']))));
             }
         }
     }
     if ($log->getAction() == Enterprise_Staging_Model_Staging_Config::ACTION_UNSCHEDULE_MERGE) {
         $mergerUrl = $this->getUrl('*/staging_manage/merge', array('id' => $staging->getId()));
         $fieldset->addField('link_to_staging_merge', 'link', array('href' => $mergerUrl, 'label' => Mage::helper('enterprise_staging')->__('Scheduled Merger'), 'value' => $mergerUrl));
     }
     $form->addFieldNameSuffix($this->getFieldNameSuffix());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #2
Show file File: Main.php Project: xiaoguizhidao/BumblebeeSite
0
 /**
  * Preparation of current form
  *
  * @return Inic_Faq_Block_Admin_Edit_Tab_Main Self
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('faq');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('faq_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('faq')->__('General information'), 'class' => 'fieldset-wide'));
     if ($model->getFaqId()) {
         $fieldset->addField('faq_id', 'hidden', array('name' => 'faq_id'));
     }
     $approveInfo = $fieldset->addField('question', 'text', array('name' => 'question', 'label' => Mage::helper('faq')->__('FAQ item question'), 'title' => Mage::helper('faq')->__('FAQ item question'), 'required' => true));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $store_id = $fieldset->addField('store_id', 'multiselect', array('name' => 'store_id[]', 'label' => Mage::helper('faq')->__('Store view'), 'title' => Mage::helper('faq')->__('Store view'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $store_id = $fieldset->addField('store_id', 'hidden', array('name' => 'store_id[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $status = $fieldset->addField('is_active', 'select', array('label' => Mage::helper('faq')->__('Status'), 'title' => Mage::helper('faq')->__('Item status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('faq')->__('Enabled'), '0' => Mage::helper('faq')->__('Disabled'))));
     $fieldset->addField('is_most_frequent', 'select', array('label' => Mage::helper('faq')->__('Is Most Frequent'), 'title' => Mage::helper('faq')->__('Is Most Frequent'), 'name' => 'is_most_frequent', 'required' => true, 'options' => array('1' => Mage::helper('faq')->__('Yes'), '0' => Mage::helper('faq')->__('No'))));
     $category_id = $fieldset->addField('category_id', 'multiselect', array('label' => Mage::helper('faq')->__('Category'), 'title' => Mage::helper('faq')->__('Category'), 'name' => 'category_id[]', 'required' => false, 'values' => Mage::getResourceSingleton('faq/category_collection')->toOptionArray()));
     $fieldset->addField('answer', 'editor', array('name' => 'answer', 'label' => Mage::helper('faq')->__('Content'), 'title' => Mage::helper('faq')->__('Content'), 'style' => 'height:36em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'state' => 'html', 'required' => true));
     $data = $model->getData();
     if (!count($data)) {
         $data['store_id'] = 0;
     }
     $form->setValues($data);
     $this->setForm($form);
     $cat_id = $model->getData('category_id');
     $selected = $cat_id ? $cat_id : "";
     $this->setChild('form_after', $this->getLayout()->createBlock('faq/adminhtml_widget_form_element_selectdependence')->addFieldMap($store_id->getHtmlId(), $category_id->getHtmlId(), $selected));
     return parent::_prepareForm();
 }
Example #3
Show file File: Form.php Project: Hospeed/gamuza_freight-magento
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array("id" => "edit_form", "action" => $this->getUrl("*/*/save", array("id" => $this->getRequest()->getParam("id"))), "method" => "post"));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #4
Show file File: Labels.php Project: hientruong90/ee_14_installer
0
 protected function _prepareForm()
 {
     $rule = Mage::registry('current_promo_quote_rule');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('default_label_fieldset', array('legend' => Mage::helper('salesrule')->__('Default Label')));
     $labels = $rule->getStoreLabels();
     $fieldset->addField('store_default_label', 'text', array('name' => 'store_labels[0]', 'required' => false, 'label' => Mage::helper('salesrule')->__('Default Rule Label for All Store Views'), 'value' => isset($labels[0]) ? $labels[0] : ''));
     $fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('salesrule')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
     $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset');
     $fieldset->setRenderer($renderer);
     foreach (Mage::app()->getWebsites() as $website) {
         $fieldset->addField("w_{$website->getId()}_label", 'note', array('label' => $website->getName(), 'fieldset_html_class' => 'website'));
         foreach ($website->getGroups() as $group) {
             $stores = $group->getStores();
             if (count($stores) == 0) {
                 continue;
             }
             $fieldset->addField("sg_{$group->getId()}_label", 'note', array('label' => $group->getName(), 'fieldset_html_class' => 'store-group'));
             foreach ($stores as $store) {
                 $fieldset->addField("s_{$store->getId()}", 'text', array('name' => 'store_labels[' . $store->getId() . ']', 'required' => false, 'label' => $store->getName(), 'value' => isset($labels[$store->getId()]) ? $labels[$store->getId()] : '', 'fieldset_html_class' => 'store'));
             }
         }
     }
     if ($rule->isReadonly()) {
         foreach ($fieldset->getElements() as $element) {
             $element->setReadonly(true, true);
         }
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #5
Show file File: Info.php Project: evinw/project_bloom_magento
0
 public function initForm()
 {
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('_info');
     $model = Mage::registry('current_giftcardaccount');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('enterprise_giftcardaccount')->__('Information')));
     if ($model->getId()) {
         $fieldset->addField('code', 'label', array('name' => 'code', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card Code'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Gift Card Code')));
         $fieldset->addField('state_text', 'label', array('name' => 'state_text', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Status'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Status')));
     }
     $fieldset->addField('status', 'select', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Active'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Active'), 'name' => 'status', 'required' => true, 'options' => array(Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_ENABLED => Mage::helper('enterprise_giftcardaccount')->__('Yes'), Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_DISABLED => Mage::helper('enterprise_giftcardaccount')->__('No'))));
     if (!$model->getId()) {
         $model->setData('status', Enterprise_GiftCardAccount_Model_Giftcardaccount::STATUS_ENABLED);
     }
     $fieldset->addField('is_redeemable', 'select', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Redeemable'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Redeemable'), 'name' => 'is_redeemable', 'required' => true, 'options' => array(Enterprise_GiftCardAccount_Model_Giftcardaccount::REDEEMABLE => Mage::helper('enterprise_giftcardaccount')->__('Yes'), Enterprise_GiftCardAccount_Model_Giftcardaccount::NOT_REDEEMABLE => Mage::helper('enterprise_giftcardaccount')->__('No'))));
     if (!$model->getId()) {
         $model->setData('is_redeemable', Enterprise_GiftCardAccount_Model_Giftcardaccount::REDEEMABLE);
     }
     $fieldset->addField('website_id', 'select', array('name' => 'website_id', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Website'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Website'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(true)));
     $fieldset->addType('price', 'Enterprise_GiftCardAccount_Block_Adminhtml_Giftcardaccount_Form_Price');
     $fieldset->addField('balance', 'price', array('label' => Mage::helper('enterprise_giftcardaccount')->__('Balance'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Balance'), 'name' => 'balance', 'class' => 'validate-number', 'required' => true, 'note' => '<div id="balance_currency"></div>'));
     $fieldset->addField('date_expires', 'date', array('name' => 'date_expires', 'label' => Mage::helper('enterprise_giftcardaccount')->__('Expiration Date'), 'title' => Mage::helper('enterprise_giftcardaccount')->__('Expiration Date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $form->setValues($model->getData());
     $this->setForm($form);
     return $this;
 }
Example #6
Show file
0
 /**
  * Prepare form fields
  *
  * @return Mage_Adminhtml_Block_Catalog_Search_Edit_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_catalog_search');
     /* @var $model Mage_CatalogSearch_Model_Query */
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('catalog')->__('General Information')));
     $yesno = array(array('value' => 0, 'label' => Mage::helper('catalog')->__('No')), array('value' => 1, 'label' => Mage::helper('catalog')->__('Yes')));
     if ($model->getId()) {
         $fieldset->addField('query_id', 'hidden', array('name' => 'query_id'));
     }
     $fieldset->addField('query_text', 'text', array('name' => 'query_text', 'label' => Mage::helper('catalog')->__('Search Query'), 'title' => Mage::helper('catalog')->__('Search Query'), 'required' => true));
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'select', array('name' => 'store_id', 'label' => Mage::helper('catalog')->__('Store'), 'title' => Mage::helper('catalog')->__('Store'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(true, false), 'required' => true));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id'));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     if ($model->getId()) {
         $fieldset->addField('num_results', 'text', array('name' => 'num_results', 'label' => Mage::helper('catalog')->__('Number of results<br/>(For the last time placed)'), 'title' => Mage::helper('catalog')->__('Number of results<br/>(For the last time placed)'), 'required' => true));
         $fieldset->addField('popularity', 'text', array('name' => 'popularity', 'label' => Mage::helper('catalog')->__('Number of Uses'), 'title' => Mage::helper('catalog')->__('Number of Uses'), 'required' => true));
     }
     $afterElementHtml = '<p class="nm"><small>' . Mage::helper('catalog')->__('(Will make search for the query above return results for this search.)') . '</small></p>';
     $fieldset->addField('synonym_for', 'text', array('name' => 'synonym_for', 'label' => Mage::helper('catalog')->__('Synonym For'), 'title' => Mage::helper('catalog')->__('Synonym For'), 'after_element_html' => $afterElementHtml));
     $afterElementHtml = '<p class="nm"><small>' . Mage::helper('catalog')->__('ex. http://domain.com') . '</small></p>';
     $fieldset->addField('redirect', 'text', array('name' => 'redirect', 'label' => Mage::helper('catalog')->__('Redirect URL'), 'title' => Mage::helper('catalog')->__('Redirect URL'), 'class' => 'validate-url', 'after_element_html' => $afterElementHtml));
     $fieldset->addField('display_in_terms', 'select', array('name' => 'display_in_terms', 'label' => Mage::helper('catalog')->__('Display in Suggested Terms'), 'title' => Mage::helper('catalog')->__('Display in Suggested Terms'), 'values' => $yesno));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #7
Show file File: General.php Project: blazeriaz/youguess
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('general', array('legend' => Mage::helper('core')->__('General Settings')));
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'select', array('label' => Mage::helper('core')->__('Store'), 'title' => Mage::helper('core')->__('Store'), 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(), 'name' => 'store_id', 'required' => true));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'store_id', 'value' => Mage::app()->getStore(true)->getId()));
     }
     $fieldset->addField('design', 'select', array('label' => Mage::helper('core')->__('Custom Design'), 'title' => Mage::helper('core')->__('Custom Design'), 'values' => Mage::getSingleton('core/design_source_design')->getAllOptions(), 'name' => 'design', 'required' => true));
     $dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     $fieldset->addField('date_from', 'date', array('label' => Mage::helper('core')->__('Date From'), 'title' => Mage::helper('core')->__('Date From'), 'name' => 'date_from', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $fieldset->addField('date_to', 'date', array('label' => Mage::helper('core')->__('Date To'), 'title' => Mage::helper('core')->__('Date To'), 'name' => 'date_to', 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => $dateFormatIso));
     $formData = Mage::getSingleton('adminhtml/session')->getDesignData(true);
     if (!$formData) {
         $formData = Mage::registry('design')->getData();
     } else {
         $formData = $formData['design'];
     }
     $form->addValues($formData);
     $form->setFieldNameSuffix('design');
     $this->setForm($form);
 }
Example #8
Show file File: Googleoptimizer.php Project: natxetee/magento2
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('googleoptimizer_fields', array('legend' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Google Optimizer Scripts')));
     if ($this->getProduct()->getStoreId() == '0') {
         Mage::helper('Mage_GoogleOptimizer_Helper_Data')->setStoreId(Mage::app()->getDefaultStoreView());
     } else {
         Mage::helper('Mage_GoogleOptimizer_Helper_Data')->setStoreId($this->getProduct()->getStoreId());
     }
     $disabledScriptsFields = false;
     $values = array();
     if ($this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getData()) {
         $disabledScriptsFields = true;
         $values = $this->getGoogleOptimizer()->getData();
         $checkedUseDefault = true;
         if ($this->getGoogleOptimizer()->getStoreId() == $this->getProduct()->getStoreId()) {
             $checkedUseDefault = false;
             $disabledScriptsFields = false;
             $fieldset->addField('code_id', 'hidden', array('name' => 'code_id'));
         }
         // show 'use default' checkbox if store different for default and product has scripts for default store
         if ($this->getProduct()->getStoreId() != '0') {
             $fieldset->addField('store_flag', 'checkbox', array('name' => 'store_flag', 'value' => '1', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Use Default Values'), 'class' => 'checkbox', 'required' => false, 'onchange' => 'googleOptimizerScopeAction()'))->setIsChecked($checkedUseDefault);
         }
     }
     $fieldset->addField('conversion_page', 'select', array('name' => 'conversion_page', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page'), 'values' => Mage::getModel('Mage_GoogleOptimizer_Model_Adminhtml_System_Config_Source_Googleoptimizer_Conversionpages')->toOptionArray(), 'class' => 'select googleoptimizer validate-googleoptimizer', 'required' => false, 'onchange' => 'googleOptimizerConversionPageAction(this)'));
     if ($this->getProduct()->getStoreId() == '0' && !Mage::app()->hasSingleStore()) {
         $fieldset->addField('conversion_page_url', 'note', array('name' => 'conversion_page_url', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page URL'), 'text' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Please select store view to see the URL.')));
     } else {
         $fieldset->addField('conversion_page_url', 'text', array('name' => 'conversion_page_url', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Page URL'), 'class' => 'input-text', 'readonly' => 'readonly', 'required' => false, 'note' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Please copy and paste this value to experiment edit form.')));
     }
     $fieldset->addField('export_controls', 'text', array('name' => 'export_controls'));
     $fieldset->addField('control_script', 'textarea', array('name' => 'control_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Control Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $fieldset->addField('tracking_script', 'textarea', array('name' => 'tracking_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Tracking Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $fieldset->addField('conversion_script', 'textarea', array('name' => 'conversion_script', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Conversion Script'), 'class' => 'textarea googleoptimizer validate-googleoptimizer', 'required' => false));
     $attributes = Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getProductAttributes($this->getProduct());
     $fieldset->addField('attributes', 'multiselect', array('name' => 'attributes', 'label' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('Attributes'), 'class' => 'googleoptimizer validate-googleoptimizer validate-googleoptimizer-attributes', 'values' => $attributes, 'required' => false, 'onchange' => 'googleOptimizerAttributesCheckAction(this)', 'note' => Mage::helper('Mage_GoogleOptimizer_Helper_Data')->__('The limit is 8 attributes only.')));
     if (Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getConversionPagesUrl() && $this->getGoogleOptimizer() && $this->getGoogleOptimizer()->getConversionPage()) {
         $form->getElement('conversion_page_url')->setValue(Mage::helper('Mage_GoogleOptimizer_Helper_Data')->getConversionPagesUrl()->getData($this->getGoogleOptimizer()->getConversionPage()));
     }
     if ($disabledScriptsFields) {
         foreach ($fieldset->getElements() as $element) {
             if ($element->getType() == 'textarea' || $element->getType() == 'select') {
                 $element->setDisabled($disabledScriptsFields);
             }
         }
         $form->getElement('export_controls')->setDisabled($disabledScriptsFields);
     }
     $fakeEntityAttribute = Mage::getModel('Mage_Catalog_Model_Resource_Eav_Attribute');
     foreach ($fieldset->getElements() as $element) {
         if ($element->getId() != 'store_flag') {
             $element->setEntityAttribute($fakeEntityAttribute);
         }
     }
     $form->getElement('export_controls')->setRenderer($this->getLayout()->createBlock('Mage_GoogleOptimizer_Block_Adminhtml_Catalog_Form_Renderer_Import'));
     $form->addValues($values);
     $form->setFieldNameSuffix('googleoptimizer');
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #9
Show file File: Form.php Project: kanotest15/cbmagento
0
 /**
  * prepare tab form's information
  *
  * @return Magestore_RewardPoints_Block_Adminhtml_Spending_Edit_Tab_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     if (Mage::getSingleton('adminhtml/session')->getFormData()) {
         $data = Mage::getSingleton('adminhtml/session')->getFormData();
         Mage::getSingleton('adminhtml/session')->setFormData(null);
     } elseif (Mage::registry('rate_data')) {
         $data = Mage::registry('rate_data')->getData();
     }
     $fieldset = $form->addFieldset('rewardpoints_form', array('legend' => Mage::helper('rewardpoints')->__('Rate information')));
     $dataObj = new Varien_Object($data);
     $data = $dataObj->getData();
     $fieldset->addField('points', 'text', array('label' => Mage::helper('rewardpoints')->__('Spending Point(s)'), 'title' => Mage::helper('rewardpoints')->__('Spending Point(s)'), 'required' => true, 'name' => 'points'));
     $fieldset->addField('money', 'text', array('name' => 'money', 'label' => Mage::helper('rewardpoints')->__('Discount received'), 'title' => Mage::helper('rewardpoints')->__('Discount received'), 'required' => true, 'after_element_html' => '<strong>[' . Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE) . ']</strong>', 'note' => Mage::helper('rewardpoints')->__('the equivalent value of points')));
     //Hai.Tran 12/11/2013 fix gioi han spend points
     $fieldset->addField('max_price_spended_type', 'select', array('label' => Mage::helper('rewardpoints')->__('Limit spending points based on'), 'title' => Mage::helper('rewardpoints')->__('Limit spending points based on'), 'name' => 'max_price_spended_type', 'options' => array('none' => Mage::helper('rewardpoints')->__('None'), 'by_price' => Mage::helper('rewardpoints')->__('A fixed amount of Total Order Value'), 'by_percent' => Mage::helper('rewardpoints')->__('A percentage of Total Order Value')), 'onchange' => 'toggleMaxPriceSpend()', 'note' => Mage::helper('rewardpoints')->__('Select the type to limit spending points')));
     $fieldset->addField('max_price_spended_value', 'text', array('label' => Mage::helper('rewardpoints')->__('Limit value allowed to spend points at'), 'title' => Mage::helper('rewardpoints')->__('Limit value allowed to spend points at'), 'name' => 'max_price_spended_value', 'note' => Mage::helper('rewardpoints')->__('If empty or zero, there is no limitation.')));
     //End Hai.Tran 12/11/2013
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('rewardpoints')->__('Websites'), 'title' => Mage::helper('rewardpoints')->__('Websites'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_config_source_website')->toOptionArray()));
     } else {
         $fieldset->addField('website_ids', 'hidden', array('name' => 'website_ids[]', 'value' => Mage::app()->getStore(true)->getWebsiteId()));
         $data['website_ids'] = Mage::app()->getStore(true)->getWebsiteId();
     }
     $fieldset->addField('customer_group_ids', 'multiselect', array('label' => Mage::helper('rewardpoints')->__('Customer groups'), 'title' => Mage::helper('rewardpoints')->__('Customer groups'), 'name' => 'customer_group_ids', 'required' => true, 'values' => Mage::getResourceModel('customer/group_collection')->addFieldToFilter('customer_group_id', array('gt' => 0))->load()->toOptionArray()));
     $fieldset->addField('sort_order', 'text', array('label' => Mage::helper('rewardpoints')->__('Priority'), 'label' => Mage::helper('rewardpoints')->__('Priority'), 'required' => false, 'name' => 'sort_order', 'note' => Mage::helper('rewardpoints')->__('Higher priority Rate will be applied first')));
     $form->setValues($data);
     $this->setForm($form);
     Mage::dispatchEvent('rewardpoints_adminhtml_spending_rate_form', array('tab_form' => $this, 'form' => $form, 'data' => $dataObj));
     return parent::_prepareForm();
 }
Example #10
Show file File: Form.php Project: blazeriaz/youguess
0
 /**
  *
  * return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('checkout_agreement');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('checkout')->__('Terms and Conditions Information'), 'class' => 'fieldset-wide'));
     if ($model->getId()) {
         $fieldset->addField('agreement_id', 'hidden', array('name' => 'agreement_id'));
     }
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => Mage::helper('checkout')->__('Condition Name'), 'title' => Mage::helper('checkout')->__('Condition Name'), 'required' => true));
     $fieldset->addField('is_active', 'select', array('label' => Mage::helper('checkout')->__('Status'), 'title' => Mage::helper('checkout')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('checkout')->__('Enabled'), '0' => Mage::helper('checkout')->__('Disabled'))));
     $fieldset->addField('is_html', 'select', array('label' => Mage::helper('checkout')->__('Show Content as'), 'title' => Mage::helper('checkout')->__('Show Content as'), 'name' => 'is_html', 'required' => true, 'options' => array(0 => Mage::helper('checkout')->__('Text'), 1 => Mage::helper('checkout')->__('HTML'))));
     if (!Mage::app()->isSingleStoreMode()) {
         $field = $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('checkout')->__('Store View'), 'title' => Mage::helper('checkout')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $fieldset->addField('checkbox_text', 'editor', array('name' => 'checkbox_text', 'label' => Mage::helper('checkout')->__('Checkbox Text'), 'title' => Mage::helper('checkout')->__('Checkbox Text'), 'rows' => '5', 'cols' => '30', 'wysiwyg' => false, 'required' => true));
     $fieldset->addField('content', 'editor', array('name' => 'content', 'label' => Mage::helper('checkout')->__('Content'), 'title' => Mage::helper('checkout')->__('Content'), 'style' => 'height:24em;', 'wysiwyg' => false, 'required' => true));
     $fieldset->addField('content_height', 'text', array('name' => 'content_height', 'label' => Mage::helper('checkout')->__('Content Height (css)'), 'title' => Mage::helper('checkout')->__('Content Height'), 'maxlength' => 25, 'class' => 'validate-css-length'));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #11
Show file File: Main.php Project: ottonet/Magento-Faq
0
 /**
  * Preparation of current form
  *
  * @return Flagbit_Faq_Block_Admin_Edit_Tab_Main Self
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('faq');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('faq_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('flagbit_faq')->__('General information'), 'class' => 'fieldset-wide'));
     if ($model->getFaqId()) {
         $fieldset->addField('faq_id', 'hidden', array('name' => 'faq_id'));
     }
     $fieldset->addField('question', 'text', array('name' => 'question', 'label' => Mage::helper('flagbit_faq')->__('FAQ item question'), 'title' => Mage::helper('flagbit_faq')->__('FAQ item question'), 'required' => true));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store view'), 'title' => Mage::helper('cms')->__('Store view'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => Mage::helper('cms')->__('Status'), 'title' => Mage::helper('flagbit_faq')->__('Item status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('cms')->__('Enabled'), '0' => Mage::helper('cms')->__('Disabled'))));
     $fieldset->addField('category_id', 'multiselect', array('label' => Mage::helper('flagbit_faq')->__('Category'), 'title' => Mage::helper('flagbit_faq')->__('Category'), 'name' => 'categories[]', 'required' => false, 'values' => Mage::getResourceSingleton('flagbit_faq/category_collection')->toOptionArray()));
     $fieldset->addField('answer', 'editor', array('name' => 'answer', 'label' => Mage::helper('flagbit_faq')->__('Content'), 'title' => Mage::helper('flagbit_faq')->__('Content'), 'style' => 'height:36em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'required' => true));
     $fieldset->addField('answer_html', 'select', array('label' => Mage::helper('flagbit_faq')->__('HTML answer'), 'title' => Mage::helper('flagbit_faq')->__('HTML answer'), 'name' => 'answer_html', 'required' => true, 'options' => array('1' => Mage::helper('cms')->__('Enabled'), '0' => Mage::helper('cms')->__('Disabled'))));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #12
Show file File: Form.php Project: par-orillonsoft/magento_work
0
 protected function _prepareForm()
 {
     $actionUrl = $this->getUrl('*/*/sales');
     $form = new Varien_Data_Form(array('id' => 'filter_form', 'action' => $actionUrl, 'method' => 'get'));
     $htmlIdPrefix = 'orderplacedby_report_';
     $form->setHtmlIdPrefix($htmlIdPrefix);
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('reports')->__('Filter')));
     $adminUserModel = Mage::getModel('admin/user');
     $userCollection = $adminUserModel->getCollection()->load();
     //Mage::log($userCollection->getData());
     $dateFormatIso = "yyyy-MM-dd";
     $filter = $this->getRequest()->getParam('filter');
     if ($filter) {
         $data = explode("&", urldecode(base64_decode($filter)));
         $from = ltrim($data[0], 'from=');
         $to = ltrim($data[1], 'to=');
         echo $orderplacedby = ltrim($data[2], 'orderplacedby=');
     } else {
         $from = "";
         $to = "";
         $orderplacedby = "";
     }
     $fieldset->addField('from', 'date', array('name' => 'from', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('orderplacedby')->__('From'), 'title' => Mage::helper('orderplacedby')->__('From'), 'required' => true, 'value' => $from));
     $fieldset->addField('to', 'date', array('name' => 'to', 'format' => $dateFormatIso, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'label' => Mage::helper('orderplacedby')->__('To'), 'title' => Mage::helper('orderplacedby')->__('To'), 'required' => true, 'value' => $to));
     $fieldset->addField('orderplacedby', 'select', array('name' => 'orderplacedby', 'note' => 'Currently this filter will not work as it\'s not yet developed', 'label' => Mage::helper('orderplacedby')->__('Order Placed By'), 'title' => Mage::helper('orderplacedby')->__('Order Placed By'), 'values' => array(array('label' => '-- Select --', 'value' => ''), array('label' => 'Admin', 'value' => 'admin'), array('label' => 'Customer', 'value' => 'customer'))));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #13
Show file File: Settings.php Project: nayanchamp/magento2
0
 /**
  * Prepare form before rendering HTML
  *
  * @return Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Super_Settings
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('settings', array('legend' => Mage::helper('Mage_Catalog_Helper_Data')->__('Select Configurable Attributes ')));
     $product = $this->_getProduct();
     $attributes = $product->getTypeInstance()->getSetAttributes($product);
     $fieldset->addField('req_text', 'note', array('text' => '<ul class="messages"><li class="notice-msg"><ul><li>' . $this->__('Only attributes with scope "Global", input type "Dropdown" and Use To Create Configurable Product "Yes" are available.') . '</li></ul></li></ul>'));
     $fieldset->addField('change_attribute_set_button', 'note', array('text' => $this->getChildHtml('change_attribute_set_button')));
     $hasAttributes = false;
     foreach ($attributes as $attribute) {
         if ($product->getTypeInstance()->canUseAttribute($attribute, $product)) {
             $hasAttributes = true;
             $fieldset->addField('attribute_' . $attribute->getAttributeId(), 'checkbox', array('label' => $attribute->getFrontend()->getLabel(), 'title' => $attribute->getFrontend()->getLabel(), 'name' => 'attribute', 'class' => 'attribute-checkbox', 'value' => $attribute->getAttributeId()));
         }
     }
     if ($hasAttributes) {
         $fieldset->addField('attributes', 'hidden', array('name' => 'attribute_validate', 'value' => '', 'class' => 'validate-super-product-attributes'));
         $fieldset->addField('continue_button', 'note', array('text' => $this->getChildHtml('continue_button')));
     } else {
         $fieldset->addField('note_text', 'note', array('text' => $this->__('This attribute set does not have attributes which we can use for configurable product')));
         $fieldset->addField('back_button', 'note', array('text' => $this->getChildHtml('back_button')));
     }
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #14
Show file File: Main.php Project: CE-Webmaster/CE-Hub
0
 protected function _prepareForm()
 {
     /* @var $model Amasty_Xlanding_Model_Page */
     $model = Mage::registry('amlanding_page');
     /* @var $helper Amasty_Xlanding_Helper_Data */
     $helper = Mage::helper('amlanding');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('page_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => $helper->__('Page Information')));
     if ($model->getPageId()) {
         $fieldset->addField('page_id', 'hidden', array('name' => 'page_id'));
     }
     $fieldset->addField('title', 'text', array('name' => 'title', 'label' => $helper->__('Page Name'), 'title' => $helper->__('Page Name'), 'required' => true));
     $fieldset->addField('identifier', 'text', array('name' => 'identifier', 'label' => $helper->__('URL Key'), 'title' => $helper->__('URL Key'), 'required' => true, 'class' => 'validate-identifier', 'note' => $helper->__('Relative to Website Base URL')));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('label' => $helper->__('Stores'), 'name' => 'stores[]', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm()));
     } else {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
         $model->setStoreId(Mage::app()->getStore(true)->getId());
     }
     $fieldset->addField('is_active', 'select', array('label' => $helper->__('Status'), 'title' => $helper->__('Page Status'), 'name' => 'is_active', 'required' => true, 'options' => $helper->getAvailableStatuses()));
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #15
Show file File: Validation.php Project: monarcmoso/beta2
0
 protected function _prepareForm()
 {
     $model = Mage::getModel('webforms/webforms');
     $form = new Varien_Data_Form();
     $renderer = $this->getLayout()->createBlock('webforms/adminhtml_element_field');
     $form->setFieldsetElementRenderer($renderer);
     $form->setFieldNameSuffix('field');
     $form->setDataObject(Mage::registry('field'));
     $this->setForm($form);
     $fieldset = $form->addFieldset('webforms_form', array('legend' => Mage::helper('webforms')->__('Validation')));
     $fieldset->addField('validate_length_min', 'text', array('label' => Mage::helper('webforms')->__('Minimum length'), 'class' => 'validate-number', 'name' => 'validate_length_min'));
     $fieldset->addField('validate_length_max', 'text', array('label' => Mage::helper('webforms')->__('Maximum length'), 'class' => 'validate-number', 'name' => 'validate_length_max'));
     $fieldset->addField('validate_regex', 'text', array('label' => Mage::helper('webforms')->__('Validation RegEx'), 'name' => 'validate_regex', 'note' => Mage::helper('webforms')->__('Validate with custom regular expression')));
     $fieldset->addField('validate_message', 'textarea', array('label' => Mage::helper('webforms')->__('Validation error message'), 'name' => 'validate_message', 'note' => Mage::helper('webforms')->__('Displayed error message text if regex validation fails')));
     Mage::dispatchEvent('webforms_adminhtml_fields_edit_tab_design_prepare_form', array('form' => $form, 'fieldset' => $fieldset));
     if (Mage::registry('field')->getData('validate_length_min') == 0) {
         Mage::registry('field')->setData('validate_length_min', '');
     }
     if (Mage::registry('field')->getData('validate_length_max') == 0) {
         Mage::registry('field')->setData('validate_length_max', '');
     }
     if (Mage::getSingleton('adminhtml/session')->getWebFormsData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
         Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
     } elseif (Mage::registry('field')) {
         $form->setValues(Mage::registry('field')->getData());
     }
     return parent::_prepareForm();
 }
Example #16
Show file File: Social.php Project: bele90/magento-test2
0
 public function initForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('member_form', array('legend' => Mage::helper('bluecom_team')->__('Social links')));
     $fieldset->addField('skype', 'text', array('name' => 'skype', 'label' => Mage::helper('bluecom_team')->__('Skype ID'), 'title' => Mage::helper('bluecom_team')->__('Skype ID'), 'required' => false));
     $fieldset->addField('yahoo', 'text', array('name' => 'yahoo', 'label' => Mage::helper('bluecom_team')->__('Yahoo ID'), 'title' => Mage::helper('bluecom_team')->__('Yahoo ID'), 'required' => false));
     $fieldset->addField('facebook', 'text', array('name' => 'facebook', 'label' => Mage::helper('bluecom_team')->__('Facebook'), 'title' => Mage::helper('bluecom_team')->__('Facebook'), 'required' => false));
     $fieldset->addField('youtube', 'text', array('name' => 'youtube', 'label' => Mage::helper('bluecom_team')->__('Youtube'), 'title' => Mage::helper('bluecom_team')->__('Youtube'), 'required' => false));
     $fieldset->addField('linkedin', 'text', array('name' => 'linkedin', 'label' => Mage::helper('bluecom_team')->__('LinkedIn'), 'title' => Mage::helper('bluecom_team')->__('LinkedIn'), 'required' => false));
     if (Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
     }
     if (Mage::getSingleton('adminhtml/session')->getMemberData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getMemberData());
         Mage::getSingleton('adminhtml/session')->getMemberData(null);
     } elseif (Mage::registry('bluecom_team_member')) {
         $data = Mage::registry('bluecom_team_member');
         if ($data->getImageShortContent() == $data->getImageFullContent() || $data->getImageShortContent() == '' || !$data->getImageShortContent()) {
             $data->setUseFullImg(1);
         }
         $form->setValues($data->getData());
     }
     $this->setForm($form);
     return $this;
 }
Example #17
Show file File: General.php Project: hyhoocchan/mage-local
0
 /**
  * Prepare general properties form
  *
  * @return Enterprise_CustomerSegment_Block_Adminhtml_Customersegment_Edit_Tab_General
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_customer_segment');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('segment_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('enterprise_customersegment')->__('General Properties')));
     if ($model->getId()) {
         $fieldset->addField('segment_id', 'hidden', array('name' => 'segment_id'));
     }
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => Mage::helper('enterprise_customersegment')->__('Segment Name'), 'required' => true));
     $fieldset->addField('description', 'textarea', array('name' => 'description', 'label' => Mage::helper('enterprise_customersegment')->__('Description'), 'style' => 'height: 100px;'));
     if (Mage::app()->isSingleStoreMode()) {
         $websiteId = Mage::app()->getStore(true)->getWebsiteId();
         $fieldset->addField('website_ids', 'hidden', array('name' => 'website_ids[]', 'value' => $websiteId));
         $model->setWebsiteIds($websiteId);
     } else {
         $fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('enterprise_customersegment')->__('Assigned to Website'), 'title' => Mage::helper('enterprise_customersegment')->__('Assigned to Website'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm(), 'value' => $model->getWebsiteIds()));
     }
     $fieldset->addField('is_active', 'select', array('label' => Mage::helper('enterprise_customersegment')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('enterprise_customersegment')->__('Active'), '0' => Mage::helper('enterprise_customersegment')->__('Inactive'))));
     $applyToFieldConfig = array('label' => Mage::helper('enterprise_customersegment')->__('Apply To'), 'name' => 'apply_to', 'required' => false, 'disabled' => (bool) $model->getId(), 'options' => array(Enterprise_CustomerSegment_Model_Segment::APPLY_TO_VISITORS_AND_REGISTERED => Mage::helper('enterprise_customersegment')->__('Visitors and Registered Customers'), Enterprise_CustomerSegment_Model_Segment::APPLY_TO_REGISTERED => Mage::helper('enterprise_customersegment')->__('Registered Customers'), Enterprise_CustomerSegment_Model_Segment::APPLY_TO_VISITORS => Mage::helper('enterprise_customersegment')->__('Visitors')));
     if (!$model->getId()) {
         $applyToFieldConfig['note'] = Mage::helper('enterprise_customersegment')->__('Please save this information in order to specify the conditions for segmentation');
     }
     $fieldset->addField('apply_to', 'select', $applyToFieldConfig);
     if (!$model->getId()) {
         $model->setData('is_active', '1');
     }
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #18
Show file File: Images.php Project: hyhoocchan/mage-local
0
 /**
  * Prepare form
  *
  * @deprecated will delete in the next version
  * @throws Mage_Core_Exception
  * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form();
     $fieldset = $form->addFieldset('field_logo', array());
     $this->_addElementTypes($fieldset);
     $this->addImage($fieldset, 'conf[native][navigationBar][icon]', $this->__('Logo in Header'), $this->__('Recommended size %spx x %spx.', 35, 35), $this->_getDesignPreviewImageUrl('conf/native/navigationBar/icon'), true);
     $deviceType = Mage::helper('xmlconnect')->getDeviceType();
     switch ($deviceType) {
         case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPHONE:
             $this->addImage($fieldset, 'conf[native][body][bannerImage]', $this->__('Banner on Home Screen'), $this->__('Recommended size %spx x %spx.', 320, 230) . $this->__(' Note: Image size affects the performance of your app.') . $this->__('Keep your image size below %s KB for optimal performance.', 50), $this->_getDesignPreviewImageUrl('conf/native/body/bannerImage'), true);
             $this->addImage($fieldset, 'conf[native][body][backgroundImage]', $this->__('App Background'), $this->__('Recommended size %spx x %spx.', 320, 367) . $this->__('Note: Image size affects the performance of your app.') . $this->__('Keep your image size below %s KB for optimal performance.', 75), $this->_getDesignPreviewImageUrl('conf/native/body/backgroundImage'), true);
             break;
         case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_IPAD:
             $this->addImage($fieldset, 'conf[native][body][bannerIpadLandscapeImage]', $this->__('Banner on Home Screen (landscape mode)'), $this->__('Recommended size %spx x %spx.', 1024, 344) . $this->__('Note: Image size affects the performance of your app.'), $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadLandscapeImage'), true);
             $this->addImage($fieldset, 'conf[native][body][bannerIpadImage]', $this->__('Banner on Home Screen (portrait mode)'), $this->__('Recommended size %spx x %spx.', 768, 294) . $this->__('Note: Image size affects the performance of your app.'), $this->_getDesignPreviewImageUrl('conf/native/body/bannerIpadImage'), true);
             $this->addImage($fieldset, 'conf[native][body][backgroundIpadLandscapeImage]', $this->__('App Background (landscape mode)'), $this->__('Recommended size %spx x %spx.', 1024, 704) . $this->__('Note: Image size affects the performance of your app.'), $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadLandscapeImage'), true);
             $this->addImage($fieldset, 'conf[native][body][backgroundIpadPortraitImage]', $this->__('App Background (portrait mode)'), $this->__('Recommended size %spx x %spx.', 768, 960) . $this->__('Note: Image size affects the performance of your app.'), $this->_getDesignPreviewImageUrl('conf/native/body/backgroundIpadPortraitImage'), true);
             break;
         case Mage_XmlConnect_Helper_Data::DEVICE_TYPE_ANDROID:
             $this->addImage($fieldset, 'conf[native][body][bannerAndroidImage]', $this->__('Banner on Home Screen'), $this->__('Recommended size %spx x %spx.', 320, 258) . $this->__('Note: Image size affects the performance of your app.') . $this->__('Keep your image size below %s KB for optimal performance.', 50), $this->_getDesignPreviewImageUrl('conf/native/body/bannerAndroidImage'), true);
             break;
         default:
             Mage::throwException($this->__('Device doesn\'t recognized: "%s". Unable to load a helper.', $deviceType));
             break;
     }
     $form->setValues(Mage::helper('xmlconnect')->getApplication()->getFormData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #19
Show file File: Form.php Project: votanlean/Magento-Pruebas
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
     $form->setUseContainer(true);
     $this->setForm($form);
     $fieldset = $form->addFieldset('category_form', array('legend' => Mage::helper('blog')->__('Category Information')));
     $fieldset->addField('title', 'text', array('label' => Mage::helper('blog')->__('Title'), 'name' => 'title', 'required' => true));
     $fieldset->addField('identifier', 'text', array('label' => Mage::helper('blog')->__('Identifier'), 'name' => 'identifier', 'required' => true));
     $fieldset->addField('sort_order', 'text', array('label' => Mage::helper('blog')->__('Sort Order'), 'name' => 'sort_order'));
     /**
      * Check is single store mode
      */
     if (!Mage::app()->isSingleStoreMode()) {
         $fieldset->addField('store_id', 'multiselect', array('name' => 'stores[]', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
     }
     $fieldset->addField('meta_keywords', 'editor', array('name' => 'meta_keywords', 'label' => Mage::helper('blog')->__('Keywords'), 'title' => Mage::helper('blog')->__('Meta Keywords')));
     $fieldset->addField('meta_description', 'editor', array('name' => 'meta_description', 'label' => Mage::helper('blog')->__('Description'), 'title' => Mage::helper('blog')->__('Meta Description')));
     if (Mage::getSingleton('adminhtml/session')->getBlogData()) {
         $form->setValues(Mage::getSingleton('adminhtml/session')->getBlogData());
         Mage::getSingleton('adminhtml/session')->setBlogData(null);
     } elseif (Mage::registry('blog_data')) {
         $form->setValues(Mage::registry('blog_data')->getData());
     }
     return parent::_prepareForm();
 }
Example #20
Show file File: Form.php Project: nemphys/magento2
0
 /**
  * Prepare form before rendering HTML
  * Setting Form Fieldsets and fields
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => Mage::getSingleton('Mage_Adminhtml_Model_Session')->getNewApplication() ? $this->getUrl('*/mobile/edit', array('_current' => true)) : $this->getUrl('*/mobile/save'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #21
Show file File: Form.php Project: cewolf2002/magento
0
 /**
  * Prepare form
  *
  * @return Mage_Adminhtml_Block_Widget_Form
  */
 protected function _prepareForm()
 {
     $model = Mage::registry('current_template');
     if (!$model) {
         $model = new Varien_Object();
     }
     $action = $this->getUrl('*/*/saveTemplate');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $action, 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setHtmlIdPrefix('template_');
     $fieldset = $form->addFieldset('edit_template', array('legend' => $this->__('Template')));
     $this->_addElementTypes($fieldset);
     if ($model->getId()) {
         $fieldset->addField('id', 'hidden', array('name' => 'id'));
         $fieldset->addField('template_id', 'hidden', array('name' => 'template_id'));
     }
     $fieldset->addField('application_id', 'select', array('name' => 'application_id', 'label' => $this->__('Application'), 'title' => $this->__('Application'), 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false, 'values' => Mage::helper('xmlconnect')->getApplicationOptions(), 'note' => $this->__('Creating a Template is allowed only for applications which have device type iPhone.'), 'required' => true));
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name'), 'required' => true, 'disabled' => $model->getId() || !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 255'), 'maxlength' => 255));
     $fieldset->addField('push_title', 'text', array('name' => 'push_title', 'label' => $this->__('Push Title'), 'title' => $this->__('Push Title'), 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 140'), 'maxlength' => 140));
     $this->_dependentFields['message_title'] = $fieldset->addField('message_title', 'text', array('name' => 'message_title', 'label' => $this->__('Message Title'), 'title' => $this->__('Message Title'), 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'note' => $this->__('Maximum length is 255'), 'maxlength' => 255));
     $widgetFilters = array('is_email_compatible' => 1);
     $wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('widget_filters' => $widgetFilters));
     $this->_dependentFields['content'] = $fieldset->addField('content', 'editor', array('label' => $this->__('Template Content'), 'title' => $this->__('Template Content'), 'name' => 'content', 'style' => 'height:30em;', 'state' => 'html', 'required' => true, 'disabled' => !$this->_fieldsEnabled ? true : false, 'config' => $wysiwygConfig));
     $form->setValues($model->getData());
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #22
Show file File: Form.php Project: ashfaqphplhr/artificiallawnsforturf
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'config_edit_form', 'action' => $this->getUrl('M2ePro/adminhtml_configuration_license/confirmKey'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #23
Show file File: Form.php Project: okite11/frames21
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #24
Show file File: Form.php Project: hipay/hipay-fullservice-sdk-magento1
0
 protected function _prepareForm()
 {
     /* @var $profile Allopass_Hipay_Model_PaymentProfile */
     $profile = Mage::registry('payment_profile');
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/paymentProfile/save'), 'method' => 'post'));
     $fieldset = $form->addFieldset('paymentProfile_form', array('legend' => Mage::helper('hipay')->__('Payment Profile')));
     if ($profile->getProfileId()) {
         $fieldset->addField('profile_id', 'hidden', array('name' => 'profile_id'));
     }
     $fieldset->addField('name', 'text', array('label' => Mage::helper('hipay')->__('Name'), 'title' => Mage::helper('hipay')->__('Name'), 'class' => 'required-entry', 'required' => true, 'name' => 'name'));
     $fieldset->addField('period_unit', 'select', array('label' => $profile->getFieldLabel('period_unit'), 'title' => $profile->getFieldLabel('period_unit'), 'class' => 'required-entry', 'name' => 'period_unit', 'values' => Mage::getSingleton('hipay/paymentProfile')->getAllPeriodUnits(), 'note' => $this->__('Unit for billing during the subscription period.')));
     $fieldset->addField('period_frequency', 'text', array('label' => $profile->getFieldLabel('period_frequency'), 'title' => $profile->getFieldLabel('period_frequency'), 'class' => 'required-entry validate-number', 'required' => true, 'name' => 'period_frequency', 'note' => $this->__('Number of billing periods that make up one billing cycle.')));
     $fieldset->addField('period_max_cycles', 'text', array('label' => $profile->getFieldLabel('period_max_cycles'), 'title' => $profile->getFieldLabel('period_max_cycles'), 'class' => 'required-entry validate-number', 'required' => true, 'name' => 'period_max_cycles', 'note' => $this->__('The number of billing cycles for payment period.')));
     /*$fieldset->addField('payment_type', 'select', array(
       		'label'     => $profile->getPaymentTypeLabel('payment_type'),
       		'title'     => $profile->getPaymentTypeLabel('payment_type'),
       		'name'      => 'payment_type',
       		'values'    => $profile->getAllPaymentTypes(),
       )
       );*/
     $fieldset->addField('payment_type', "hidden", array('name' => 'payment_type'));
     $profile->setData('payment_type', "split_payment");
     $form->setUseContainer(true);
     $form->setValues($profile->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #25
Show file File: Main.php Project: xiaoguizhidao/blingjewelry-prod
0
 protected function _prepareForm()
 {
     $model = Mage::registry('permissions_user');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('user_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('adminhtml')->__('Account Information')));
     if ($model->getUserId()) {
         $fieldset->addField('user_id', 'hidden', array('name' => 'user_id'));
     } else {
         if (!$model->hasData('is_active')) {
             $model->setIsActive(1);
         }
     }
     $fieldset->addField('username', 'text', array('name' => 'username', 'label' => Mage::helper('adminhtml')->__('User Name'), 'id' => 'username', 'title' => Mage::helper('adminhtml')->__('User Name'), 'required' => true));
     $fieldset->addField('firstname', 'text', array('name' => 'firstname', 'label' => Mage::helper('adminhtml')->__('First Name'), 'id' => 'firstname', 'title' => Mage::helper('adminhtml')->__('First Name'), 'required' => true));
     $fieldset->addField('lastname', 'text', array('name' => 'lastname', 'label' => Mage::helper('adminhtml')->__('Last Name'), 'id' => 'lastname', 'title' => Mage::helper('adminhtml')->__('Last Name'), 'required' => true));
     $fieldset->addField('email', 'text', array('name' => 'email', 'label' => Mage::helper('adminhtml')->__('Email'), 'id' => 'customer_email', 'title' => Mage::helper('adminhtml')->__('User Email'), 'class' => 'required-entry validate-email', 'required' => true));
     $fieldset->addField('current_password', 'obscure', array('name' => 'current_password', 'label' => Mage::helper('adminhtml')->__('Current Admin Password'), 'id' => 'current_password', 'title' => Mage::helper('adminhtml')->__('Current Admin Password'), 'class' => 'input-text', 'required' => true));
     if ($model->getUserId()) {
         $fieldset->addField('password', 'password', array('name' => 'new_password', 'label' => Mage::helper('adminhtml')->__('New Password'), 'id' => 'new_pass', 'title' => Mage::helper('adminhtml')->__('New Password'), 'class' => 'input-text validate-admin-password'));
         $fieldset->addField('confirmation', 'password', array('name' => 'password_confirmation', 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 'id' => 'confirmation', 'class' => 'input-text validate-cpassword'));
     } else {
         $fieldset->addField('password', 'password', array('name' => 'password', 'label' => Mage::helper('adminhtml')->__('Password'), 'id' => 'customer_pass', 'title' => Mage::helper('adminhtml')->__('Password'), 'class' => 'input-text required-entry validate-admin-password', 'required' => true));
         $fieldset->addField('confirmation', 'password', array('name' => 'password_confirmation', 'label' => Mage::helper('adminhtml')->__('Password Confirmation'), 'id' => 'confirmation', 'title' => Mage::helper('adminhtml')->__('Password Confirmation'), 'class' => 'input-text required-entry validate-cpassword', 'required' => true));
     }
     if (Mage::getSingleton('admin/session')->getUser()->getId() != $model->getUserId()) {
         $fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('adminhtml')->__('This account is'), 'id' => 'is_active', 'title' => Mage::helper('adminhtml')->__('Account Status'), 'class' => 'input-select', 'style' => 'width: 80px', 'options' => array('1' => Mage::helper('adminhtml')->__('Active'), '0' => Mage::helper('adminhtml')->__('Inactive'))));
     }
     $fieldset->addField('user_roles', 'hidden', array('name' => 'user_roles', 'id' => '_user_roles'));
     $data = $model->getData();
     unset($data['password']);
     $form->setValues($data);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #26
Show file File: Options.php Project: sagmahajan/aswan_release
0
 protected function _prepareForm()
 {
     $model = Mage::registry('current_promo_quote_rule');
     //$form = new Varien_Data_Form(array('id' => 'edit_form1', 'action' => $this->getData('action'), 'method' => 'post'));
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('display_fieldset', array('legend' => Mage::helper('salesrule')->__('Using the form below you can enable, disable and configure display of the rule in customers\' account')));
     $oDb = Mage::getModel('sales_entity/order')->getReadConnection();
     $oSelect = $oDb->select();
     $oSelect->from(array('salesrule' => Mage::getSingleton('core/resource')->getTableName('aitoc_salesrule_display')), '*')->where('salesrule.rule_id = "' . $model->getRuleId() . '"');
     $aDisplayInfo = $oDb->fetchRow($oSelect);
     if ($aDisplayInfo) {
         $model->setAitloyaltyCustomerDisplayEnable('1');
         $model->setAitloyaltyCustomerDisplayCoupon($aDisplayInfo['coupone_enable']);
         $oSelect = $oDb->select();
         $oSelect->from(array('salesrule' => Mage::getSingleton('core/resource')->getTableName('aitoc_salesrule_display_title')), array('store_id', 'value'))->where('salesrule.rule_id = "' . $model->getRuleId() . '"');
         $aDisplayTitles = $oDb->fetchPairs($oSelect);
         $model->setAitloyaltyCustomerDisplayTitles($aDisplayTitles);
         #            d($aDisplayInfo, 1);
         //		    for titles !!!!!!!!!!!!111
         //		    $this->htmlEscape(
     }
     $fieldset->addField('aitloyalty_customer_display_enable', 'select', array('label' => Mage::helper('salesrule')->__('Display the rule in customers\' account'), 'title' => Mage::helper('salesrule')->__('Display the rule in customers\' account'), 'name' => 'aitloyalty_customer_display_enable', 'onchange' => 'aitloyalty_ActionOnRuleDisplayChange()', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No'))));
     $fieldset->addField('aitloyalty_customer_display_coupon', 'select', array('label' => Mage::helper('salesrule')->__('Display the coupon code in customers\' account (if applicable)'), 'title' => Mage::helper('salesrule')->__('Display the coupon code in customers\' account (if applicable)'), 'name' => 'aitloyalty_customer_display_coupon', 'options' => array('1' => Mage::helper('salesrule')->__('Yes'), '0' => Mage::helper('salesrule')->__('No'))));
     $fieldset->addField('aitloyalty_customer_display_title', 'text', array('name' => 'aitloyalty_customer_display_title', 'label' => Mage::helper('salesrule')->__(''), 'title' => Mage::helper('salesrule')->__(''), 'required' => true))->setRule($model)->setRenderer(Mage::getBlockSingleton('aitloyalty/quote_titles'));
     $form->setValues($model->getData());
     //$form->setUseContainer(true);
     $this->setForm($form);
     return $this;
 }
Example #27
Show file File: Form.php Project: hyhoocchan/mage-local
0
 /**
  * Prepare form before rendering HTML
  *
  * @return Mage_XmlConnect_Block_Adminhtml_Mobile_Submission_Form
  */
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/mobile/submission'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #28
Show file File: ICC_Freeresources_Block_Adminhtml_Freeresource_Subcategory_Edit_Tab_Form.php Project: ankita-parashar/magento
0
 /**
  * prepare the form
  * @access protected
  * @return Freeresources_Freeresource_Block_Adminhtml_Freeresource_Category_Edit_Tab_Form
  */
 protected function _prepareForm()
 {
     $freeresource = Mage::registry('current_freeresource');
     $category = Mage::registry('current_category');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('category_');
     $form->setFieldNameSuffix('category');
     $this->setForm($form);
     $fieldset = $form->addFieldset('category_form', array('legend' => Mage::helper('icc_freeresources')->__('Category')));
     $fieldset->addField('subcategory_id', 'hidden', array('name' => 'subcategory_id', 'label' => 'Sub Category Id', 'required' => false));
     $event = $fieldset->addField('freeresource_id', 'select', array('name' => 'freeresource_id', 'label' => 'Free Resource', 'values' => Mage::getModel('icc_freeresources/freeresource_category')->getAllOptions(), 'onchange' => 'checkSelectedItem(this)', 'required' => true));
     $event->setAfterElementHtml("<script type=\"text/javascript\">\r\n        function checkSelectedItem(selectElement) {\r\n            var category_subcategory_id = document.getElementById('category_subcategory_id').value;\r\n            var reloadurl = '" . $this->getUrl('icc_freeresources/freeresource') . "id/' + selectElement.value+'/subcatid/' + category_subcategory_id;\r\n            new Ajax.Request(reloadurl, {\r\n                method: 'get',\r\n                onLoading: function (transport) {\r\n                    \$('category_category_id').update('Searching...');\r\n                },\r\n                onComplete: function(transport) {\r\n                        \$('category_category_id').update(transport.responseText);\r\n                        disableSelectedItem();\r\n                }\r\n            });\r\n            \r\n        }\r\n        checkSelectedItem(document.getElementById('category_freeresource_id'));\r\n</script>");
     $fieldset->addField('category_id', 'select', array('name' => 'category_id', 'label' => 'Category', 'values' => Mage::getModel('icc_freeresources/freeresource_subcategory')->getAllOptions(), 'required' => true));
     $fieldset->addField('title', 'text', array('label' => Mage::helper('icc_freeresources')->__('Title'), 'name' => 'title', 'required' => true, 'class' => 'required-entry'));
     $fieldset->addField('description', 'editor', array('name' => 'description', 'label' => Mage::helper('icc_freeresources')->__('Description'), 'title' => Mage::helper('icc_freeresources')->__('Description'), 'style' => 'height:15em; width:50em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'wysiwyg' => true, 'required' => false));
     $fieldset->addField('product_title', 'text', array('label' => Mage::helper('icc_freeresources')->__('Product Title'), 'name' => 'product_title', 'required' => FALSE));
     $fieldset->addField('product_link', 'text', array('label' => Mage::helper('icc_freeresources')->__('Product Link'), 'name' => 'product_link', 'note' => Mage::helper('icc_freeresources')->__('Relative to Website Base URL')));
     $fieldset->addField('image_url', 'text', array('label' => Mage::helper('icc_freeresources')->__('Image URL'), 'name' => 'image_url', 'required' => false));
     $fieldset->addField('image_url_link', 'text', array('label' => Mage::helper('icc_freeresources')->__('Image Url Link'), 'name' => 'image_url_link', 'note' => Mage::helper('icc_freeresources')->__('Relative to Website Base URL')));
     $fieldset->addField('link_to_content', 'editor', array('name' => 'link_to_content', 'label' => Mage::helper('icc_freeresources')->__('Link To Content'), 'title' => Mage::helper('icc_freeresources')->__('Link To Content'), 'style' => 'height:15em; width:50em;', 'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(), 'wysiwyg' => true, 'required' => false));
     $fieldset->addField('download_url', 'text', array('label' => Mage::helper('icc_freeresources')->__('Download Url'), 'name' => 'download_url', 'required' => FALSE));
     $hideShow = $fieldset->addField('download_text', 'text', array('label' => Mage::helper('icc_freeresources')->__('Download Text'), 'name' => 'download_text', 'note' => Mage::helper('icc_freeresources')->__('Relative to Website Base URL')));
     $hideShow->setAfterElementHtml("<script type=\"text/javascript\">\r\n            function disableSelectedItem() {\r\n                var index = document.getElementById('category_freeresource_id').selectedIndex;\r\n                var value = document.getElementById('category_freeresource_id').options[index].text;\r\n                if (value == 'Free Codes') {\r\n                    document.getElementById('category_product_title').disabled = false;\r\n                    document.getElementById('category_product_link').disabled = false;\r\n\r\n                    document.getElementById('category_download_url').disabled = true;\r\n                    document.getElementById('category_download_text').disabled = true;\r\n                } else {\r\n                    document.getElementById('category_product_title').disabled = true;\r\n                    document.getElementById('category_product_link').disabled = true;\r\n\r\n                    document.getElementById('category_download_url').disabled = false;\r\n                    document.getElementById('category_download_text').disabled = false;\r\n                }\r\n            }\r\n</script>");
     $fieldset->addField('status', 'select', array('label' => Mage::helper('icc_freeresources')->__('Status'), 'name' => 'status', 'values' => array(array('value' => 1, 'label' => Mage::helper('icc_freeresources')->__('Enabled')), array('value' => 0, 'label' => Mage::helper('icc_freeresources')->__('Disabled')))));
     $form->addValues($this->getCategory()->getData());
     return parent::_prepareForm();
 }
Example #29
Show file File: Form.php Project: shebin512/Magento_Zoff
0
 protected function _prepareForm()
 {
     $form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
     $form->setUseContainer(true);
     $this->setForm($form);
     return parent::_prepareForm();
 }
Example #30
Show file File: Main.php Project: vdimitrovv/dotmailer-magento-extension
0
 protected function _prepareForm()
 {
     $model = Mage::registry('current_ddg_rule');
     $form = new Varien_Data_Form();
     $form->setHtmlIdPrefix('rule_');
     $fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('ddg')->__('Rule Information')));
     if ($model->getId()) {
         $fieldset->addField('id', 'hidden', array('name' => 'id'));
     }
     $fieldset->addField('name', 'text', array('name' => 'name', 'label' => Mage::helper('ddg')->__('Rule Name'), 'title' => Mage::helper('ddg')->__('Rule Name'), 'required' => true));
     $fieldset->addField('type', 'select', array('label' => Mage::helper('ddg')->__('Rule Type'), 'title' => Mage::helper('ddg')->__('Rule Type'), 'name' => 'type', 'required' => true, 'options' => array(Dotdigitalgroup_Email_Model_Rules::ABANDONED => 'Abandoned Cart Exclusion Rule', Dotdigitalgroup_Email_Model_Rules::REVIEW => 'Review Email Exclusion Rule')));
     $fieldset->addField('status', 'select', array('label' => Mage::helper('ddg')->__('Status'), 'title' => Mage::helper('ddg')->__('Status'), 'name' => 'status', 'required' => true, 'options' => array('1' => Mage::helper('ddg')->__('Active'), '0' => Mage::helper('ddg')->__('Inactive'))));
     if (!$model->getId()) {
         $model->setData('status', '0');
     }
     if (Mage::app()->isSingleStoreMode()) {
         $websiteId = Mage::app()->getStore(true)->getWebsiteId();
         $fieldset->addField('website_ids', 'hidden', array('name' => 'website_ids[]', 'value' => $websiteId));
         $model->setWebsiteIds($websiteId);
     } else {
         $field = $fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('ddg')->__('Websites'), 'title' => Mage::helper('ddg')->__('Websites'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getWebsiteValuesForForm()));
         $renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
         $field->setRenderer($renderer);
     }
     $form->setValues($model->getData());
     $this->setForm($form);
     return parent::_prepareForm();
 }