当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue方法代码示例

本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue方法的具体用法?PHP Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue怎么用?PHP Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Data_Form_Element_Abstract的用法示例。


在下文中一共展示了Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Enter description here...
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '<tr><td class="label">' . $element->getLabel() . '</td>';
     $id = $element->getHtmlId();
     //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
     $isMultiple = $element->getExtType() === 'multiple';
     // replace [value] with [inherit]
     $namePrefix = preg_replace('#\\[value\\](\\[\\])?$#', '', $element->getName());
     $options = $element->getValues();
     $addInheritCheckbox = false;
     if ($element->getCanUseWebsiteValue()) {
         $addInheritCheckbox = true;
         $checkboxLabel = Mage::helper('adminhtml')->__('Use website');
     } elseif ($element->getCanUseDefaultValue()) {
         $addInheritCheckbox = true;
         $checkboxLabel = Mage::helper('adminhtml')->__('Use default');
     }
     if ($addInheritCheckbox) {
         $inherit = $element->getInherit() == 1 ? 'checked' : '';
         if ($inherit) {
             $element->setDisabled(true);
         }
     }
     $html .= '<td class="value">';
     $html .= $this->_getElementHtml($element);
     if ($element->getComment()) {
         $html .= '<div><small>' . $element->getComment() . '</small></div>';
     }
     $html .= '</td>';
     if ($addInheritCheckbox) {
         $defText = $element->getDefaultValue();
         if ($options) {
             $defTextArr = array();
             foreach ($options as $k => $v) {
                 if ($isMultiple) {
                     if (is_array($v['value']) && in_array($k, $v['value'])) {
                         $defTextArr[] = $v['label'];
                     }
                 } elseif ($v['value'] == $defText) {
                     $defTextArr[] = $v['label'];
                     break;
                 }
             }
             $defText = join(', ', $defTextArr);
         }
         // default value
         $html .= '<td class="default">';
         //$html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" '.$inherit.' onclick="$(\''.$id.'\').disabled = this.checked">';
         $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))"/>';
         $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
         $html .= '<input type="hidden" name="' . $namePrefix . '[default_value]" value="' . htmlspecialchars($element->getDefaultValue()) . '">';
         $html .= '<input type="hidden" name="' . $namePrefix . '[old_value]" value="' . htmlspecialchars($element->getOldValue()) . '">';
         $html .= '</td>';
     }
     $html .= '</tr>';
     return $html;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:63,代码来源:Field.php

示例2: render

    public function render(Varien_Data_Form_Element_Abstract $element)
    {
        $elementId = $element->getHtmlId();
        $optionShoppingCartId = str_replace('/', '_', Mage_Persistent_Helper_Data::XML_PATH_PERSIST_SHOPPING_CART);
        $optionEnabled = str_replace('/', '_', Mage_Persistent_Helper_Data::XML_PATH_ENABLED);
        $addInheritCheckbox = false;
        if ($element->getCanUseWebsiteValue()) {
            $addInheritCheckbox = true;
        } elseif ($element->getCanUseDefaultValue()) {
            $addInheritCheckbox = true;
        }
        $html = '<script type="text/javascript">
            PersistentCustomerSegmentation = Class.create();
            PersistentCustomerSegmentation.prototype = {
                initialize : function () {
                    this._element = $("' . $elementId . '");
                    var funcTrackOnChangeShoppingCart = this.trackOnChangeShoppingCart.bind(this);
                    document.observe("dom:loaded", funcTrackOnChangeShoppingCart);
                    $("' . $optionShoppingCartId . '").observe("change", funcTrackOnChangeShoppingCart);
                    $("' . $optionEnabled . '").observe("change", function() {
                        setTimeout(funcTrackOnChangeShoppingCart, 1);
                    });' . ($addInheritCheckbox ? '$("' . $elementId . '_inherit").observe("change", funcTrackOnChangeShoppingCart);' : '') . '},

                disable: function() {
                    this._element.disabled = true;
                    this._element.value = 1;
                },

                enable: function() {
                    this._element.disabled = false;
                },

                trackOnChangeShoppingCart: function() {
                    if ($("' . $optionEnabled . '").value == 1 && $("' . $optionShoppingCartId . '").value == 1 ) {
                         this.disable();
                    } else {
                        ' . ($addInheritCheckbox ? 'if ($("' . $elementId . '_inherit").checked) {
                            this.disable();
                        } else {
                            this.enable();
                        }' : 'this.enable();') . '

                    }
                }
            };
        var persistentCustomerSegmentation = new PersistentCustomerSegmentation();
        </script>';
        return parent::render($element) . $html;
    }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:49,代码来源:Customer.php

