本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::getValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::getValue方法的具体用法?PHP Varien_Data_Form_Element_Abstract::getValue怎么用?PHP Varien_Data_Form_Element_Abstract::getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::getValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
$_years = array(null => "Year");
for ($i = 0, $y = (int) date("Y"); $i < 5; $i++, $y++) {
$_years[$y] = $y;
}
$_months = array(null => "Month");
for ($i = 1; $i <= 12; $i++) {
$_months[$i] = Mage::app()->getLocale()->date(mktime(null, null, null, $i))->get(Zend_date::MONTH_NAME);
}
$_days = array(null => "Day");
for ($i = 1; $i <= 31; $i++) {
$_days[$i] = $i < 10 ? '0' . $i : $i;
}
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$element->setName($element->getName() . '[]');
$_yearsHtml = $element->setStyle('width:75px;')->setValues($_years)->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$_monthsHtml = $element->setStyle('width:100px;')->setValues($_months)->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
$_daysHtml = $element->setStyle('width:50px;')->setValues($_days)->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
return sprintf('%s %s %s', $_yearsHtml, $_monthsHtml, $_daysHtml);
}
示例3: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$extra = '';
if ($element->getValue()) {
$extra = '<img style="max-height:100px;" src="' . $element->getValue() . '" /><br />';
}
return $extra . parent::_getElementHtml($element);
}
示例4: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setStyle('width:80px;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$value = $element->getValue();
} else {
$value = 0;
}
$from = $element->setValue(isset($value) ? $value : null)->getElementHtml();
return $from . ' ' . Mage::helper('adminhtml')->__('X pt');
}
示例5: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setStyle('width:70px;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$from = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$to = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
return Mage::helper('adminhtml')->__('from') . ' ' . $from . ' ' . Mage::helper('adminhtml')->__('to') . ' ' . $to;
}
示例6: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setStyle('width:70px;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$width = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$height = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
return Mage::helper('sales')->__('Width') . ' ' . $width . ' ' . Mage::helper('sales')->__('Height') . ' ' . $height;
}
示例7: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setStyle('height:6em;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$value = $element->getValue();
} else {
$value = '';
}
$from = $element->setValue(isset($value) ? $value : null)->getElementHtml();
return $from;
//.' '.Mage::helper('adminhtml')->__('items');
}
示例8: render
/**
* Render Media Chooser HTML (buttons and image preview) and set it after the form element HTML
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return Varien_Data_Form_Element_Abstract
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
if (Mage::getSingleton('admin/session')->isAllowed('cms/media_gallery')) {
$layout = Mage::app()->getLayout();
$id = $element->getHtmlId();
if ($url = $element->getValue()) {
$linkStyle = "display:inline;";
if (!preg_match("/^http\\:\\/\\/|https\\:\\/\\//", $url)) {
$url = Mage::getBaseUrl('media') . $url;
}
} else {
$linkStyle = "display:none;";
$url = "#";
}
$imagePreview = '<a id="' . $id . '_link" href="' . $url . '" style="text-decoration: none; ' . $linkStyle . '"' . ' onclick="imagePreview(\'' . $id . '_image\'); return false;">' . ' <img src="' . $url . '" id="' . $id . '_image" title="' . $element->getValue() . '"' . ' alt="' . $element->getValue() . '" height="30" class="small-image-preview v-middle"/>' . ' </a>';
$selectButtonId = 'add-image-' . mt_rand();
$chooserUrl = Mage::getUrl('adminhtml/cms_wysiwyg_images_chooser/index', array('target_element_id' => $id));
$label = $element->getValue() ? $this->__('Change Image') : $this->__('Select Image');
// Select/Change Image Button
$chooseButton = $layout->createBlock('adminhtml/widget_button')->setType('button')->setClass('add-image')->setId($selectButtonId)->setLabel($label)->setOnclick('MediabrowserUtility.openDialog(\'' . $chooserUrl . '\')')->setDisabled($element->getReadonly())->setStyle('display:inline;margin-top:7px');
// Remove Image Button
$onclickJs = '
document.getElementById(\'' . $id . '\').value=\'\';
if(document.getElementById(\'' . $id . '_image\')){
document.getElementById(\'' . $id . '_image\').parentNode.style.display = \'none\';
}
document.getElementById(\'' . $selectButtonId . '\').innerHTML=\'<span><span><span>' . addslashes($this->__('Select Image')) . '</span></span></span>\';
';
$removeButton = $layout->createBlock('adminhtml/widget_button')->setType('button')->setClass('delete')->setLabel($this->__('Remove Image'))->setOnclick($onclickJs)->setDisabled($element->getReadonly())->setStyle('margin-top:7px');
$wrapperStart = '<div id="buttons_' . $id . '" class="buttons-set" style=" width: 325px;">';
$wrapperEnd = '</div>';
$wrapperEnd .= '
<script type="text/javascript">
//<![CDATA[
varienGlobalEvents.clearEventHandlers(\'mediachooserChange' . $id . '\');
varienGlobalEvents.attachEventHandler(\'mediachooserChange' . $id . '\', function(url){
document.getElementById(\'' . $id . '_image\').src = \'' . Mage::getBaseUrl('media') . '\' + url;
document.getElementById(\'' . $id . '_image\').title = url;
document.getElementById(\'' . $id . '_image\').alt = url;
document.getElementById(\'' . $id . '_link\').href = \'' . Mage::getBaseUrl('media') . '\' + url;
document.getElementById(\'' . $id . '_link\').style.display = \'inline\';
document.getElementById(\'' . $selectButtonId . '\').innerHTML=\'<span><span><span>' . addslashes($this->__('Change Image')) . '</span></span></span>\';
});
//]]>
</script>
';
// Add our custom HTML after the form element
$element->setAfterElementHtml($wrapperStart . $imagePreview . $chooseButton->toHtml() . $removeButton->toHtml() . $wrapperEnd);
}
return $element;
}
示例9: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setStyle('width:40px;')->setName($element->getName() . '[]');
if ($element->getValue()) {
$values = explode(',', $element->getValue());
} else {
$values = array();
}
$top = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
$right = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
$bottom = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
$left = $element->setValue(isset($values[3]) ? $values[3] : null)->getElementHtml();
return $top . ' ' . Mage::helper('adminhtml')->__('Top, pt') . ' ' . $right . ' ' . Mage::helper('adminhtml')->__('Right, pt') . '<br />' . $bottom . ' ' . Mage::helper('adminhtml')->__('Bottom, pt') . ' ' . $left . ' ' . Mage::helper('adminhtml')->__('Left, pt');
}
示例10: _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);
}
示例11: _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);
}
示例12: prepareElementHtml
public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$config = $this->getConfig();
$chooseButton = $this->getLayout()->createBlock('adminhtml/widget_button')->setType('button')->setClass('scalable btn-chooser')->setLabel($config['button']['open'])->setOnclick('MediabrowserUtility.openDialog(\'' . $this->getUrl('*/cms_wysiwyg_images/index', array('target_element_id' => $element->getName())) . '\')')->setDisabled($element->getReadonly());
$text = new Varien_Data_Form_Element_Text();
$text->setForm($element->getForm())->setId($element->getName())->setName($element->getName())->setClass('widget-option input-text');
if ($element->getRequired()) {
$text->addClass('required-entry');
}
if ($element->getValue()) {
$text->setValue($element->getValue());
}
$element->setData('after_element_html', $text->getElementHtml() . $chooseButton->toHtml());
return $element;
}
示例13: _getElementHtml
/**
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->addClass('select');
$hours = 0;
$minutes = 0;
if ($value = $element->getValue()) {
$values = explode(',', $value);
if (is_array($values) && count($values) == 2) {
$hours = $values[0];
$minutes = $values[1];
}
}
$optionTemplate = '<option value="%s" %s>%s</option>';
$html = sprintf('<input type="hidden" id="%s" />', $element->getHtmlId());
$html .= sprintf('<select name="%s" %s style="width:60px">', $element->getName(), $element->serialize($element->getHtmlAttributes()));
for ($i = 0; $i < 24; $i++) {
$hour = str_pad($i, 2, '0', STR_PAD_LEFT);
$html .= sprintf($optionTemplate, $hour, (int) $hours === $i ? 'selected="selected"' : '', $hour);
}
$html .= '</select> : ';
$html .= sprintf('<select name="%s" %s style="width:60px">', $element->getName(), $element->serialize($element->getHtmlAttributes()));
for ($i = 0; $i < 60; $i++) {
$minute = str_pad($i, 2, '0', STR_PAD_LEFT);
$html .= sprintf($optionTemplate, $minute, (int) $minutes === $i ? 'selected="selected"' : '', $minute);
}
$html .= '</select>';
$html .= $element->getAfterElementHtml();
return $html;
}
示例14: _getElementHtml
/**
* Enter description here...
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$partsId = explode("_", $element->getId());
$method_code = $partsId[1] . "_" . $partsId[2];
$rule = Mage::getModel('hipay/rule');
$rule->setMethodCode($method_code);
if ($element->getValue()) {
$rule->load($element->getValue());
}
if ($rule->getConfigPath() == "") {
$rule->setConfigPath($element->getId());
}
$element->setRule($rule);
$this->setElement($element);
return $this->_toHtml();
}
示例15: getCurrencyTableHtml
/**
* Inform the user there version will not work
* @return string
*/
private function getCurrencyTableHtml(Varien_Data_Form_Element_Abstract $element)
{
// Store ID = scope ID
$storeId = Mage::getSingleton('adminhtml/config_data')->getScopeId();
// Retrieve the currencies
$currencies = Mage::app()->getStore($storeId)->getAvailableCurrencyCodes();
// Retrieve the values
$values = $element->getValue();
// Build our response
$response = '<input type="hidden" id="payment_gene_braintree_multi_currency_mapping" />
<table width="100%" cellspacing="6" cellpadding="4">
<tr>
<th width="35%">' . $this->__('Currency Code') . '</th>
<th width="65%">' . $this->__('Merchant Account ID') . '</th>
</tr>';
// Loop through each currency and add a value
foreach ($currencies as $currency) {
$response .= '<tr>
<td> ' . $currency . '</td>
<td><input class="input-text" type="text" name=" ' . $element->getName() . '[' . $currency . ']" style="width: 100%;" value="' . (isset($values->{$currency}) ? $values->{$currency} : '') . '" /></td>
</tr>';
}
$response .= '</table>';
return $response;
}