本文整理匯總了PHP中Varien_Data_Form_Element_Select::setId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Data_Form_Element_Select::setId方法的具體用法?PHP Varien_Data_Form_Element_Select::setId怎麽用?PHP Varien_Data_Form_Element_Select::setId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Varien_Data_Form_Element_Select
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Select::setId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _prepareForm
protected function _prepareForm()
{
if (Mage::getSingleton('adminhtml/session')->getFormData()) {
$data = Mage::getSingleton('adminhtml/session')->getFormData();
} elseif ($this->getPeriod()) {
$data = $this->getPeriod()->getData();
}
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$fieldset = $form->addFieldset('period_details', array('legend' => $this->__('Period Details')));
$fieldset->addField('id', 'hidden', array('required' => false, 'name' => 'id'));
$fieldset->addField('name', 'text', array('required' => true, 'name' => 'name', 'label' => 'Name'));
$fieldset->addField('sort_order', 'text', array('required' => false, 'name' => 'sort_order', 'label' => 'Sort Order'));
$select = new Varien_Data_Form_Element_Select(array('name' => 'period_type', 'style' => 'width:241px', 'options' => Mage::getModel('sarp/source_periods')->getGridOptions()));
$select->setId('period_type')->setRenderer(Mage::getBlockSingleton('sarp/adminhtml_widget_form_renderer_element'))->setForm($form)->setValue(@$data['period_type']);
$fieldset->addField('period_value', 'text', array('required' => true, 'name' => 'period_value', 'label' => 'Repeat each', 'style' => 'width:30px', 'after_element_html' => $select->toHtml()));
$selectE = new Varien_Data_Form_Element_Select(array('name' => 'expire_type', 'style' => 'width:241px', 'options' => Mage::getModel('sarp/source_periods')->getGridOptions()));
$selectE->setId('expire_type')->setRenderer(Mage::getBlockSingleton('sarp/adminhtml_widget_form_renderer_element'))->setForm($form)->setValue(@$data['expire_type']);
$fieldset->addField('expire_value', 'text', array('required' => false, 'name' => 'expire_value', 'label' => 'Expires After', 'style' => 'width:30px', 'after_element_html' => $selectE->toHtml()));
$fieldset->addField('excluded_weekdays', 'multiselect', array('required' => false, 'name' => 'excluded_weekdays', 'label' => 'Exclude Weekdays', 'values' => Mage::getModel('sarp/source_periods_weekdays')->getAllOptions()));
$fieldset->addField('payment_offset', 'text', array('required' => false, 'name' => 'payment_offset', 'label' => 'Require payment before, days'));
if (!isset($data['expire_value']) || $data['expire_value'] == 0) {
$data['expire_value'] = '';
}
if (!isset($data['excluded_weekdays']) || !strlen($data['excluded_weekdays'])) {
$data['excluded_weekdays'] = -1;
}
$form->setValues($data);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
示例2: _prepareForm
protected function _prepareForm()
{
$model = Mage::registry('themeframework_area');
$form = new Varien_Data_Form();
$scopeFS = $form->addFieldset('scope_fieldset', array('legend' => Mage::helper('themeframework')->__("Scope")));
if ($model->getAreaId()) {
$scopeFS->addField('area_id', 'hidden', array('name' => 'area_id'));
}
// add Package Name element
// $scopeFS->addField('package_name', 'select', array(
// 'name' => 'package_theme',
// 'label' => Mage::helper('widget')->__('Design Package/Theme'),
// 'title' => Mage::helper('widget')->__('Design Package/Theme'),
// 'required' => true,
// 'values' => $this->getPackegeThemeOptionsArray()
// ));
// add Store ID element
if (!Mage::app()->isSingleStoreMode()) {
$field = $scopeFS->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)));
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
$field->setRenderer($renderer);
} else {
$scopeFS->addField('store_id', 'hidden', array('name' => 'stores[]', 'value' => Mage::app()->getStore(true)->getId()));
}
// add Package Name element
$el = new Varien_Data_Form_Element_Select(array('name' => 'package_theme', 'label' => Mage::helper('widget')->__('Design Package/Theme'), 'title' => Mage::helper('widget')->__('Design Package/Theme'), 'required' => true, 'values' => $this->getPackegeThemeOptionsArray(), 'onchange' => "EM_Framework.canvas.onThemeChange(this.value)"));
$el->setId('package_theme');
$form->addElement($el);
// Layout field
$scopeFS->addField('layout', 'select', array('label' => Mage::helper('themeframework')->__('Layout'), 'title' => Mage::helper('themeframework')->__('Layout'), 'name' => 'layout', 'required' => true, 'options' => array('1column' => Mage::helper('themeframework')->__('1 column'), '2columns-left' => Mage::helper('themeframework')->__('2 columns with left bar'), '2columns-right' => Mage::helper('themeframework')->__('2 columns with right bar'), '3columns' => Mage::helper('themeframework')->__('3 columns'))));
// is_active field
$scopeFS->addField('is_active', 'select', array('label' => Mage::helper('themeframework')->__('Status'), 'title' => Mage::helper('themeframework')->__('Status'), 'name' => 'is_active', 'required' => true, 'options' => array('1' => Mage::helper('themeframework')->__('Enabled'), '0' => Mage::helper('themeframework')->__('Disabled'))));
if (!$model->getId()) {
$model->setData('is_active', '1');
}
// hidden field: json_content
$scopeFS->addField('json_content', 'hidden', array('name' => 'json_content'));
$form->setValues($model->getData());
$form->setUseContainer(true);
$this->setForm($form);
ob_start();
?>
<script type="text/javascript">
EM_Framework.THEME_BLOCKS = <?php
echo json_encode($this->getSupportedContainerBlocks());
?>
;
EM_Framework.CANVAS_CONTENT = <?php
echo json_encode($model->getContentDecode());
?>
;
</script>
<?php
$extraHtml = ob_get_contents();
ob_end_clean();
$this->assign('extraHtml', $extraHtml);
return parent::_prepareForm();
}
示例3: _prepareForm
protected function _prepareForm()
{
if (Mage::getSingleton('adminhtml/session')->getFormData()) {
$data = Mage::getSingleton('adminhtml/session')->getFormData();
} elseif ($this->getAlert()) {
$data = $this->getAlert()->getData();
}
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$fieldset = $form->addFieldset('alert_details', array('legend' => $this->__('Alert Details')));
$fieldset->addField('id', 'hidden', array('required' => false, 'name' => 'id'));
$fieldset->addField('name', 'text', array('required' => true, 'name' => 'name', 'label' => 'Name'));
// Status field
$fieldset->addField('status', 'select', array('required' => true, 'name' => 'status', 'label' => 'Status', 'options' => Mage::getModel('sarp/source_alert_status')->getGridOptions()));
$fieldset->addField('type', 'select', array('required' => true, 'name' => 'type', 'label' => 'Event Type', 'onchange' => 'switchTemplates($(this).getValue())', 'options' => Mage::getModel('sarp/source_alert_type')->getGridOptions()));
$fieldset->addField('recipient', 'select', array('required' => true, 'name' => 'recipient', 'onchange' => 'switchTemplates($F(\'type\'))', 'label' => 'Recipient', 'options' => Mage::getModel('sarp/source_alert_recipient')->getGridOptions()));
$selectIsAfter = new Varien_Data_Form_Element_Select(array('name' => 'time_is_after', 'style' => 'width:120px', 'options' => array('0' => $this->__('Before'), '1' => $this->__('After'))));
$selectIsAfter->setId('time_is_after')->setRenderer(Mage::getBlockSingleton('sarp/adminhtml_widget_form_renderer_element'))->setForm($form)->setValue(@$data['time_is_after']);
$selectMultiplier = new Varien_Data_Form_Element_Select(array('name' => 'time_multiplier', 'style' => 'width:120px', 'options' => Mage::getModel('sarp/source_alert_multiplier')->getGridOptions()));
$selectMultiplier->setId('time_multiplier')->setRenderer(Mage::getBlockSingleton('sarp/adminhtml_widget_form_renderer_element'))->setForm($form)->setValue(@$data['time_multiplier']);
$fieldset->addField('time_amount', 'text', array('required' => true, 'name' => 'time_amount', 'label' => 'Notify', 'style' => 'width:30px', 'after_element_html' => $selectMultiplier->toHtml() . $selectIsAfter->toHtml()));
$fieldset->addField('store_ids', 'multiselect', array('required' => true, 'name' => 'store_ids', 'label' => 'Store', 'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true)));
$fieldset->addField('email_template_date_start', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/firstdelivery')->toOptionArray()));
$fieldset->addField('email_template_activation', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/activation')->toOptionArray()));
$fieldset->addField('email_template_delivery', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/delivery')->toOptionArray()));
$fieldset->addField('email_template_date_expire', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/expiredate')->toOptionArray()));
$fieldset->addField('email_template_new_subscription', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/newsubscription')->toOptionArray()));
$fieldset->addField('email_template_cancel_subscription', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/unsubscription')->toOptionArray()));
$fieldset->addField('email_template_suspended', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/suspended')->toOptionArray()));
$fieldset->addField('email_template_date_start_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/firstdelivery_admin')->toOptionArray()));
$fieldset->addField('email_template_activation_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/activation_admin')->toOptionArray()));
$fieldset->addField('email_template_delivery_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/delivery_admin')->toOptionArray()));
$fieldset->addField('email_template_date_expire_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/expiredate_admin')->toOptionArray()));
$fieldset->addField('email_template_new_subscription_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/newsubscription_admin')->toOptionArray()));
$fieldset->addField('email_template_cancel_subscription_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/unsubscription_admin')->toOptionArray()));
$fieldset->addField('email_template_suspended_admin', 'select', array('label' => $this->__('Template'), 'note' => '', 'class' => 'template_selector', 'name' => 'email_template', 'values' => Mage::getModel('adminhtml/system_config_source_email_template')->setPath('sarp/template/suspended_admin')->toOptionArray()));
foreach (array('email_template_date_start', 'email_template_activation', 'email_template_delivery', 'email_template_date_expire', 'email_template_new_subscription', 'email_template_cancel_subscription', 'email_template_suspended_subscription', 'email_template_date_start_admin', 'email_template_activation_admin', 'email_template_delivery_admin', 'email_template_date_expire_admin', 'email_template_new_subscription_admin', 'email_template_cancel_subscription_admin', 'email_template_suspended_subscription_admin') as $id) {
$data[$id] = @$data['email_template'];
}
$form->setValues($data);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}