本文整理汇总了PHP中Varien_Data_Form::setValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::setValues方法的具体用法?PHP Varien_Data_Form::setValues怎么用?PHP Varien_Data_Form::setValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::setValues方法的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
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('segment_id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$fieldset = $form->addFieldset('main_group', array('legend' => Mage::helper('advancednewsletter')->__('Fields')));
$fieldset->addField('title', 'text', array('label' => Mage::helper('advancednewsletter')->__('Segment Title'), 'name' => 'title', 'required' => true));
$params = array('label' => Mage::helper('advancednewsletter')->__('Segment Code'), 'name' => 'code', 'required' => true, 'after_element_html' => '<p><small>' . Mage::helper('advancednewsletter')->__("Note that this field's text is case-sensitive <br /> and must exactly correspond to the MailChimp text") . '<br />' . Mage::helper('advancednewsletter')->__("This value can not be changed after saving") . '<small></p>');
$isCodeEditDisabled = $this->getRequest()->getParam('id') ? true : false;
if ($isCodeEditDisabled) {
$params['readonly'] = 'readonly';
}
$fieldset->addField('code', 'text', $params);
$fieldset->addField('default_store', 'select', array('label' => Mage::helper('advancednewsletter')->__('Default Store'), 'name' => 'default_store', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'required' => true));
$fieldset->addField('default_category', 'select', array('label' => Mage::helper('advancednewsletter')->__('Default Category'), 'name' => 'default_category', 'values' => Mage::helper('advancednewsletter')->getCategoriesArray(), 'after_element_html' => '', 'required' => true));
$fieldset->addField('display_in_store', 'multiselect', array('label' => Mage::helper('advancednewsletter')->__('Display in store'), 'name' => 'display_in_store', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true), 'after_element_html' => '', 'required' => true));
$fieldset->addField('display_in_category', 'multiselect', array('label' => Mage::helper('advancednewsletter')->__('Display in category'), 'name' => 'display_in_category', 'values' => Mage::helper('advancednewsletter')->getCategoriesArray(), 'after_element_html' => '', 'required' => true));
$fieldset->addField('frontend_visibility', 'select', array('label' => Mage::helper('advancednewsletter')->__('Visible at frontend'), 'name' => 'frontend_visibility', 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(), 'after_element_html' => '', 'required' => true));
$fieldset->addField('checkout_visibility', 'select', array('label' => Mage::helper('advancednewsletter')->__('Visible at checkout'), 'name' => 'checkout_visibility', 'values' => Mage::getSingleton('adminhtml/system_config_source_yesno')->toOptionArray(), 'onchange' => '', 'after_element_html' => '', 'required' => true));
$fieldset->addField('display_order', 'text', array('label' => Mage::helper('advancednewsletter')->__('Display order'), 'name' => 'display_order'));
if (Mage::getSingleton('adminhtml/session')->getAnSegmentData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getAnSegmentData());
Mage::getSingleton('adminhtml/session')->setAnSegmentData(null);
} elseif (Mage::registry('an_segment_data')) {
$form->setValues(Mage::registry('an_segment_data'));
}
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例3: _prepareForm
protected function _prepareForm()
{
$rule = Mage::getModel('rewardpoints/rules');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post'));
$fieldset = $form->addFieldset('rule_details', array('legend' => Mage::helper('rewardpoints')->__('Rule details')));
$fieldset->addField('rewardpoints_rule_name', 'text', array('label' => Mage::helper('rewardpoints')->__('Rule Name'), 'class' => 'input-text', 'required' => true, 'name' => 'rewardpoints_rule_name', 'required' => true));
$dateFormatIso = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
$fieldset->addField('rewardpoints_rule_start', 'date', array('name' => 'rewardpoints_rule_start', 'label' => Mage::helper('catalogrule')->__('From Date'), 'title' => Mage::helper('catalogrule')->__('From Date'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'input_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'format' => $dateFormatIso, 'required' => true));
$fieldset->addField('rewardpoints_rule_end', 'date', array('name' => 'rewardpoints_rule_end', 'title' => Mage::helper('rewardpoints')->__('To Date'), 'label' => Mage::helper('rewardpoints')->__('To Date'), 'image' => Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN) . '/adminhtml/default/default/images/grid-cal.gif', 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'required' => true));
$fieldset->addField('rewardpoints_rule_type', 'select', array('label' => Mage::helper('rewardpoints')->__('Type of rule'), 'name' => 'rewardpoints_rule_type', 'values' => $rule->targetsToOptionArray(), 'onchange' => 'checkTarget()', 'after_element_html' => '', 'required' => true));
$fieldset = $form->addFieldset('rule_action', array('legend' => Mage::helper('rewardpoints')->__('Rule condition')));
$fieldset->addField('rewardpoints_rule_operator', 'select', array('label' => Mage::helper('rewardpoints')->__('Operator'), 'name' => 'rewardpoints_rule_operator', 'values' => $rule->operatorToOptionArray(), 'onchange' => 'changeOperator()', 'after_element_html' => '', 'required' => true));
$fieldset->addField('rewardpoints_rule_test', 'text', array('label' => Mage::helper('rewardpoints')->__('Test value'), 'class' => 'input-text', 'required' => true, 'name' => 'rewardpoints_rule_test', 'required' => true));
$fieldset->addField('rewardpoints_rule_points', 'text', array('label' => Mage::helper('rewardpoints')->__('Points to be earned'), 'class' => 'validate-greater-than-zero', 'required' => true, 'name' => 'rewardpoints_rule_points', 'required' => true));
$fieldset->addField('rewardpoints_rule_extra', 'select', array('label' => Mage::helper('rewardpoints')->__('Overload existing configuration'), 'name' => 'rewardpoints_rule_extra', 'values' => $rule->activatedToOptionArray(), 'after_element_html' => '', 'required' => true));
if (!Mage::app()->isSingleStoreMode()) {
$fieldset->addField('website_ids', 'multiselect', array('name' => 'website_ids[]', 'label' => Mage::helper('catalogrule')->__('Websites'), 'title' => Mage::helper('catalogrule')->__('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()));
//$model->setWebsiteIds(Mage::app()->getStore(true)->getWebsiteId());
}
$fieldset->addField('rewardpoints_rule_activated', 'select', array('label' => Mage::helper('rewardpoints')->__('Status'), 'name' => 'rewardpoints_rule_activated', 'values' => $rule->activatedToOptionArray(), 'after_element_html' => '', 'required' => true));
if (Mage::getSingleton('adminhtml/session')->getRulesData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getRulesData());
Mage::getSingleton('adminhtml/session')->setRulesData(null);
} elseif (Mage::registry('pointrules_data')) {
$form->setValues(Mage::registry('pointrules_data')->getData());
}
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例4: initForm
public function initForm()
{
$form = new Varien_Data_Form();
$form->setHtmlIdPrefix('_vendor');
$form->setFieldNameSuffix('vendor');
$vendorType = $this->getRequest()->getParam('vendor_type', null);
if (!$vendorType) {
if ($vendorData = Mage::registry('vendor_data')) {
$vendorType = $vendorData->getVendorType();
}
}
$vendorList = Mage::getConfig()->getNode('default/vendor')->asArray();
$fieldset = $form->addFieldset('vendor_form', array('legend' => Mage::helper('vendor')->__('Vendor information')));
$fieldset->addField('name', 'text', array('label' => Mage::helper('vendor')->__('Vendor Name'), 'class' => '', 'required' => true, 'name' => 'name'));
foreach ($vendorList[$vendorType]['fields'] as $name => $vendor) {
$label = isset($vendor['label']) ? (string) $vendor['label'] : '';
$class = isset($vendor['class']) ? (string) $vendor['class'] : '';
$type = isset($vendor['type']) ? (string) $vendor['type'] : 'text';
$required = isset($vendor['required']) && $vendor['required'] == 1 ? true : false;
$fieldset->addField($name, $type, array('label' => Mage::helper('vendor')->__($label), 'class' => $class, 'required' => $required, 'name' => $name));
}
if (Mage::getSingleton('adminhtml/session')->getVendorData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getVendorData());
Mage::getSingleton('adminhtml/session')->setVendorData(null);
} elseif (Mage::registry('vendor_data')) {
$form->setValues(Mage::registry('vendor_data')->getData());
}
$fieldset->addField('vendor_type', 'hidden', array('name' => 'vendor_type', 'value' => $vendorType));
$this->setForm($form);
return $this;
}
示例5: _prepareForm
protected function _prepareForm()
{
$values = array();
if (!$this->getRule() || !$this->getRule()->getId()) {
$values = array('amount_from' => 0);
} else {
$values = $this->getRule()->getData();
}
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
$fieldset = $form->addFieldset('msp_cashondelivery_', array('legend' => Mage::helper('msp_cashondelivery')->__('Cash on delivery fee')));
$fieldset->addField('amount_from', 'text', array('label' => Mage::helper('msp_cashondelivery')->__('Apply from amount'), 'required' => true, 'name' => 'amount_from'));
$fieldset->addField('fixed_fee', 'text', array('label' => Mage::helper('msp_cashondelivery')->__('Fixed Fee'), 'required' => false, 'name' => 'fixed_fee'));
$fieldset->addField('percent_fee', 'text', array('label' => Mage::helper('msp_cashondelivery')->__('Percentual Fee'), 'required' => false, 'name' => 'percent_fee'));
if (Mage::getSingleton('adminhtml/session')->getMspCashondeliveryData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getMspCashondeliveryData());
Mage::getSingleton('adminhtml/session')->getMspCashondeliveryData(null);
} elseif (Mage::registry('msp_cashondelivery')) {
die("i dati ci sono!");
$form->setValues(Mage::registry('msp_cashondelivery_data')->getData());
}
$form->setValues($values);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例6: initForm
public function initForm()
{
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('mcenter_time_data', array('legend' => Mage::helper('clmcenter')->__('Настройки времени'), 'style' => 'width: 520px;'));
$fieldset->addField('mcenter_time', 'date', array('name' => 'mcenter_time', 'label' => Mage::helper('clmcenter')->__('Время'), 'title' => Mage::helper('clmcenter')->__('Время'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'after_element_html' => '<span class="hint" style="white-space:nowrap;"><p class="note">' . Mage::helper('clmcenter')->__('Next to the Article will be stated current time') . '</p></span>'));
$fieldset->addField('publicate_from_time', 'date', array('name' => 'publicate_from_time', 'label' => Mage::helper('clmcenter')->__('Опубликовать с:'), 'title' => Mage::helper('clmcenter')->__('Опубликовать до:'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
$values = $this->getTimeValues(0, 23);
$fieldset->addField('publicate_from_hours', 'select', array('label' => Mage::helper('clmcenter')->__('Часы'), 'name' => 'publicate_from_hours', 'style' => 'width: 50px!important;', 'values' => $values));
$values = $this->getTimeValues(0, 59);
$fieldset->addField('publicate_from_minutes', 'select', array('label' => Mage::helper('clmcenter')->__('Минуты'), 'name' => 'publicate_from_minutes', 'style' => 'width: 50px!important;', 'values' => $values));
$fieldset->addField('publicate_to_time', 'date', array('name' => 'publicate_to_time', 'label' => Mage::helper('clmcenter')->__('Опубликовать пока:'), 'title' => Mage::helper('clmcenter')->__('Опубликовать пока:'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
$values = $this->getTimeValues(0, 23);
$fieldset->addField('publicate_to_hours', 'select', array('label' => Mage::helper('clmcenter')->__('Часы'), 'name' => 'publicate_to_hours', 'style' => 'width: 50px!important;', 'values' => $values));
$values = $this->getTimeValues(0, 59);
$fieldset->addField('publicate_to_minutes', 'select', array('label' => Mage::helper('clmcenter')->__('Минуты'), 'name' => 'publicate_to_minutes', 'style' => 'width: 50px!important', 'values' => $values));
$fieldset = $form->addFieldset('mcenter_meta_data', array('legend' => Mage::helper('clmcenter')->__('Meta Data')));
$fieldset->addField('meta_keywords', 'editor', array('name' => 'meta_keywords', 'label' => Mage::helper('clmcenter')->__('Ключевые слова'), 'title' => Mage::helper('clmcenter')->__('Мета (ключевые слова)'), 'style' => 'width: 520px;'));
$fieldset->addField('meta_description', 'editor', array('name' => 'meta_description', 'label' => Mage::helper('clmcenter')->__('Описание'), 'title' => Mage::helper('clmcenter')->__('Мета (описание)'), 'style' => 'width: 520px;'));
$fieldset = $form->addFieldset('mcenter_options_data', array('legend' => Mage::helper('clmcenter')->__('Расширенные опции')));
$fieldset->addField('author', 'text', array('label' => Mage::helper('clmcenter')->__('Имя автора'), 'name' => 'author', 'style' => 'width: 520px;', 'after_element_html' => '<span class="hint"><p class="note">' . $this->__('Оставьте пустым чтобы не выводить') . '</p></span>'));
if (Mage::getSingleton('adminhtml/session')->getMcenterData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getMcenterData());
Mage::getSingleton('adminhtml/session')->setMcenterData(null);
} elseif (Mage::registry('clmcenter_data')) {
$form->setValues(Mage::registry('clmcenter_data')->getData());
}
$this->setForm($form);
return $this;
}
示例7: _prepareLayout
protected function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
$form->setFieldNameSuffix('quickresponse');
$id = $this->getRequest()->getParam('id');
$fieldset = $form->addFieldset('quickresponse_fieldset', array('legend' => Mage::helper('webforms')->__('Quick Response')));
$fieldset->addField('title', 'text', array('label' => Mage::helper('webforms')->__('Title'), 'class' => 'required-entry', 'required' => true, 'style' => 'width:700px;', 'name' => 'title'));
$editor_type = 'textarea';
$config = '';
if ((double) substr(Mage::getVersion(), 0, 3) > 1.3 && substr(Mage::getVersion(), 0, 5) != '1.4.0' || Mage::helper('webforms')->getMageEdition() == 'EE') {
$wysiwygConfig = Mage::getSingleton('cms/wysiwyg_config')->getConfig(array('tab_id' => $this->getTabId()));
$wysiwygConfig["files_browser_window_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg_images/index');
$wysiwygConfig["directives_url"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
$wysiwygConfig["directives_url_quoted"] = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/cms_wysiwyg/directive');
$wysiwygConfig["add_widgets"] = false;
$wysiwygConfig["add_variables"] = false;
$wysiwygConfig["widget_plugin_src"] = false;
$plugins = $wysiwygConfig->setData("plugins", array());
$editor_type = 'editor';
$config = $wysiwygConfig;
}
$fieldset->addField('message', $editor_type, array('label' => Mage::helper('webforms')->__('Message'), 'title' => Mage::helper('webforms')->__('Message'), 'style' => 'width:700px; height:300px;', 'name' => 'message', 'required' => true, 'config' => $config));
if (Mage::getSingleton('adminhtml/session')->getFormData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getFormData());
Mage::getSingleton('adminhtml/session')->setFormData(false);
} elseif (Mage::registry('quickresponse')->getId()) {
$form->setValues(Mage::registry('quickresponse')->getData());
}
$form->addField('quickresponse_id', 'hidden', array('name' => 'quickresponse_id', 'value' => $id));
$form->addField('saveandcontinue', 'hidden', array('name' => 'saveandcontinue'));
$form->setUseContainer(true);
$this->setForm($form);
}
开发者ID:monarcmoso,项目名称:beta2,代码行数:34,代码来源:VladimirPopov_WebForms_Block_Adminhtml_Quickresponse_Edit_Form.php
示例8: _prepareForm
protected function _prepareForm()
{
$collection = Mage::getResourceModel('clmcenter/comment_collection');
$mcenter_id = $this->getRequest()->getParam('id');
$tableName = Mage::getSingleton('core/resource')->getTableName('clmcenter_mcenter');
$collection->getSelect()->joinLeft($tableName, 'main_table.mcenter_id = ' . $tableName . '.mcenter_id', 'title');
$collection->getSelect()->distinct();
$collection->getSelect()->where('main_table.mcenter_id =' . $mcenter_id);
$collection->getSelect()->limit(1);
$data = $collection->getData();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
$fieldset = $form->addFieldset('comment_form', array('legend' => Mage::helper('clmcenter')->__('Комментарий')));
$fieldset->addField('title', 'hidden', array('label' => Mage::helper('clmcenter')->__('Наименование'), 'after_element_html' => '<tr><td class="label"><label for="title">Наименование</label></td>
<td class="value">' . $data[0]['title'] . '</td></tr>'));
$fieldset->addField('user', 'text', array('label' => Mage::helper('clmcenter')->__('Пользователь'), 'name' => 'user'));
$fieldset->addField('email', 'text', array('label' => Mage::helper('clmcenter')->__('E-mail'), 'name' => 'email'));
$fieldset->addField('comment_status', 'select', array('label' => Mage::helper('clmcenter')->__('Статус'), 'name' => 'comment_status', 'values' => array(array('value' => CommerceLab_Mcenter_Helper_Data::UNAPPROVED_STATUS, 'label' => Mage::helper('clmcenter')->__('Отклонен')), array('value' => CommerceLab_Mcenter_Helper_Data::APPROVED_STATUS, 'label' => Mage::helper('clmcenter')->__('Одобрен')))));
$fieldset->addField('comment', 'editor', array('name' => 'comment', 'label' => Mage::helper('clmcenter')->__('Комментарий'), 'title' => Mage::helper('clmcenter')->__('Комментарий'), 'style' => 'width:500px; height:250px;', 'wysiwyg' => false, 'required' => false));
if (Mage::getSingleton('adminhtml/session')->getMcenterData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getMcenterData());
Mage::getSingleton('adminhtml/session')->setMcenterData(null);
} elseif (Mage::registry('clmcenter_data')) {
$form->setValues(Mage::registry('clmcenter_data')->getData());
}
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例9: _prepareLayout
protected function _prepareLayout()
{
parent::_prepareLayout();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'), 'webform_id' => $this->getRequest()->getParam('webform_id'), 'store' => $this->getRequest()->getParam('store'))), 'method' => 'post'));
$renderer = $this->getLayout()->createBlock('webforms/adminhtml_element_field');
$form->setFieldsetElementRenderer($renderer);
$form->setFieldNameSuffix('logic');
$form->setDataObject(Mage::registry('logic'));
$fieldset = $form->addFieldset('fieldset_information', array('legend' => Mage::helper('webforms')->__('Logic Rule')));
$fieldset->addField('logic_condition', 'select', array('label' => Mage::helper('webforms')->__('Condition'), 'name' => 'logic_condition', 'options' => Mage::getModel('webforms/logic_condition')->getOptions()));
$fieldset->addField('value', 'multiselect', array('label' => Mage::helper('webforms')->__('Trigger value(s)'), 'required' => true, 'name' => 'value', 'note' => Mage::helper('webforms')->__('Select one or multiple trigger values.<br>Please, configure for each locale <b>Store View</b>.'), 'values' => Mage::registry('field')->getOptionsArray()));
$fieldset->addField('action', 'select', array('label' => Mage::helper('webforms')->__('Action'), 'name' => 'action', 'options' => Mage::getModel('webforms/logic_action')->getOptions(), 'note' => Mage::helper('webforms')->__('Action to perform with target elements')));
$fieldset->addField('target', 'multiselect', array('label' => Mage::helper('webforms')->__('Target element(s)'), 'required' => true, 'name' => 'target', 'note' => Mage::helper('webforms')->__('Select one or multiple target elements'), 'values' => Mage::registry('field')->getLogicTargetOptionsArray()));
if (Mage::registry('field')->getType() == 'select/checkbox') {
$fieldset->addField('aggregation', 'select', array('label' => Mage::helper('webforms')->__('Logic aggregation'), 'name' => 'aggregation', 'options' => Mage::getModel('webforms/logic_aggregation')->getOptions()));
}
$fieldset->addField('is_active', 'select', array('label' => Mage::helper('webforms')->__('Status'), 'title' => Mage::helper('webforms')->__('Status'), 'name' => 'is_active', 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses()));
$form->addField('field_id', 'hidden', array('name' => 'field_id'));
$form->addField('saveandcontinue', 'hidden', array('name' => 'saveandcontinue'));
if (Mage::getSingleton('adminhtml/session')->getWebFormsData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
} elseif (Mage::registry('logic')) {
$form->setValues(Mage::registry('logic')->getData());
}
$form->setUseContainer(true);
Mage::dispatchEvent('webforms_adminhtml_logic_edit_form_prepare_layout', array('form' => $form));
$this->setForm($form);
}
示例10: initForm
public function initForm()
{
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('news_time_data', array('legend' => Mage::helper('clnews')->__('News Time Settings'), 'style' => 'width: 520px;'));
$fieldset->addField('news_time', 'date', array('name' => 'news_time', 'label' => Mage::helper('clnews')->__('News Time'), 'title' => Mage::helper('clnews')->__('News Time'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT), 'after_element_html' => '<span class="hint" style="white-space:nowrap;"><p class="note">' . Mage::helper('clnews')->__('Next to the Article will be stated current time') . '</p></span>'));
$fieldset->addField('publicate_from_time', 'date', array('name' => 'publicate_from_time', 'label' => Mage::helper('clnews')->__('Publish From:'), 'title' => Mage::helper('clnews')->__('Publish From:'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
$values = $this->getTimeValues(0, 23);
$fieldset->addField('publicate_from_hours', 'select', array('label' => Mage::helper('clnews')->__('Hours'), 'name' => 'publicate_from_hours', 'style' => 'width: 50px!important;', 'values' => $values));
$values = $this->getTimeValues(0, 59);
$fieldset->addField('publicate_from_minutes', 'select', array('label' => Mage::helper('clnews')->__('Minutes'), 'name' => 'publicate_from_minutes', 'style' => 'width: 50px!important;', 'values' => $values));
$fieldset->addField('publicate_to_time', 'date', array('name' => 'publicate_to_time', 'label' => Mage::helper('clnews')->__('Publish Until:'), 'title' => Mage::helper('clnews')->__('Publish Until:'), 'image' => $this->getSkinUrl('images/grid-cal.gif'), 'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
$values = $this->getTimeValues(0, 23);
$fieldset->addField('publicate_to_hours', 'select', array('label' => Mage::helper('clnews')->__('Hours'), 'name' => 'publicate_to_hours', 'style' => 'width: 50px!important;', 'values' => $values));
$values = $this->getTimeValues(0, 59);
$fieldset->addField('publicate_to_minutes', 'select', array('label' => Mage::helper('clnews')->__('Minutes'), 'name' => 'publicate_to_minutes', 'style' => 'width: 50px!important', 'values' => $values));
$fieldset = $form->addFieldset('news_meta_data', array('legend' => Mage::helper('clnews')->__('Meta Data')));
$fieldset->addField('meta_keywords', 'editor', array('name' => 'meta_keywords', 'label' => Mage::helper('clnews')->__('Keywords'), 'title' => Mage::helper('clnews')->__('Meta Keywords'), 'style' => 'width: 520px;'));
$fieldset->addField('meta_description', 'editor', array('name' => 'meta_description', 'label' => Mage::helper('clnews')->__('Description'), 'title' => Mage::helper('clnews')->__('Meta Description'), 'style' => 'width: 520px;'));
$fieldset = $form->addFieldset('news_options_data', array('legend' => Mage::helper('clnews')->__('Advanced Post Options')));
$fieldset->addField('author', 'text', array('label' => Mage::helper('clnews')->__('Author name'), 'name' => 'author', 'style' => 'width: 520px;', 'after_element_html' => '<span class="hint"><p class="note">' . $this->__('Leave blank to disable') . '</p></span>'));
if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
Mage::getSingleton('adminhtml/session')->setNewsData(null);
} elseif (Mage::registry('clnews_data')) {
$form->setValues(Mage::registry('clnews_data')->getData());
}
$this->setForm($form);
return $this;
}
示例11: _prepareLayout
protected function _prepareLayout()
{
parent::_prepareLayout();
$model = Mage::getModel('webforms/fieldsets');
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
$fieldset = $form->addFieldset('fieldset_information', array('legend' => Mage::helper('webforms')->__('Information')));
$fieldset->addField('name', 'text', array('label' => Mage::helper('webforms')->__('Name'), 'class' => 'required-entry', 'required' => true, 'name' => 'name'));
$fieldset->addField('position', 'text', array('label' => Mage::helper('webforms')->__('Position'), 'required' => true, 'name' => 'position', 'note' => Mage::helper('webforms')->__('Fieldset position in the form')));
$fieldset->addField('is_active', 'select', array('label' => Mage::helper('webforms')->__('Status'), 'title' => Mage::helper('webforms')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => Mage::getModel('webforms/webforms')->getAvailableStatuses()));
$fieldset->addField('webform_id', 'hidden', array('name' => 'webform_id', 'value' => 1));
$fieldset->addField('saveandcontinue', 'hidden', array('name' => 'saveandcontinue'));
if (!$model->getId()) {
$model->setData('is_active', '0');
}
if (Mage::getSingleton('adminhtml/session')->getWebFormsData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getWebFormsData());
Mage::getSingleton('adminhtml/session')->setWebFormsData(null);
} elseif (Mage::registry('fieldsets_data')) {
$form->setValues(Mage::registry('fieldsets_data')->getData());
}
// set default field values
if (!Mage::registry('fieldsets_data')->getId()) {
$form->setValues(array('webform_id' => $this->getRequest()->getParam('webform_id'), 'position' => 10));
}
$form->setUseContainer(true);
Mage::dispatchEvent('webforms_adminhtml_fieldsets_edit_form_prepare_layout', array('form' => $form, 'fieldset' => $fieldset));
$this->setForm($form);
}
示例12: _prepareForm
/**
* Prepare the Form.
*
* @return Mage_Adminhtml_Block_Widget_Form
*/
protected function _prepareForm()
{
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset("base_fieldset", array("legend" => Mage::helper("dhlocation")->__("Item information")));
$model = Mage::registry("location_data");
if ($model->getId()) {
$fieldset->addField('id', 'hidden', array('name' => 'id'));
}
$fieldset->addType('image', 'Doghouse_Location_Block_Adminhtml_Location_Helper_Image');
$fieldset->addField("name", "text", array("label" => Mage::helper("dhlocation")->__("Location Name"), "class" => "required-entry", "required" => true, "name" => "name"));
$fieldset->addField("address", "text", array("label" => Mage::helper("dhlocation")->__("Address"), "name" => "address"));
$fieldset->addField("suburb", "text", array("label" => Mage::helper("dhlocation")->__("City or Suburb"), "name" => "suburb"));
$fieldset->addField("state", "text", array("label" => Mage::helper("dhlocation")->__("State"), "name" => "state"));
$fieldset->addField("phone", "text", array("label" => Mage::helper("dhlocation")->__("Phone number"), "name" => "phone"));
$fieldset->addField("email", "text", array("label" => Mage::helper("dhlocation")->__("Email"), "name" => "email"));
$fieldset->addField("image", "image", array("label" => Mage::helper("dhlocation")->__("Image"), "name" => "image"));
$fieldset->addField("location_url", "text", array("label" => Mage::helper("dhlocation")->__("Google Maps Location URL"), "name" => "location_url", "after_element_html" => "<small>Google Maps iframe URL (see <a target=\"_blank\" href=\"https://developers.google.com/maps/documentation/embed/guide\">Google Maps Documentation</a> for more information).</small>"));
$fieldset->addField("item_order", "text", array("label" => Mage::helper("dhlocation")->__("Order"), "after_element_html" => "<small>Low to high</small>", "name" => "item_order"));
if (Mage::registry("location_data")) {
$form->setValues(Mage::registry("location_data")->getData());
} elseif (Mage::getSingleton("adminhtml/session")->getLocationData()) {
$form->setValues(Mage::getSingleton("adminhtml/session")->getLocationData());
Mage::getSingleton("adminhtml/session")->setLocationData(null);
}
// Don't use container because we don't want this block to ouput the <form> tags
// $form->setUseContainer(true);
$this->setForm($form);
Mage::dispatchEvent('dhlocation_location_edit_form_prepare_form', array('block' => $this));
return parent::_prepareForm();
}
示例13: _prepareForm
protected function _prepareForm()
{
$collection = Mage::getResourceModel('clnews/comment_collection');
$news_id = $this->getRequest()->getParam('id');
$tableName = Mage::getSingleton('core/resource')->getTableName('clnews_news');
$collection->getSelect()->joinLeft($tableName, 'main_table.news_id = ' . $tableName . '.news_id', 'title');
$collection->getSelect()->distinct();
$collection->getSelect()->where('main_table.news_id =' . $news_id);
$collection->getSelect()->limit(1);
$data = $collection->getData();
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post'));
$fieldset = $form->addFieldset('comment_form', array('legend' => Mage::helper('clnews')->__('Comment Information')));
$fieldset->addField('title', 'hidden', array('label' => Mage::helper('clnews')->__('News Name'), 'after_element_html' => '<tr><td class="label"><label for="title">News Name</label></td>
<td class="value">' . $data[0]['title'] . '</td></tr>'));
$fieldset->addField('user', 'text', array('label' => Mage::helper('clnews')->__('User'), 'name' => 'user'));
$fieldset->addField('email', 'text', array('label' => Mage::helper('clnews')->__('Email Address'), 'name' => 'email'));
$fieldset->addField('comment_status', 'select', array('label' => Mage::helper('clnews')->__('Status'), 'name' => 'comment_status', 'values' => array(array('value' => Sunpop_News_Helper_Data::UNAPPROVED_STATUS, 'label' => Mage::helper('clnews')->__('Unapproved')), array('value' => Sunpop_News_Helper_Data::APPROVED_STATUS, 'label' => Mage::helper('clnews')->__('Approved')))));
$fieldset->addField('comment', 'editor', array('name' => 'comment', 'label' => Mage::helper('clnews')->__('Comment'), 'title' => Mage::helper('clnews')->__('Comment'), 'style' => 'width:500px; height:250px;', 'wysiwyg' => false, 'required' => false));
if (Mage::getSingleton('adminhtml/session')->getNewsData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getNewsData());
Mage::getSingleton('adminhtml/session')->setNewsData(null);
} elseif (Mage::registry('clnews_data')) {
$form->setValues(Mage::registry('clnews_data')->getData());
}
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例14: initForm
public function initForm()
{
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('member_form', array('legend' => Mage::helper('bluecom_team')->__('Social links')));
$fieldset->addField('skype', 'text', array('name' => 'skype', 'label' => Mage::helper('bluecom_team')->__('Skype ID'), 'title' => Mage::helper('bluecom_team')->__('Skype ID'), 'required' => false));
$fieldset->addField('yahoo', 'text', array('name' => 'yahoo', 'label' => Mage::helper('bluecom_team')->__('Yahoo ID'), 'title' => Mage::helper('bluecom_team')->__('Yahoo ID'), 'required' => false));
$fieldset->addField('facebook', 'text', array('name' => 'facebook', 'label' => Mage::helper('bluecom_team')->__('Facebook'), 'title' => Mage::helper('bluecom_team')->__('Facebook'), 'required' => false));
$fieldset->addField('youtube', 'text', array('name' => 'youtube', 'label' => Mage::helper('bluecom_team')->__('Youtube'), 'title' => Mage::helper('bluecom_team')->__('Youtube'), 'required' => false));
$fieldset->addField('linkedin', 'text', array('name' => 'linkedin', 'label' => Mage::helper('bluecom_team')->__('LinkedIn'), 'title' => Mage::helper('bluecom_team')->__('LinkedIn'), 'required' => false));
if (Mage::app()->isSingleStoreMode()) {
$fieldset->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
}
if (Mage::getSingleton('adminhtml/session')->getMemberData()) {
$form->setValues(Mage::getSingleton('adminhtml/session')->getMemberData());
Mage::getSingleton('adminhtml/session')->getMemberData(null);
} elseif (Mage::registry('bluecom_team_member')) {
$data = Mage::registry('bluecom_team_member');
if ($data->getImageShortContent() == $data->getImageFullContent() || $data->getImageShortContent() == '' || !$data->getImageShortContent()) {
$data->setUseFullImg(1);
}
$form->setValues($data->getData());
}
$this->setForm($form);
return $this;
}
示例15: _prepareForm
protected function _prepareForm()
{
$config = Mage::getSingleton('mturbo/config');
$this->form = new Varien_Data_Form();
$this->_addActionFieldset();
$this->form->setValues($config->getData());
$this->setForm($this->form);
return parent::_prepareForm();
}