示例3: render

 /**
  * Overloaded for forwards compatibility for Magento 1.6.
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $id = $element->getHtmlId();
     $html = '<td class="label"><label for="' . $id . '">' . $element->getLabel() . '</label></td>';
     //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
     $isMultiple = $element->getExtType() === 'multiple';
     // replace [value] with [inherit]
     $namePrefix = preg_replace('#\\[value\\](\\[\\])?$#', '', $element->getName());
     $options = $element->getValues();
     $addInheritCheckbox = false;
     if ($element->getCanUseWebsiteValue()) {
         $addInheritCheckbox = true;
         $checkboxLabel = $this->__('Use Website');
     } elseif ($element->getCanUseDefaultValue()) {
         $addInheritCheckbox = true;
         $checkboxLabel = $this->__('Use Default');
     }
     if ($addInheritCheckbox) {
         $inherit = $element->getInherit() == 1 ? 'checked="checked"' : '';
         if ($inherit) {
             $element->setDisabled(true);
         }
     }
     if ($element->getTooltip()) {
         $html .= '<td class="value with-tooltip">';
         $html .= $this->_getElementHtml($element);
         $html .= '<div class="field-tooltip"><div>' . $element->getTooltip() . '</div></div>';
     } else {
         $html .= '<td class="value">';
         $html .= $this->_getElementHtml($element);
     }
     if ($element->getComment()) {
         $html .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
     }
     $html .= '</td>';
     if ($addInheritCheckbox) {
         $defText = $element->getDefaultValue();
         if ($options) {
             $defTextArr = array();
             foreach ($options as $k => $v) {
                 if ($isMultiple) {
                     if (is_array($v['value']) && in_array($k, $v['value'])) {
                         $defTextArr[] = $v['label'];
                     }
                 } elseif (isset($v['value'])) {
                     if ($v['value'] == $defText) {
                         $defTextArr[] = $v['label'];
                         break;
                     }
                 } elseif (!is_array($v)) {
                     if ($k == $defText) {
                         $defTextArr[] = $v;
                         break;
                     }
                 }
             }
             $defText = join(', ', $defTextArr);
         }
         // default value
         $html .= '<td class="use-default">';
         $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
         $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
         $html .= '</td>';
     }
     $html .= '<td class="scope-label">';
     if ($element->getScope()) {
         $html .= $element->getScopeLabel();
     }
     $html .= '</td>';
     $html .= '<td class="">';
     if ($element->getHint()) {
         $html .= '<div class="hint" >';
         $html .= '<div style="display: none;">' . $element->getHint() . '</div>';
         $html .= '</div>';
     }
     $html .= '</td>';
     return $this->_decorateRowHtml($element, $html);
 }
开发者ID:myparcelnl,项目名称:magento1,代码行数:84,代码来源:Hidden.php

示例4: render

 /**
  * Enter description here...
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     if (version_compare(Mage::getVersion(), '1.7.0.1', '<')) {
         if (Mage::app()->getRequest()->getParam('section') == "klevu_search") {
             $id = $element->getHtmlId();
             $features = Mage::helper('klevu_search/config')->getFeaturesUpdate($element->getHtmlId());
             if (!empty($features)) {
                 $style = 'class="klevu-disabled"';
                 $upgrade_text = '';
                 if (!empty($features['upgrade_message']) || !empty($features['upgrade_label'])) {
                     $upgrade_text .= "<div class='klevu-upgrade-block'>";
                     if (!empty($features['upgrade_message'])) {
                         $upgrade_text .= $features['upgrade_message'];
                     }
                     if (!empty($features['upgrade_label'])) {
                         $upgrade_text .= "<br/><button type='button' onClick=upgradeLink('" . $features["upgrade_url"] . "')>" . $features['upgrade_label'] . "</button>";
                     }
                     $upgrade_text .= "</div>";
                 }
             } else {
                 $style = '';
                 $upgrade_text = '';
             }
             $useContainerId = $element->getData('use_container_id');
             $html = '<tr id="row_' . $id . '">' . '<td class="label"><label for="' . $id . '" ' . $style . '>' . $element->getLabel() . '</label>' . $upgrade_text . '</td>';
             // $isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store');
             $isMultiple = $element->getExtType() === 'multiple';
             // replace [value] with [inherit]
             $namePrefix = preg_replace('#\\[value\\](\\[\\])?$#', '', $element->getName());
             $options = $element->getValues();
             $addInheritCheckbox = false;
             if ($element->getCanUseWebsiteValue()) {
                 $addInheritCheckbox = true;
                 $checkboxLabel = Mage::helper('adminhtml')->__('Use Website');
             } elseif ($element->getCanUseDefaultValue()) {
                 $addInheritCheckbox = true;
                 $checkboxLabel = Mage::helper('adminhtml')->__('Use Default');
             }
             if ($addInheritCheckbox) {
                 $inherit = $element->getInherit() == 1 ? 'checked="checked"' : '';
                 if ($inherit) {
                     $element->setDisabled(true);
                 }
             }
             // Code added by klevu
             if (!empty($features)) {
                 $element->setDisabled(true);
                 $element->setValue(0);
             }
             $html .= '<td class="value">';
             $html .= $this->_getElementHtml($element);
             if ($element->getComment()) {
                 $html .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
             }
             $html .= '</td>';
             if ($addInheritCheckbox) {
                 $defText = $element->getDefaultValue();
                 if ($options) {
                     $defTextArr = array();
                     foreach ($options as $k => $v) {
                         if ($isMultiple) {
                             if (is_array($v['value']) && in_array($k, $v['value'])) {
                                 $defTextArr[] = $v['label'];
                             }
                         } elseif ($v['value'] == $defText) {
                             $defTextArr[] = $v['label'];
                             break;
                         }
                     }
                     $defText = join(', ', $defTextArr);
                 }
                 // code added by klevu
                 if (!empty($features)) {
                 } else {
                     // default value
                     $html .= '<td class="use-default">';
                     // $html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" '.$inherit.' onclick="$(\''.$id.'\').disabled = this.checked">';
                     $html .= '<input id="' . $id . '_inherit" name="' . $namePrefix . '[inherit]" type="checkbox" value="1" class="checkbox config-inherit" ' . $inherit . ' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> ';
                     $html .= '<label for="' . $id . '_inherit" class="inherit" title="' . htmlspecialchars($defText) . '">' . $checkboxLabel . '</label>';
                     $html .= '</td>';
                 }
             }
             $html .= '<td class="scope-label">';
             if ($element->getScope()) {
                 $html .= $element->getScopeLabel();
             }
             $html .= '</td>';
             // code added by klevu
             if (!empty($features)) {
                 $element->setDisabled(true);
             }
             $html .= '<td class="">';
             if ($element->getHint()) {
                 $html .= '<div class="hint" >';
//.........这里部分代码省略.........
开发者ID:klevu,项目名称:klevu-smart-search-M1,代码行数:101,代码来源:Field.php

示例5: _getInheritCheckboxLabel

 /**
  * Retrieve label for the inheritance checkbox
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 protected function _getInheritCheckboxLabel(Varien_Data_Form_Element_Abstract $element)
 {
     $checkboxLabel = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Use Default');
     if ($element->getCanUseWebsiteValue()) {
         $checkboxLabel = Mage::helper('Mage_Adminhtml_Helper_Data')->__('Use Website');
     }
     return $checkboxLabel;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:14,代码来源:Field.php


注:本文中的Varien_Data_Form_Element_Abstract::getCanUseWebsiteValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。