本文整理汇总了PHP中Varien_Data_Form::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::setAction方法的具体用法?PHP Varien_Data_Form::setAction怎么用?PHP Varien_Data_Form::setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('current_redirect_model');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('seo')->__('General'), 'class' => 'fieldset-wide'));
if ($model->getId()) {
$fieldset->addField('redirect_id', 'hidden', array('name' => 'redirect_id', 'value' => $model->getId()));
}
$fieldset->addField('url_from', 'text', array('name' => 'url_from', 'label' => Mage::helper('seo')->__('Request Url'), 'required' => true, 'value' => $model->getUrlFrom(), 'note' => 'Redirect if user opens this URL. E.g. \'/some/old/page\'.<br/>
You can use wildcards. E.g. \'/some/old/category/*\'.'));
$fieldset->addField('url_to', 'text', array('name' => 'url_to', 'label' => Mage::helper('seo')->__('Target Url'), 'required' => true, 'value' => $model->getUrlTo(), 'note' => 'Redirect to this URL. E.g. \'/some/new/page/\'.'));
$fieldset->addField('is_redirect_only_error_page', 'checkbox', array('label' => Mage::helper('seo')->__('Redirect only if request URL can\'t be found (404)'), 'name' => 'is_redirect_only_error_page', 'onclick' => 'this.value = this.checked ? 1 : 0;', 'checked' => $model->getIsRedirectOnlyErrorPage()));
$fieldset->addField('comments', 'textarea', array('label' => Mage::helper('seo')->__('Comments'), 'name' => 'comments', 'value' => $model->getComments()));
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('seo')->__('Status'), 'options' => array('1' => Mage::helper('seo')->__('Active'), '0' => Mage::helper('seo')->__('Inactive')), 'value' => $model->getIsActive()));
/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$field = $fieldset->addField('store_id', 'multiselect', array('name' => 'store_ids[]', 'label' => Mage::helper('seo')->__('Visible in Store View'), 'title' => Mage::helper('seo')->__('Visible in Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'value' => $model->getStoreIds()));
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'store_ids[]', 'value' => Mage::app()->getStore(true)->getId()));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}
$form->setAction($this->getUrl('*/*/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例2: _prepareForm
protected function _prepareForm()
{
$this->setTemplate('searchindex/form.phtml');
$model = Mage::registry('current_model');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$general = $form->addFieldset('general', array('legend' => __('General Information')));
if ($model->getId()) {
$general->addField('index_id', 'hidden', array('name' => 'index_id', 'value' => $model->getId()));
}
$general->addField('index_code', 'select', array('label' => __('Index'), 'required' => true, 'name' => 'index_code', 'value' => $model->getIndexCode(), 'values' => Mage::getSingleton('searchindex/system_config_source_index')->toOptionArray(), 'disabled' => $model->getIndexCode() ? true : false, 'note' => Mage::helper('searchindex/help')->field('index_code')));
$general->addField('title', 'text', array('name' => 'title', 'label' => __('Title'), 'required' => true, 'value' => $model->getTitle(), 'note' => Mage::helper('searchindex/help')->field('title')));
if (!$model->getId() || !$model->getIndexInstance()->isLocked()) {
$general->addField('position', 'text', array('name' => 'position', 'label' => __('Position'), 'required' => true, 'value' => $model->getPosition(), 'note' => Mage::helper('searchindex/help')->field('position')));
$general->addField('is_active', 'select', array('name' => 'is_active', 'label' => __('Active'), 'required' => true, 'value' => $model->getIsActive(), 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(), 'note' => Mage::helper('searchindex/help')->field('is_active')));
}
if ($model->getId()) {
// adding attribute fieldset
$attributes = $form->addFieldset('attributes', array('legend' => __('Attributes')));
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset')->setTemplate('searchindex/form/renderer/fieldset/attributes.phtml')->setAvailableAttributes($model->getIndexInstance()->getAvailableAttributes())->setAttributes($model->getAttributes());
$attributes->setName('attributes')->setRenderer($renderer);
// adding additional index fieldsets
foreach ($model->getIndexInstance()->getFieldsets() as $code) {
$class = "Mirasvit_SearchIndex_Block_Adminhtml_Index_Edit_Index_{$code}";
$fieldset = new $class();
$fieldset->setModel($model->getIndexInstance())->setId($class);
$form->addElement($fieldset);
}
}
$form->setAction($this->getUrl('*/*/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例3: _prepareForm
/**
* Prepare form fields and structure
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$model = Mage::registry('current_status');
$labels = $model ? $model->getStoreLabels() : array();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_Sales_Helper_Data')->__('Order Status Information')));
$fieldset->addField('is_new', 'hidden', array('name' => 'is_new', 'value' => 1));
$fieldset->addField('status', 'text', array('name' => 'status', 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Status Code'), 'class' => 'required-entry validate-code', 'required' => true));
$fieldset->addField('label', 'text', array('name' => 'label', 'label' => Mage::helper('Mage_Sales_Helper_Data')->__('Status Label'), 'class' => 'required-entry', 'required' => true));
$fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('Mage_Sales_Helper_Data')->__('Store View Specific Labels'), 'table_class' => 'form-list stores-tree'));
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("store_label_{$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 ($model) {
$form->addValues($model->getData());
}
$form->setAction($this->getUrl('*/sales_order_status/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例4: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('review_fieldset', array('legend' => Mage::helper('adminhtml')->__('Review your payment and pay')));
$data = $this->getRequest()->getPost();
$paymentMethod = Mage::getModel('affiliateplus/payment');
if ($paymentId = $this->getRequest()->getParam('id')) {
$paymentMethod->load($paymentId);
}
$paymentMethod = $paymentMethod->addData($data)->getPayment();
foreach ($data as $key => $value) {
if ($key == 'form_key') {
continue;
}
if (strpos($key, $paymentMethod->getPaymentCode()) === 0) {
$paymentMethod->setData(str_replace($paymentMethod->getPaymentCode() . '_', '', $key), $value);
}
$fieldset->addField($key, 'hidden', array('name' => $key));
}
$fieldset->addField('show_account_email', 'note', array('label' => Mage::helper('affiliateplus')->__('To Account'), 'text' => $data['account_email']));
$fieldset->addField('show_amount', 'note', array('label' => Mage::helper('affiliateplus')->__('Amount To Transfer'), 'text' => Mage::app()->getStore()->getBaseCurrency()->format($data['amount'])));
if ($this->getRequest()->getParam('masspayout') == 'true') {
$data['fee'] = $paymentMethod->getEstimateFee($data['amount'], Mage::getStoreConfig('affiliateplus/payment/who_pay_fees', $this->getRequest()->getParam('store')));
}
$fieldset->addField('show_fee', 'note', array('label' => Mage::helper('affiliateplus')->__('Estimated Fee'), 'text' => Mage::app()->getStore()->getBaseCurrency()->format($data['fee'])));
$fieldset->addField('payment_info', 'note', array('label' => Mage::helper('affiliateplus')->__('Payment Info'), 'text' => $paymentMethod->getInfoHtml()));
$form->setValues($data);
$form->setAction($this->getUrl('*/*/savePayment', array('id' => $this->getRequest()->getParam('id'), 'masspayout' => $this->getRequest()->getParam('masspayout'), 'store' => $this->getRequest()->getParam('store'))));
$form->setMethod('post');
$form->setUseContainer(true);
$form->setId('edit_form');
$this->setForm($form);
return parent::_prepareForm();
}
示例5: _prepareForm
/**
* Prepare form before rendering HTML
*
* @return Mage_Adminhtml_Block_Newsletter_Template_Edit_Form
*/
protected function _prepareForm()
{
$model = $this->getModel();
$identity = Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_UNSUBSCRIBE_EMAIL_IDENTITY);
$identityName = Mage::getStoreConfig('trans_email/ident_' . $identity . '/name');
$identityEmail = Mage::getStoreConfig('trans_email/ident_' . $identity . '/email');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('newsletter')->__('Template Information'), 'class' => 'fieldset-wide'));
if ($model->getId()) {
$fieldset->addField('id', 'hidden', array('name' => 'id', 'value' => $model->getId()));
}
$fieldset->addField('code', 'text', array('name' => 'code', 'label' => Mage::helper('newsletter')->__('Template Name'), 'title' => Mage::helper('newsletter')->__('Template Name'), 'required' => true, 'value' => $model->getTemplateCode()));
$fieldset->addField('subject', 'text', array('name' => 'subject', 'label' => Mage::helper('newsletter')->__('Template Subject'), 'title' => Mage::helper('newsletter')->__('Template Subject'), 'required' => true, 'value' => $model->getTemplateSubject()));
$fieldset->addField('sender_name', 'text', array('name' => 'sender_name', 'label' => Mage::helper('newsletter')->__('Sender Name'), 'title' => Mage::helper('newsletter')->__('Sender Name'), 'required' => true, 'value' => $model->getId() !== null ? $model->getTemplateSenderName() : $identityName));
$fieldset->addField('sender_email', 'text', array('name' => 'sender_email', 'label' => Mage::helper('newsletter')->__('Sender Email'), 'title' => Mage::helper('newsletter')->__('Sender Email'), 'class' => 'validate-email', 'required' => true, 'value' => $model->getId() !== null ? $model->getTemplateSenderEmail() : $identityEmail));
// ry edit
$fieldset->addField('newsletter_group_id', 'select', array('name' => 'newsletter_group_id', 'label' => Mage::helper('newsletter')->__('Newsletter Group'), 'title' => Mage::helper('newsletter')->__('Newsletter Group'), 'required' => true, 'value' => $model->getId() !== null ? $model->getNewsletterGroupId() : null, 'values' => $this->_getNewsletterGroupOptions()));
$widgetFilters = array('is_email_compatible' => 1);
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('widget_filters' => $widgetFilters));
if ($model->isPlain()) {
$wysiwygConfig->setEnabled(false);
}
$fieldset->addField('text', 'editor', array('name' => 'text', 'label' => Mage::helper('newsletter')->__('Template Content'), 'title' => Mage::helper('newsletter')->__('Template Content'), 'required' => true, 'state' => 'html', 'style' => 'height:36em;', 'value' => $model->getTemplateText(), 'config' => $wysiwygConfig));
if (!$model->isPlain()) {
$fieldset->addField('template_styles', 'textarea', array('name' => 'styles', 'label' => Mage::helper('newsletter')->__('Template Styles'), 'container_id' => 'field_template_styles', 'value' => $model->getTemplateStyles()));
}
$form->setAction($this->getUrl('*/*/save'));
$form->setUseContainer(true);
$this->setForm($form);
return Mage_Adminhtml_Block_Widget_Form::_prepareForm();
}
示例6: _prepareForm
/**
*
* return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$model = Mage::registry('tax_rule');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Rule Information')));
$productClasses = Mage::getModel('Mage_Tax_Model_Class')->getCollection()->setClassTypeFilter(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT)->toOptionArray();
$customerClasses = Mage::getModel('Mage_Tax_Model_Class')->getCollection()->setClassTypeFilter(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER)->toOptionArray();
$rates = Mage::getModel('Mage_Tax_Model_Calculation_Rate')->getCollection()->toOptionArray();
$fieldset->addField('code', 'text', array('name' => 'code', 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Name'), 'class' => 'required-entry', 'required' => true));
// Editable multiselect for customer tax class
$selectConfigJson = Mage::helper('Mage_Core_Helper_Data')->jsonEncode($this->getTaxClassSelectConfig(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER));
$selectAfterHtml = '<script type="text/javascript">' . '/*<![CDATA[*/' . '(function($) { $().ready(function () { ' . "var customerTaxClassMultiselect = new TaxClassEditableMultiselect({$selectConfigJson}); " . 'customerTaxClassMultiselect.init(); }); })(jQuery);' . '/*]]>*/' . '</script>';
$fieldset->addField($this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER), 'multiselect', array('name' => $this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER), 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Customer Tax Class'), 'class' => 'required-entry', 'values' => $customerClasses, 'value' => $model->getCustomerTaxClasses(), 'required' => true, 'after_element_html' => $selectAfterHtml));
// Editable multiselect for product tax class
$selectConfigJson = Mage::helper('Mage_Core_Helper_Data')->jsonEncode($this->getTaxClassSelectConfig(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT));
$selectAfterHtml = '<script type="text/javascript">' . '/*<![CDATA[*/' . '(function($) { $().ready(function () { ' . "var productTaxClassMultiselect = new TaxClassEditableMultiselect({$selectConfigJson}); " . 'productTaxClassMultiselect.init(); }); })(jQuery);' . '/*]]>*/' . '</script>';
$fieldset->addField($this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT), 'multiselect', array('name' => $this->getTaxClassSelectHtmlId(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT), 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Product Tax Class'), 'class' => 'required-entry', 'values' => $productClasses, 'value' => $model->getProductTaxClasses(), 'required' => true, 'after_element_html' => $selectAfterHtml));
$fieldset->addField('tax_rate', 'multiselect', array('name' => 'tax_rate', 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax Rate'), 'class' => 'required-entry', 'values' => $rates, 'value' => $model->getRates(), 'required' => true));
$fieldset->addField('priority', 'text', array('name' => 'priority', 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Priority'), 'class' => 'validate-not-negative-number', 'value' => (int) $model->getPriority(), 'required' => true, 'note' => Mage::helper('Mage_Tax_Helper_Data')->__('Tax rates at the same priority are added, others are compounded.')));
$fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('Mage_Tax_Helper_Data')->__('Sort Order'), 'class' => 'validate-not-negative-number', 'value' => (int) $model->getPosition(), 'required' => true));
if ($model->getId() > 0) {
$fieldset->addField('tax_calculation_rule_id', 'hidden', array('name' => 'tax_calculation_rule_id', 'value' => $model->getId(), 'no_span' => true));
}
$form->addValues($model->getData());
$form->setAction($this->getUrl('*/tax_rule/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例7: _prepareForm
/**
*
* return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$model = Mage::registry('tax_rule');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('tax')->__('Tax Rule Information')));
$productClasses = Mage::getModel('tax/class')->getCollection()->setClassTypeFilter(Mage_Tax_Model_Class::TAX_CLASS_TYPE_PRODUCT)->toOptionArray();
$customerClasses = Mage::getModel('tax/class')->getCollection()->setClassTypeFilter(Mage_Tax_Model_Class::TAX_CLASS_TYPE_CUSTOMER)->toOptionArray();
/**
* Get rates array without memory leak
*/
$rates = Mage::getModel('tax/calculation_rate')->getCollection()->getOptionRates();
$fieldset->addField('code', 'text', array('name' => 'code', 'label' => Mage::helper('tax')->__('Name'), 'class' => 'required-entry', 'required' => true));
$fieldset->addField('tax_customer_class', 'multiselect', array('name' => 'tax_customer_class', 'label' => Mage::helper('tax')->__('Customer Tax Class'), 'class' => 'required-entry', 'values' => $customerClasses, 'value' => $model->getCustomerTaxClasses(), 'required' => true));
$fieldset->addField('tax_product_class', 'multiselect', array('name' => 'tax_product_class', 'label' => Mage::helper('tax')->__('Product Tax Class'), 'class' => 'required-entry', 'values' => $productClasses, 'value' => $model->getProductTaxClasses(), 'required' => true));
$fieldset->addField('tax_rate', 'multiselect', array('name' => 'tax_rate', 'label' => Mage::helper('tax')->__('Tax Rate'), 'class' => 'required-entry', 'values' => $rates, 'value' => $model->getRates(), 'required' => true));
$fieldset->addField('priority', 'text', array('name' => 'priority', 'label' => Mage::helper('tax')->__('Priority'), 'class' => 'validate-not-negative-number', 'value' => (int) $model->getPriority(), 'required' => true, 'note' => Mage::helper('tax')->__('Tax rates at the same priority are added, others are compounded.')));
$fieldset->addField('calculate_subtotal', 'checkbox', array('name' => 'calculate_subtotal', 'label' => Mage::helper('tax')->__('Calculate off subtotal only'), 'onclick' => 'this.value = this.checked ? 1 : 0;', 'checked' => $model->getCalculateSubtotal()));
$fieldset->addField('position', 'text', array('name' => 'position', 'label' => Mage::helper('tax')->__('Sort Order'), 'class' => 'validate-not-negative-number', 'value' => (int) $model->getPosition(), 'required' => true));
if ($model->getId() > 0) {
$fieldset->addField('tax_calculation_rule_id', 'hidden', array('name' => 'tax_calculation_rule_id', 'value' => $model->getId(), 'no_span' => true));
}
$form->addValues($model->getData());
$form->setAction($this->getUrl('*/tax_rule/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例8: _prepareForm
/**
* Preparing form
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'method' => 'post'));
$fieldset = $form->addFieldset('display', array('legend' => Mage::helper('dataporter')->__('Export settings'), 'class' => 'fieldset-wide'));
$fieldset->addField('preset_name', 'text', array('name' => 'preset_name', 'label' => Mage::helper('dataporter')->__('File Name'), 'title' => Mage::helper('dataporter')->__('File Name'), 'note' => Mage::helper('dataporter')->__('This will be the name of the file in which configuration will be saved. You can enter any name you want.'), 'required' => true));
$fieldset->addField('modules', 'multiselect', array('name' => 'modules', 'label' => Mage::helper('dataporter')->__('Select Elements of the Configuration to Export'), 'title' => Mage::helper('dataporter')->__('Select Elements of the Configuration to Export'), 'values' => Mage::getModel('dataporter/source_cfgporter_packagemodules')->toOptionArray($this->getRequest()->getParam('package')), 'required' => true));
//IMPORTANT: allow to select only one store per export
if (!Mage::app()->isSingleStoreMode()) {
$fieldStores = $fieldset->addField('store_id', 'select', array('name' => 'stores', 'label' => Mage::helper('cms')->__('Configuration Scope'), 'title' => Mage::helper('cms')->__('Configuration Scope'), 'note' => Mage::helper('dataporter')->__('Configuration of selected store will be saved in a file.'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$fieldStores->setRenderer($renderer);
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores', 'value' => Mage::app()->getStore(true)->getId()));
}
/**
* Send back the control parameters
*/
$fieldset->addField('action_type', 'hidden', array('name' => 'action_type', 'value' => $this->getRequest()->getParam('action_type')));
$fieldset->addField('package', 'hidden', array('name' => 'package', 'value' => $this->getRequest()->getParam('package')));
//Set action and other parameters
$actionUrl = $this->getUrl('*/*/export');
$form->setAction($actionUrl);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例9: _prepareLayout
/**
* Prepare form for render
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form();
$customerGroup = Mage::registry('current_group');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('customer')->__('Group Information')));
$name = $fieldset->addField('customer_group_code', 'text', array('name' => 'code', 'label' => Mage::helper('customer')->__('Group Name'), 'title' => Mage::helper('customer')->__('Group Name'), 'class' => 'required-entry', 'required' => true));
if ($customerGroup->getId() == 0 && $customerGroup->getCustomerGroupCode()) {
$name->setDisabled(true);
}
$fieldset->addField('tax_class_id', 'select', array('name' => 'tax_class', 'label' => Mage::helper('customer')->__('Tax class'), 'title' => Mage::helper('customer')->__('Tax class'), 'class' => 'required-entry', 'required' => true, 'values' => Mage::getSingleton('tax/class_source_customer')->toOptionArray()));
if (!is_null($customerGroup->getId())) {
// If edit add id
$form->addField('id', 'hidden', array('name' => 'id', 'value' => $customerGroup->getId()));
}
if (Mage::getSingleton('adminhtml/session')->getCustomerGroupData()) {
$form->addValues(Mage::getSingleton('adminhtml/session')->getCustomerGroupData());
Mage::getSingleton('adminhtml/session')->setCustomerGroupData(null);
} else {
$form->addValues($customerGroup->getData());
}
$form->setUseContainer(true);
$form->setId('edit_form');
$form->setAction($this->getUrl('*/*/save'));
$this->setForm($form);
}
示例10: _prepareForm
/**
* Prepare form before rendering HTML
*
* @return Mage_Adminhtml_Block_Newsletter_Template_Edit_Form
*/
protected function _prepareForm()
{
$model = $this->getModel();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('newsletter')->__('Template Information'), 'class' => 'fieldset-wide'));
if ($model->getId()) {
$fieldset->addField('id', 'hidden', array('name' => 'id', 'value' => $model->getId()));
}
$fieldset->addField('code', 'text', array('name' => 'code', 'label' => Mage::helper('newsletter')->__('Template Name'), 'title' => Mage::helper('newsletter')->__('Template Name'), 'required' => true, 'value' => $model->getTemplateCode()));
$fieldset->addField('subject', 'text', array('name' => 'subject', 'label' => Mage::helper('newsletter')->__('Template Subject'), 'title' => Mage::helper('newsletter')->__('Template Subject'), 'required' => true, 'value' => $model->getTemplateSubject()));
$fieldset->addField('sender_name', 'text', array('name' => 'sender_name', 'label' => Mage::helper('newsletter')->__('Sender Name'), 'title' => Mage::helper('newsletter')->__('Sender Name'), 'required' => true, 'value' => $model->getTemplateSenderName()));
$fieldset->addField('sender_email', 'text', array('name' => 'sender_email', 'label' => Mage::helper('newsletter')->__('Sender Email'), 'title' => Mage::helper('newsletter')->__('Sender Email'), 'class' => 'validate-email', 'required' => true, 'value' => $model->getTemplateSenderEmail()));
$widgetFilters = array('is_email_compatible' => 1);
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('widget_filters' => $widgetFilters));
if ($model->isPlain()) {
$wysiwygConfig->setEnabled(false);
}
$fieldset->addField('text', 'editor', array('name' => 'text', 'label' => Mage::helper('newsletter')->__('Template Content'), 'title' => Mage::helper('newsletter')->__('Template Content'), 'required' => true, 'state' => 'html', 'style' => 'height:36em;', 'value' => $model->getTemplateText(), 'config' => $wysiwygConfig));
if (!$model->isPlain()) {
$fieldset->addField('template_styles', 'textarea', array('name' => 'styles', 'label' => Mage::helper('newsletter')->__('Template Styles'), 'container_id' => 'field_template_styles', 'value' => $model->getTemplateStyles()));
}
$form->setAction($this->getUrl('*/*/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例11: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('current_model');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$fieldset = $form->addFieldset('general_fieldset', array('legend' => Mage::helper('seoautolink')->__('General'), 'class' => 'fieldset-wide'));
if ($model->getId()) {
$fieldset->addField('link_id', 'hidden', array('name' => 'link_id', 'value' => $model->getId()));
}
$fieldset->addField('keyword', 'text', array('name' => 'keyword', 'label' => Mage::helper('seoautolink')->__('Keyword'), 'required' => true, 'value' => $model->getKeyword()));
$fieldset->addField('url', 'text', array('name' => 'url', 'label' => Mage::helper('seoautolink')->__('URL'), 'required' => true, 'value' => $model->getUrl()));
$fieldset->addField('url_target', 'select', array('label' => Mage::helper('seoautolink')->__('URL Target'), 'name' => 'url_target', 'values' => Mage::getSingleton('seoautolink/config_source_urltarget')->toOptionArray(), 'value' => $model->getUrlTarget()));
$fieldset->addField('url_title', 'text', array('name' => 'url_title', 'label' => Mage::helper('seoautolink')->__('URL Title'), 'required' => false, 'value' => $model->getUrlTitle()));
$fieldset->addField('is_nofollow', 'select', array('name' => 'is_nofollow', 'label' => Mage::helper('seoautolink')->__('Nofollow'), 'options' => array('1' => Mage::helper('seoautolink')->__('Yes'), '0' => Mage::helper('seoautolink')->__('No')), 'value' => $model->getIsNofollow()));
$fieldset->addField('max_replacements', 'text', array('name' => 'max_replacements', 'label' => Mage::helper('seoautolink')->__('Number of substitutions'), 'value' => (int) $model->getMaxReplacements()));
$fieldset->addField('sort_order', 'text', array('name' => 'sort_order', 'label' => Mage::helper('seoautolink')->__('Sort order'), 'value' => (int) $model->getSortOrder()));
$fieldset->addField('occurence', 'select', array('name' => 'occurence', 'label' => Mage::helper('seoautolink')->__('Occurence'), 'values' => Mage::getSingleton('seoautolink/config_source_occurence')->toOptionArray(), 'value' => $model->getOccurence()));
$fieldset->addField('is_active', 'select', array('name' => 'is_active', 'label' => Mage::helper('seoautolink')->__('Status'), 'options' => array('1' => Mage::helper('seoautolink')->__('Active'), '0' => Mage::helper('seoautolink')->__('Inactive')), 'value' => $model->getIsActive() == null ? 1 : $model->getIsActive()));
$fieldset->addField('active_from', 'date', array('label' => Mage::helper('seoautolink')->__('Active From'), 'required' => false, 'name' => 'active_from', 'value' => $model->getActiveFrom(), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => 'dd.MM.yyyy'));
$fieldset->addField('active_to', 'date', array('label' => Mage::helper('seoautolink')->__('Active To'), 'required' => false, 'name' => 'active_to', 'value' => $model->getActiveTo(), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => 'dd.MM.yyyy'));
/*
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$field = $fieldset->addField('store_id', 'multiselect', array('name' => 'store_ids[]', 'label' => Mage::helper('seoautolink')->__('Visible in Store View'), 'title' => Mage::helper('seoautolink')->__('Visible in Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'value' => $model->getStoreIds()));
} else {
$fieldset->addField('store_id', 'hidden', array('name' => 'store_ids[]', 'value' => Mage::app()->getStore(true)->getId()));
$model->setStoreId(Mage::app()->getStore(true)->getId());
}
$form->setAction($this->getUrl('*/*/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例12: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('current_status');
$labels = $model ? $model->getStoreLabels() : array();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('sales')->__('Quote Status Information')));
$fieldset->addField('is_new', 'hidden', array('name' => 'is_new', 'value' => 1));
$fieldset->addField('status', 'text', array('name' => 'status', 'label' => Mage::helper('request4quote')->__('Status Code'), 'class' => 'required-entry validate-code', 'required' => true));
$fieldset->addField('label', 'text', array('name' => 'label', 'label' => Mage::helper('request4quote')->__('Status Label'), 'class' => 'required-entry', 'required' => true));
$checked = is_object($model) ? $model->getAllowviewcheckout() : false;
$fieldset->addField('allowviewcheckout', 'checkbox', array('name' => 'allowviewcheckout', 'label' => Mage::helper('request4quote')->__('Allow customer to view price and add to cart?'), 'checked' => $checked));
$fieldset = $form->addFieldset('store_labels_fieldset', array('legend' => Mage::helper('sales')->__('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("store_label_{$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 ($model) {
$form->addValues($model->getData());
}
$form->setAction($this->getUrl('*/quote_status/save'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例13: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$installment = Mage::registry('current_installment_payment');
$fieldset = $form->addFieldset('base_fieldset', array('legend' => Mage::helper('installment')->__('Original Installment Payment')));
$fieldset->addField('order_id', 'text', array('name' => 'order_id', 'label' => Mage::helper('installment')->__('Order Id'), 'title' => Mage::helper('installment')->__('Order Id'), 'readonly' => true));
$fieldset->addField('installment_master_sequence_number', 'text', array('name' => 'sequence_number', 'label' => Mage::helper('installment')->__('Sequence Number'), 'title' => Mage::helper('installment')->__('Sequence Number'), 'readonly' => true));
$fieldset->addField('installment_master_amount_due', 'text', array('name' => 'amount_due', 'label' => Mage::helper('installment')->__('Amount Due'), 'title' => Mage::helper('installment')->__('Amount Due'), 'required' => true));
$outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('installment_master_amount_due_date', 'date', array('name' => 'amount_due_date', 'label' => Mage::helper('installment')->__('Amount Due Date'), 'title' => Mage::helper('installment')->__('Amount Due Date'), 'class' => 'validate-date', 'time' => true, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT, 'format' => $outputFormat, 'required' => true));
if (!is_null($installment->getId())) {
// If edit add id
$form->addField('id', 'hidden', array('name' => 'id', 'value' => $installment->getId()));
}
$fieldset = $form->addFieldset('new_installment_fieldset', array('legend' => Mage::helper('installment')->__('New Installment Payment')));
$fieldset->addField('new_order_id', 'text', array('name' => 'order_id', 'label' => Mage::helper('installment')->__('Order Id'), 'title' => Mage::helper('installment')->__('Order Id'), 'readonly' => true, 'value' => $installment->getOrderId()));
$fieldset->addField('new_installment_master_amount_due', 'text', array('name' => 'new_amount_due', 'label' => Mage::helper('installment')->__('Amount Due'), 'title' => Mage::helper('installment')->__('Amount Due'), 'required' => true));
$outputFormat = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('new_installment_master_amount_due_date', 'date', array('name' => 'new_amount_due_date', 'label' => Mage::helper('installment')->__('Amount Due Date'), 'title' => Mage::helper('installment')->__('Amount Due Date'), 'class' => 'validate-date', 'time' => true, 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATETIME_INTERNAL_FORMAT, 'format' => $outputFormat, 'required' => true));
if (Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData()) {
$form->addValues(Mage::getSingleton('adminhtml/session')->getInstallmentPaymentData());
Mage::getSingleton('adminhtml/session')->setInstallmentPaymentData(null);
} else {
$form->addValues($installment->getData());
}
$form->setUseContainer(true);
$form->setId('edit_form');
$form->setAction($this->getUrl('*/*/split'));
$form->setPost(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例14: createRedirectForm
public function createRedirectForm($order_id, $tpPagamento = 2)
{
$form = new Varien_Data_Form();
$form->setAction($this->getBancoUrl())->setId('boletosicob_checkout')->setName('pagamento')->setMethod('POST')->setUseContainer(true);
$fields = $this->getCheckoutFormFields($order_id, $tpPagamento);
foreach ($fields as $field => $value) {
$form->addField($field, 'hidden', array('name' => $field, 'value' => $value));
}
$html = $form->toHtml();
$submit_script = 'document.getElementById(\'boletosicob_checkout\').submit();';
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
$html .= '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="pt-BR">';
$html .= '<head>';
$html .= '<meta http-equiv="Content-Language" content="pt-br" />';
$html .= '<meta name="language" content="pt-br" />';
$html .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
$html .= '<style type="text/css">';
$html .= '* { font-family: Arial; font-size: 16px; line-height: 34px; text-align: center; color: #222222; }';
$html .= 'small, a, a:link:visited:active, a:hover { font-size: 13px; line-height: normal; font-style: italic; }';
$html .= 'a, a:link:visited:active { font-weight: bold; text-decoration: none; }';
$html .= 'a:hover { font-weight: bold; text-decoration: underline; color: #555555; }';
$html .= '</style>';
$html .= '</head>';
$html .= '<body onload="' . $submit_script . '">';
$html .= 'Você será redirecionado ao <strong>Banco SICOOB</strong> em alguns instantes.<br />';
$html .= '<small>Se a página não carregar, <a href="#" onclick="' . $submit_script . ' return false;">clique aqui</a>.</small>';
$html .= $form->toHtml();
$html .= '</body></html>';
//echo utf8_decode($html);
return $html;
}
示例15: _prepareForm
protected function _prepareForm()
{
$faq = Mage::registry('current_origins');
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('edit_origins', array('legend' => Mage::helper('shiphawk_shipping')->__('Origins Details')));
if ($faq->getId()) {
$fieldset->addField('id', 'hidden', array('name' => 'id', 'required' => true));
}
$fieldset->addField('shiphawk_origin_title', 'text', array('name' => 'shiphawk_origin_title', 'title' => Mage::helper('shiphawk_shipping')->__('Title'), 'label' => Mage::helper('shiphawk_shipping')->__('Title'), 'required' => true, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_firstname', 'text', array('name' => 'shiphawk_origin_firstname', 'title' => Mage::helper('shiphawk_shipping')->__('First Name'), 'label' => Mage::helper('shiphawk_shipping')->__('First Name'), 'required' => true, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_lastname', 'text', array('name' => 'shiphawk_origin_lastname', 'title' => Mage::helper('shiphawk_shipping')->__('Last Name'), 'label' => Mage::helper('shiphawk_shipping')->__('Last Name'), 'required' => true, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_addressline1', 'text', array('name' => 'shiphawk_origin_addressline1', 'title' => Mage::helper('shiphawk_shipping')->__('Address'), 'label' => Mage::helper('shiphawk_shipping')->__('Address'), 'required' => true, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_addressline2', 'text', array('name' => 'shiphawk_origin_addressline2', 'title' => Mage::helper('shiphawk_shipping')->__('Address'), 'label' => Mage::helper('shiphawk_shipping')->__('Address Line 2'), 'required' => false, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_city', 'text', array('name' => 'shiphawk_origin_city', 'title' => Mage::helper('shiphawk_shipping')->__('City'), 'label' => Mage::helper('shiphawk_shipping')->__('City'), 'required' => true, 'width' => '400px'));
$regions = $this->getRegions();
$fieldset->addField('shiphawk_origin_state', 'select', array('name' => 'shiphawk_origin_state', 'title' => Mage::helper('shiphawk_shipping')->__('State'), 'label' => Mage::helper('shiphawk_shipping')->__('State'), 'required' => true, 'values' => $regions, 'width' => '100%'));
$fieldset->addField('shiphawk_origin_zipcode', 'text', array('name' => 'shiphawk_origin_zipcode', 'title' => Mage::helper('shiphawk_shipping')->__('Zip Code'), 'label' => Mage::helper('shiphawk_shipping')->__('Zip Code'), 'required' => true, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_phonenum', 'text', array('name' => 'shiphawk_origin_phonenum', 'title' => Mage::helper('shiphawk_shipping')->__('Phone number'), 'label' => Mage::helper('shiphawk_shipping')->__('Phone number'), 'required' => true, 'width' => '400px'));
$fieldset->addField('shiphawk_origin_location', 'select', array('name' => 'shiphawk_origin_location', 'title' => Mage::helper('shiphawk_shipping')->__('Location'), 'label' => Mage::helper('shiphawk_shipping')->__('Location'), 'required' => true, 'values' => array(array('value' => 'commercial', 'label' => 'commercial'), array('value' => 'residential', 'label' => 'residential')), 'width' => '400px'));
$fieldset->addField('shiphawk_origin_email', 'text', array('name' => 'shiphawk_origin_email', 'title' => Mage::helper('shiphawk_shipping')->__('Email'), 'label' => Mage::helper('shiphawk_shipping')->__('Email'), 'required' => false, 'width' => '400px'));
$form->setMethod('post');
$form->setUseContainer(true);
$form->setId('edit_form');
$form->setAction($this->getUrl('*/*/save'));
$form->setValues($faq->getData());
$this->setForm($form);
}