本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::setDisabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::setDisabled方法的具体用法?PHP Varien_Data_Form_Element_Abstract::setDisabled怎么用?PHP Varien_Data_Form_Element_Abstract::setDisabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::setDisabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getElementHtml
/**
* Override method to output our custom HTML with JavaScript
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return String
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!extension_loaded('soap') || !extension_loaded('openssl')) {
$element->setDisabled('disabled')->setValue(0);
} else {
// Get Config Link
$configLink = Mage::helper('bronto_common')->getScopeUrl('/system_config/edit/section/bronto');
if (!Mage::helper('bronto_verify/apitoken')->getStatus()) {
if (trim($element->getLabel()) === 'Enable Module') {
$element->setDisabled('disabled')->setValue(0);
$link = '<a href="' . $configLink . '">Fix it Here</a>';
$element->setComment('<span style="color:red;font-weight: bold">A valid Bronto API key is required. ' . $link . '</span>');
}
} else {
if (!Mage::helper('bronto_common')->isEnabled()) {
if (trim($element->getLabel()) === 'Enable Module') {
$element->setDisabled('disabled')->setValue(0);
$link = '<a href="' . $configLink . '">Enable It Here</a>';
$element->setComment('<span style="color:red;font-weight: bold">The Bronto Extension for Magento is not enabled. ' . $link . '</span>');
}
} else {
if (!Mage::helper('bronto_common/support')->isRegistered()) {
if (trim($element->getLabel()) !== 'Enable Module' || !$element->getValue()) {
$link = '<a href="' . $configLink . '#bronto_support-head">Register Here</a>';
$element->setDisabled('disabled');
$element->setComment('<span style="color:red;font-weight:bold">Extension registration is required. ' . $link . '</span>');
}
}
}
}
}
return parent::_getElementHtml($element);
}
示例2: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$modules = Mage::getConfig()->getNode('modules')->children();
$modulesArray = (array) $modules;
$element->setDisabled(true);
if (isset($modulesArray['Amasty_Geoip'])) {
$amGeoIpModel = Mage::getModel('amgeoip/import');
$element->setDisabled(!$amGeoIpModel->isDone());
}
return parent::_getElementHtml($element);
}
示例3: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('catalog/category_flat')->isBuilt()) {
$element->setDisabled(true)->setValue(0);
}
return parent::_getElementHtml($element);
}
示例4: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$store = null;
$disabled = false;
if ($code = $this->getRequest()->getParam('store')) {
$store = Mage::getModel('core/store')->load($code);
}
if ($store instanceof Mage_Core_Model_Store) {
/* @var Nosto_Tagging_Helper_Account $accountHelper */
$accountHelper = Mage::helper('nosto_tagging/account');
/* @var NostoAccount $nostoAccount */
$nostoAccount = $accountHelper->find($store);
if ($nostoAccount instanceof NostoAccountInterface) {
foreach (NostoApiToken::getApiTokenNames() as $token) {
if (!$nostoAccount->getApiToken($token)) {
$disabled = true;
break;
}
}
}
}
if ($disabled === true) {
/** @noinspection PhpUndefinedMethodInspection */
$element->setDisabled('disabled');
$metaOauth = new Nosto_Tagging_Model_Meta_Oauth();
/** @noinspection PhpUndefinedVariableInspection */
$metaOauth->loadData($store, $nostoAccount);
$client = new NostoOAuthClient($metaOauth);
$comment = sprintf('Your Nosto account is missing required tokens' . ' for updating settings to Nosto. Please click <a href="%s">' . ' here to re-connect</a> your account.', $client->getAuthorizationUrl());
$element->setData('comment', $comment);
}
return parent::_getElementHtml($element);
}
示例5: _getElementHtml
/**
* Retrieve Element HTML
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!$this->helper('Mage_Catalog_Helper_Product_Flat')->isBuilt()) {
$element->setDisabled(true)->setValue(0);
}
return parent::_getElementHtml($element);
}
示例6: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('Mage_Catalog_Helper_Category_Flat')->isRebuilt()) {
$element->setDisabled('disabled')->setValue(0);
}
return parent::_getElementHtml($element);
}
示例7: _getElementHtml
/**
* Override for disabling support information until API token is set
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('bronto_verify/apitoken')->getStatus()) {
$element->setDisabled('disabled');
}
return parent::_getElementHtml($element);
}
示例8: 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;
}
示例9: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!file_exists(Mage::getBaseDir('media') . "/geoip/GeoLiteCity.dat")) {
$element->setDisabled(true);
if ($element->getId() == 'gomage_checkout_geoip_geoip_enabled') {
$element->setComment($this->__('To use GeoIP you need to upload GeoliteCity.dat file to folder /media/geoip. Read more in the <a target="_blank" href="%s">Installation Guide</a>', 'http://www.gomage.com/media/extensions/lightcheckout/GoMage_LightCheckout_Installation_Guide.pdf'));
}
}
return parent::_getElementHtml($element);
}
示例10: render
/**
* renderer
*
* @param Varien_Data_Form_Element_Abstract $element
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$element->setDisabled(true);
$disabled = true;
$htmlId = 'use_config_' . $element->getHtmlId();
$html = '<tr><td class="label">' . $element->getLabelHtml() . '</td><td class="value">';
$html .= '<input id="' . $htmlId . '" name="use_c[]" value="' . $element->getId() . '"' . ($disabled ? ' checked="checked"' : '');
$html .= ' onclick="toggleValueElements(this, this.parentNode);" class="checkbox" type="checkbox" />';
$html .= ' <label for="' . $htmlId . '" class="normal">' . Mage::helper('turnkeye_adminform')->__('Do not change value') . '</label>';
$html .= $element->getElementHtml();
$html .= '<script type="text/javascript">toggleValueElements($(\'' . $htmlId . '\'), $(\'' . $htmlId . '\').parentNode);</script>';
return $html . '</td><td class="scope - label"><span class="nobr"></span></td></tr>';
}
示例11: getElementHtml
/**
* Return checkbox html with hidden field for correct config values
*
* @param string $elementId
* @return string
*/
public function getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$configValue = (string) $element->getValue();
if ($configValue) {
$element->setChecked(true);
} else {
$element->setValue('1');
}
if ($element->getCanUseDefaultValue() && $element->getInherit()) {
$element->setDisabled(true);
}
$hidden = new Varien_Data_Form_Element_Hidden(array('html_id' => $element->getHtmlId() . '_value', 'name' => $element->getName(), 'value' => '0'));
$hidden->setForm($element->getForm());
return $hidden->getElementHtml() . $element->getElementHtml();
}
示例12: render
/**
* Add the 'Use Config Settings' checkbox to the input element
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$id = 'use_config_' . $element->getId();
$checkbox = new Varien_Data_Form_Element_Checkbox(array('html_id' => $id, 'name' => $id));
$checkbox->setForm($element->getForm());
$checkbox->setAfterElementHtml(' <label for="' . $id . '">' . $this->helper('adminhtml')->__('Use Config Settings') . '</label>' . $this->getElementJs());
$checkbox->setOnclick(sprintf("if(this.checked){\$('%s').disabled=true;}else{\$('%s').disabled=false;}", $element->getForm()->getHtmlIdPrefix() . $element->getId(), $element->getForm()->getHtmlIdPrefix() . $element->getId()));
if (!$element->getValue()) {
$checkbox->setChecked(true);
$element->setDisabled(true);
if (preg_match("/^carousel_([a-z_]{1,})\$/", $element->getId(), $result)) {
$element->setValue(Mage::getStoreConfig('ibanners/carousel/' . $result[1]));
}
}
$element->setNote($checkbox->getElementHtml());
return parent::render($element);
}
示例13: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setDisabled('disabled');
return parent::_getElementHtml($element);
}
示例14: 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);
}
示例15: 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" >';
//.........这里部分代码省略.........