本文整理汇总了PHP中Varien_Data_Form类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form类的具体用法?PHP Varien_Data_Form怎么用?PHP Varien_Data_Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Data_Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
/**
* 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();
}
示例2: _prepareForm
/**
* 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();
}
示例3: _prepareForm
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();
}
示例4: _prepareForm
/**
* 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();
}
示例5: initForm
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;
}
示例6: _prepareForm
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();
}
示例7: _prepareForm
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);
}
示例8: _prepareForm
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();
}
示例9: _prepareForm
/**
* 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();
}
示例10: _prepareForm
/**
*
* 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();
}
示例11: _prepareForm
/**
* 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();
}
示例12: _prepareForm
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();
}
示例13: _prepareForm
/**
* 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();
}
示例14: _prepareForm
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();
}
示例15: _prepareForm
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();
}