本文整理汇总了PHP中Mage_Adminhtml_Block_Widget_Form类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Widget_Form类的具体用法?PHP Mage_Adminhtml_Block_Widget_Form怎么用?PHP Mage_Adminhtml_Block_Widget_Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Adminhtml_Block_Widget_Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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();
}
示例2: _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();
}
示例3: _prepareForm
/**
* 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();
}
示例4: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$form->setHtmlIdPrefix("template");
$form->setFieldNameSuffix("template");
/* @var $template Mzax_Emarketing_Model_Template */
$template = Mage::registry('current_template');
if ($template->getId()) {
$form->addField('template_id', 'hidden', array('name' => 'template_id', 'value' => $template->getId()));
}
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Template Option'), 'class' => 'fieldset-wide'))->addType('editor', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_templateEditor'))->addType('credits', Mage::getConfig()->getModelClassName('mzax_emarketing/form_element_credits'));
$fieldset->addField('credits', 'credits', array('name' => 'credits', 'required' => true));
$fieldset->addField('name', 'text', array('name' => 'name', 'required' => true, 'label' => $this->__('Template Name'), 'title' => $this->__('Template Name')));
$fieldset->addField('description', 'textarea', array('name' => 'description', 'required' => true, 'label' => $this->__('Description'), 'title' => $this->__('Description'), 'style' => 'height:4em;', 'note' => "For internal use only"));
$snippets = new Mzax_Emarketing_Model_Medium_Email_Snippets();
Mage::getSingleton('mzax_emarketing/medium_email')->prepareSnippets($snippets);
$editorConfig = new Varien_Object();
$editorConfig->setFilesBrowserWindowUrl($this->getUrl('adminhtml/cms_wysiwyg_images/index'));
$editorConfig->setWidgetWindowUrl($this->getUrl('adminhtml/widget/index'));
$editorConfig->setSnippets($snippets);
$editor = $fieldset->addField('body', 'editor', array('name' => 'body', 'required' => true, 'label' => $this->__('Template HTML'), 'title' => $this->__('Template HTML'), 'logo' => $this->getSkinUrl('images/logo.gif'), 'fullscreen_title' => $this->__('Template %s', $template->getName()), 'style' => 'height:50em;', 'value' => '', 'config' => $editorConfig));
// Setting custom renderer for content field to remove label column
$renderer = $this->getLayout()->createBlock('adminhtml/widget_form_renderer_fieldset_element')->setTemplate('cms/page/edit/form/renderer/content.phtml');
$editor->setRenderer($renderer);
$form->addValues($template->getData());
$this->setForm($form);
$form->setUseContainer(true);
return parent::_prepareForm();
}
示例5: _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();
}
示例6: _prepareForm
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();
}
示例7: _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);
$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();
}
示例8: _prepareForm
public function _prepareForm()
{
$hlp = Mage::helper('urapidflow');
$source = Mage::getSingleton('urapidflow/source');
$profile = Mage::registry('profile_data');
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('export_options_form', array('legend' => $this->__('Export Options')));
$fieldset->addField('export_image_files', 'select', array('label' => $this->__('Auto-export image files'), 'name' => 'options[export][image_files]', 'values' => $source->setPath('yesno')->toOptionArray(), 'value' => $profile->getData('options/export/image_files')));
$fieldset->addField('export_image_https', 'select', array('label' => $this->__('Export Image URLs as HTTPS'), 'name' => 'options[export][image_https]', 'values' => $source->setPath('yesno')->toOptionArray(), 'value' => $profile->getData('options/export/image_https')));
$fieldset->addField('export_invalid_values', 'select', array('label' => $this->__('Export invalid values'), 'name' => 'options[export][invalid_values]', 'values' => $source->setPath('yesno')->toOptionArray(), 'value' => $profile->getData('options/export/invalid_values')));
$fieldset->addField('export_internal_values', 'select', array('label' => $this->__('Export internal values'), 'name' => 'options[export][internal_values]', 'values' => $source->setPath('yesno')->toOptionArray(), 'value' => $profile->getData('options/export/internal_values')));
$fieldset->addField('export_configurable_qty_as_sum', 'select', array('label' => $this->__('Calculate qty of configurable products as sum of subproducts'), 'name' => 'options[export][configurable_qty_as_sum]', 'values' => $source->setPath('yesno')->toOptionArray(), 'value' => $profile->getData('options/export/configurable_qty_as_sum')));
$fieldset = $this->getForm()->addFieldset('export_price_form', array('legend' => $this->__('Price Options')));
/*
$fieldset->addField('export_use_final_price', 'select', array(
'label' => $this->__('Use Final Price'),
'name' => 'options[export][use_final_price]',
'values' => $source->setPath('yesno')->toOptionArray(),
'value' => $profile->getData('options/export/use_final_price'),
));
$fieldset->addField('export_use_minimal_price', 'select', array(
'label' => $this->__('Use Minimal Price'),
'name' => 'options[export][use_minimal_price]',
'values' => $source->setPath('yesno')->toOptionArray(),
'value' => $profile->getData('options/export/use_minimal_price'),
));
*/
$fieldset->addField('export_add_tax', 'select', array('label' => $this->__('Add Tax'), 'name' => 'options[export][add_tax]', 'values' => $source->setPath('yesno')->toOptionArray(), 'value' => $profile->getData('options/export/add_tax')));
$fieldset->addField('export_markup', 'text', array('label' => $this->__('Add Markup (%)'), 'name' => 'options[export][markup]', 'value' => $profile->getData('options/export/markup')));
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
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('brand_form', array('legend' => Mage::helper('brand')->__('Brand information')));
$fieldset->addField('title', 'text', array('label' => Mage::helper('brand')->__('Title'), 'class' => 'required-entry', 'required' => true, 'name' => 'title'));
$fieldset->addField('filename', 'image', array('label' => Mage::helper('brand')->__('File'), 'required' => false, 'name' => 'filename'));
$fieldset->addField('status', 'select', array('label' => Mage::helper('brand')->__('Status'), 'name' => 'status', 'values' => array(array('value' => 1, 'label' => Mage::helper('brand')->__('Enabled')), array('value' => 2, 'label' => Mage::helper('brand')->__('Disabled')))));
$fieldset->addField('home_page', 'select', array('label' => Mage::helper('brand')->__('Home Page'), 'name' => 'home_page', 'values' => array(array('value' => 1, 'label' => Mage::helper('brand')->__('Enabled')), array('value' => 2, 'label' => Mage::helper('brand')->__('Disabled')))));
/*$fieldset->addField('content', 'editor', array(
'name' => 'content',
'label' => Mage::helper('brand')->__('Content'),
'title' => Mage::helper('brand')->__('Content'),
'style' => 'width:700px; height:500px;',
'wysiwyg' => false,
'required' => true,
));*/
if (Mage::getSingleton('adminhtml/session')->getBrandData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getBrandData());
Mage::getSingleton('adminhtml/session')->setBrandData(null);
} elseif (Mage::registry('brand_data')) {
$form->setValues(Mage::registry('brand_data')->getData());
}
return parent::_prepareForm();
}
示例11: _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();
}
示例12: _prepareForm
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$this->setForm($form);
$fieldset = $form->addFieldset('layeredlanding_form', array('legend' => Mage::helper('layeredlanding')->__('Landingpage Conditions'), 'class' => 'fieldset-wide'));
$fieldset->addField('category_ids', 'multiselect', array('label' => Mage::helper('layeredlanding')->__('Categories'), 'class' => 'required-entry', 'required' => true, 'name' => 'category_ids', 'onchange' => '_estimate_product_count();', 'values' => Mage::getSingleton('layeredlanding/options_categories')->toOptionArray(), 'style' => 'width:80%'));
/**
* Check is single store mode
*/
if (!Mage::app()->isSingleStoreMode()) {
$field = $fieldset->addField('store_ids', 'multiselect', array('name' => 'store_ids', 'label' => Mage::helper('cms')->__('Store View'), 'title' => Mage::helper('cms')->__('Store View'), 'required' => true, 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'onchange' => '_estimate_product_count();'));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$field->setRenderer($renderer);
} else {
$fieldset->addField('store_ids', 'hidden', array('name' => 'store_ids', 'value' => Mage::app()->getStore(true)->getId(), 'onchange' => '_estimate_product_count();'));
}
$fieldset->addField('attributes', 'text', array('name' => 'attributes', 'label' => Mage::helper('layeredlanding')->__('Attributes'), 'required' => false));
$attributes = $form->getElement('attributes');
$attributes->setRenderer($this->getLayout()->createBlock('layeredlanding/adminhtml_layeredlanding_edit_renderer_attributes'));
if (Mage::getSingleton('adminhtml/session')->getLayeredlandingData()) {
$data = Mage::getSingleton('adminhtml/session')->getLayeredlandingData();
Mage::getSingleton('adminhtml/session')->setLayeredlandingData(null);
} elseif (Mage::registry('layeredlanding_data')) {
$data = Mage::registry('layeredlanding_data')->getData();
}
// modify multiselect values
$data['store_ids'] = explode(',', $data['store_ids']);
$data['category_ids'] = explode(',', $data['category_ids']);
$form->setValues($data);
return parent::_prepareForm();
}
示例13: _prepareLayout
protected function _prepareLayout()
{
$button = $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('catalog')->__('Add Option'), 'onclick' => 'return customOptionsSourceControl.addItem()', 'class' => 'add'));
$button->setName('add_custom_option_item_button');
$this->setChild('add_button', $button);
return parent::_prepareLayout();
}
示例14: _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();
}
示例15: _prepareForm
/**
* 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();
}