本文整理汇总了PHP中Varien_Data_Form_Element_Select类的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Select类的具体用法?PHP Varien_Data_Form_Element_Select怎么用?PHP Varien_Data_Form_Element_Select使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Varien_Data_Form_Element_Select类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = $this->_getHeaderHtml($element);
$renderer = Mage::getBlockSingleton('adminhtml/system_config_form_field');
$attributes = Mage::getConfig()->getNode(self::XML_PATH_IMAGE_TYPES)->asArray();
foreach ($attributes as $key => $attribute) {
/**
* Watermark size field
*/
$field = new Varien_Data_Form_Element_Text();
$field->setName("groups[watermark][fields][{$key}_size][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Size for %s', $attribute['title']))->setRenderer($renderer);
$html .= $field->toHtml();
/**
* Watermark upload field
*/
$field = new Varien_Data_Form_Element_Imagefile();
$field->setName("groups[watermark][fields][{$key}_image][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Watermark File for %s', $attribute['title']))->setRenderer($renderer);
$html .= $field->toHtml();
/**
* Watermark position field
*/
$field = new Varien_Data_Form_Element_Select();
$field->setName("groups[watermark][fields][{$key}_position][value]")->setForm($this->getForm())->setLabel(Mage::helper('adminhtml')->__('Position of Watermark for %s', $attribute['title']))->setRenderer($renderer)->setValues(Mage::getSingleton('adminhtml/system_config_source_catalog_product_watermark_position')->toOptionArray());
$html .= $field->toHtml();
}
$html .= $this->_getFooterHtml($element);
return $html;
}
示例3: testGetElementHtmlContainsScriptTag
public function testGetElementHtmlContainsScriptTag()
{
$element = new Varien_Data_Form_Element_Select();
$element->setForm(new Varien_Object());
$block = new Netresearch_OPS_Block_System_Config_Mode();
$html = $block->render($element);
$this->assertTrue(preg_match('/<script/', $html) > 0);
}
示例4: _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();
}
示例5: toFormElementSelect
/**
*
* @return Varien_Data_Form_Element_Select
*/
public function toFormElementSelect()
{
$data = $this->get();
natcasesort($data);
array_unshift($data, '');
$selectType = new Varien_Data_Form_Element_Select();
$selectType->setName('job_code')->setId('job_code')->setForm(new Varien_Data_Form())->addClass('required-entry')->setValues($data);
return $selectType;
}
示例6: _renderCellTemplate
/**
* Render array cell for prototypeJS template
*
* @param string $columnName
* @return string
*/
protected function _renderCellTemplate($columnName)
{
if ($columnName == 'value' && isset($this->_columns[$columnName])) {
$element = new Varien_Data_Form_Element_Select();
$element->setForm($this->getForm())->setName($this->_getCellInputElementName($columnName))->setHtmlId($this->_getCellInputElementId('#{_id}', $columnName))->setValues(Mage::getModel('Mage_Core_Model_Design_Source_Design')->getAllOptions(false));
return str_replace("\n", '', $element->getElementHtml());
}
return parent::_renderCellTemplate($columnName);
}
示例7: _toHtml
/**
* @return string
*/
protected function _toHtml()
{
$htmlId = $this->getColumnName() . '#{_id}';
$select = new Varien_Data_Form_Element_Select(array('html_id' => $htmlId, 'no_span' => TRUE, 'name' => $this->getInputName()));
$select->addData($this->getColumn());
$select->setForm(new Varien_Object());
$select->setValues($this->getValues());
// Escape properly and use javascript to set the selected values
return str_replace(array("\n", '"', '/'), array('', '\\"', '\\/'), "\n {$select->getElementHtml()}\n <script type=\"text\\/javascript\">\n \$(\"{$htmlId}\").setValue(\"#{{$this->getColumnName()}}\");\n </script>\n ");
}
示例8: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$__html = '';
if (!Mage::app()->isSingleStoreMode()) {
$__replacingElement = new Varien_Data_Form_Element_Select();
$__replacingElement->setData($element->getData());
$__replacingElement->setForm($element->getForm());
$__html = parent::render($__replacingElement);
}
return $__html;
}
示例9: _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();
}
示例10: getAfterElementHtml
public function getAfterElementHtml()
{
$html = parent::getAfterElementHtml();
$html .= '
<script type="text/javascript">
var switchStatementPoStatusSelect = function() {
for (i=0; i<$("statement_po_type").options.length; i++) {
var statusSel = $("statement_"+$("statement_po_type").options[i].value+"_status")
if (statusSel) {
if (statusSel.id == "statement_"+$("statement_po_type").value+"_status") {
statusSel.up("tr").show()
statusSel.enable()
} else {
statusSel.up("tr").hide()
statusSel.disable()
}
}
}
}
$("statement_po_type").observe("change", switchStatementPoStatusSelect)
document.observe("dom:loaded", switchStatementPoStatusSelect)
</script>
';
return $html;
}
示例11: getAfterElementHtml
public function getAfterElementHtml()
{
$html = parent::getAfterElementHtml();
$html .= '
<script type="text/javascript">
var switchPayoutPoStatusSelect = function() {
var defStPoType = "' . Mage::getStoreConfig('udropship/statement/statement_po_type') . '";
var getStPoType = function(val) {
return val == "999" ? defStPoType : val;
}
for (i=0; i<$("statement_po_type").options.length; i++) {
var statusSel = $("payout_"+getStPoType($("statement_po_type").options[i].value)+"_status");
if (statusSel) {
if (statusSel.id == "payout_"+getStPoType($("statement_po_type").value)+"_status" && $("payout_po_status_type").value == "payout") {
statusSel.up("tr").show();
statusSel.enable();
} else {
statusSel.up("tr").hide();
statusSel.disable();
}
}
}
}
document.observe("dom:loaded", function(){
$("payout_po_status_type").observe("change", switchPayoutPoStatusSelect)
$("statement_po_type").observe("change", switchPayoutPoStatusSelect)
switchPayoutPoStatusSelect();
});
</script>
';
return $html;
}
示例12: getAfterElementHtml
public function getAfterElementHtml()
{
$html = parent::getAfterElementHtml();
$defPoType = (string) Mage::getStoreConfig('udropship/statement/statement_po_type');
$html .= '
<script type="text/javascript">
var switchStatementPoStatusSelect = function() {
for (i=0; i<$("statement_po_type").options.length; i++) {
var poTypeValue = $("statement_po_type").value;
if (poTypeValue == "999") {
poTypeValue = "' . $defPoType . '";
}
var statusSel = $("statement_"+$("statement_po_type").options[i].value+"_status")
if (statusSel) {
if (statusSel.id == "statement_"+poTypeValue+"_status") {
statusSel.up("tr").show()
statusSel.enable()
} else {
statusSel.up("tr").hide()
statusSel.disable()
}
}
}
}
$("statement_po_type").observe("change", switchStatementPoStatusSelect)
document.observe("dom:loaded", switchStatementPoStatusSelect)
</script>
';
return $html;
}
示例13: getElementHtml
/**
* Retrieve Element HTML fragment
*
* @return string
*/
public function getElementHtml()
{
if (is_null($this->getValue())) {
$this->setValue(Enterprise_Rma_Model_Product_Source::ATTRIBUTE_ENABLE_RMA_USE_CONFIG);
}
return parent::getElementHtml();
}
示例14: getElementHtml
/**
* Retrieve Element HTML fragment
*
* @return string
*/
public function getElementHtml()
{
if (is_null($this->getValue())) {
$this->setValue(Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type_Enabled::MSRP_ENABLE_USE_CONFIG);
}
return parent::getElementHtml();
}
示例15: _optionToHtml
/**
* Ensures that that both '' and '0' don't get set as selected at the same time
*
* @param $option
* @param array $selected
* @return string
*/
protected function _optionToHtml($option, $selected)
{
if (count($selected) > 0 && trim($selected[0]) === '') {
$selected = array();
}
return parent::_optionToHtml($option, $selected);
}