本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::setValues方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::setValues方法的具体用法?PHP Varien_Data_Form_Element_Abstract::setValues怎么用?PHP Varien_Data_Form_Element_Abstract::setValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::setValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setStyle('display:block')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$payments = Mage::getSingleton('payment/config')->getActiveMethods();
$allowedDefault = array();
$elementsJs = array();
foreach ($payments as $paymentCode => $paymentModel) {
$paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title');
$methodsAllowed[$paymentCode] = array('label' => $paymentTitle, 'value' => $paymentCode . "_allow");
array_push($allowedDefault, $paymentCode . "_allow");
$elementsJs[] = $element->getId() . '_' . $paymentCode . "";
}
foreach ($payments as $paymentCode => $paymentModel) {
$paymentTitle = Mage::getStoreConfig('payment/' . $paymentCode . '/title');
$methodsDenied[$paymentCode] = array('label' => $paymentTitle, 'value' => $paymentCode . "_deny");
}
if (empty($values)) {
$values = $allowedDefault;
}
$from = $element->setValues($methodsAllowed)->setValue($values)->getElementHtml();
$to = $element->setValues($methodsDenied)->setValue($values)->getElementHtml();
$script = "";
foreach ($elementsJs as $elementj) {
$script .= "\n document.getElementById('" . $elementj . "_allow').addEventListener('click', function() {\n if (document.getElementById('" . $elementj . "_deny').checked == true) {\n document.getElementById('" . $elementj . "_deny').checked = false;\n } else {\n document.getElementById('" . $elementj . "_deny').checked = true;\n }\n }, false);\n document.getElementById('" . $elementj . "_deny').addEventListener('click', function() {\n if (document.getElementById('" . $elementj . "_allow').checked == true) {\n document.getElementById('" . $elementj . "_allow').checked = false;\n } else {\n document.getElementById('" . $elementj . "_allow').checked = true;\n\n }\n }, false);\n if (document.getElementById('" . $elementj . "_deny').checked == false && document.getElementById('" . $elementj . "_allow').checked == false) {\n document.getElementById('" . $elementj . "_allow').checked = true;\n }\n ";
}
return '<div style="white-space: nowrap;"><div style="display:inline-block;padding: 0 5px 0 0; width:50%">' . $from . '</div> <div style="display:inline-block;padding: 0 5px 0 0; width:50%">' . $to . '</div></div><script>' . $script . '</script>';
}
示例2: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$scope = $element->getScope();
$scope_id = $element->getScopeId();
$inherit = $element->getInherit();
$factoryName = (string) $element->getFieldConfig()->source_model;
$sourceModel = Mage::getSingleton($factoryName);
$optionArray = $sourceModel->toOptionArray(True, $scope, $scope_id);
$element->setValues($optionArray);
$html = $this->getElementHtml($element);
return $html;
// return parent::_getElementHtml($element);
}
示例3: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$_options = array('d' => Mage::helper('adminhtml')->__('Day'), 'm' => Mage::helper('adminhtml')->__('Month'), 'y' => Mage::helper('adminhtml')->__('Year'));
$element->setValues($_options)->setClass('select-date')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$_parts = array();
$_parts[] = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$_parts[] = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
$_parts[] = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
return implode(' <span>/</span> ', $_parts);
}
示例4: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$_options = array('d' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Day'), 'm' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Month'), 'y' => Mage::helper('Mage_Adminhtml_Helper_Data')->__('Year'));
$element->setValues($_options)->setStyle('width:70px;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$_parts = array();
$_parts[] = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$_parts[] = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
$_parts[] = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
return implode(' / ', $_parts);
}
示例5: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$html = '';
$value = explode(',', $element->getValue());
$form = $element->getForm();
$nameprefix = $element->getName();
$element->setValues(array('all' => $this->__('All Days'), 'selected' => $this->__('Selected Days')))->setOnchange('$(\'gomage-delivverydate-specdays\').style.display = (this.value == \'selected\' ? \'block\' : \'none\')')->setName($nameprefix . '[]');
$mode_value = array_shift($value);
if (count($value)) {
$element->setValue($mode_value);
}
$html .= $element->getElementHtml();
$element = new Varien_Data_Form_Element_Multiselect();
$element->setForm($form);
$element->setId('gomage-delivverydate-specdays');
$element->setClass('select');
$element->setStyle('margin-top:10px;height:160px;' . ($mode_value != 'selected' ? 'display:none;' : ''));
$element->setName($nameprefix . '[]');
$element->setValues($this->toOptionArray());
$element->setValue($value);
$html .= $element->getElementHtml();
return $html;
}
示例6: _applyTypeSpecificConfig
/**
* Apply configuration specific for different element type
*
* @param string $inputType
* @param Varien_Data_Form_Element_Abstract $element
* @param Mage_Eav_Model_Entity_Attribute $attribute
*/
protected function _applyTypeSpecificConfig($inputType, $element, Mage_Eav_Model_Entity_Attribute $attribute)
{
switch ($inputType) {
case 'select':
$element->setValues($attribute->getSource()->getAllOptions(true, true));
break;
case 'multiselect':
$element->setValues($attribute->getSource()->getAllOptions(false, true));
$element->setCanBeEmpty(true);
break;
case 'date':
$element->setImage($this->getViewFileUrl('images/grid-cal.gif'));
$element->setDateFormat(Mage::app()->getLocale()->getDateFormatWithLongYear());
break;
case 'multiline':
$element->setLineCount($attribute->getMultilineCount());
break;
default:
break;
}
}