本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::setComment方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::setComment方法的具体用法?PHP Varien_Data_Form_Element_Abstract::setComment怎么用?PHP Varien_Data_Form_Element_Abstract::setComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::setComment方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
// Only do validation if module is installed and active
if ($this->helper('bronto_common')->isModuleInstalled('Bronto_Verify')) {
$_html = array();
// Create form object to grab scope details
$form = new Mage_Adminhtml_Block_System_Config_Form();
$scope = $form->getScope();
$scopeId = $form->getScopeId();
$element->setData('onchange', "validateToken(this.form, this);");
$element->setData('after_element_html', "\n <span id=\"loadingMask\" style=\"display: none; width: 100px;\">\n <span class=\"loader\" id=\"loading-mask-loader\" style=\"background: url(" . $this->getSkinUrl('bronto/images/ajax-loader-tr.gif') . ") no-repeat 0 50%; background-size: 20px; padding:3px 0 3px 25px;\">" . $this->__(' Verifying...') . "</span>\n <span id=\"loading-mask\"></span>\n </span>\n <script>\n /**\n * Function to Toggle Form Elements Disabled Status Based On Token Status\n */\n function toggleDisabled(form, element) {\n // Get Status Text Element\n var statusText = \$('bronto-validation-status-text');\n // If Status Text Element has Class of 'invalid' or empty, set boolean disabled value\n var disabled = (statusText.className == 'invalid' || statusText.className == '');\n\n // Cycle through form elements and disable/enable elements\n for (i = 0; i < form.length; i++) {\n if (form.elements[i].id != '{$element->getId()}' &&\n form.elements[i].id != 'bronto_settings_enabled' &&\n form.elements[i].id != 'verify-button' &&\n form.elements[i].type != 'hidden' &&\n form.elements[i].name.indexOf('groups') == 0) {\n form.elements[i].disabled = disabled;\n }\n }\n\n // Get Last Element of Form, and if the class name is 'note', empty the html value\n var last = element.parentNode.lastChild;\n if (last.className == 'note') {\n last.innerHTML = '';\n }\n }\n\n function trim1 (str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*\$/, '');\n }\n\n function validateToken(form, element) {\n var token = trim1(\$('{$element->getId()}').value);\n var statusText = \$('bronto-validation-status');\n var reloadUrl = '{$this->getUrl('*/apitoken/ajaxvalidation')}';\n\n statusText.innerHTML = \$('loadingMask').innerHTML;\n statusText.removeClassName('valid').removeClassName('invalid');\n\n new Ajax.Request(reloadUrl, {\n method: 'post',\n parameters: {token: token, scope: '{$scope}', scopeid: '{$scopeId}'},\n onComplete: function(transport) {\n Element.hide('loadingMask');\n statusText.innerHTML = transport.responseText;\n\n toggleDisabled(form, element);\n }\n });\n\n return false;\n }\n </script>\n ");
if (!$this->helper('bronto_common')->getApiToken()) {
$element->setComment('<span style="color:red;font-weight:bold">Please enter your Bronto API key here.</span>');
$buttonHtml = "";
} else {
$button = $this->getLayout()->createBlock('bronto_verify/adminhtml_widget_button_runtoken')->toHtml();
$buttonHtml = "<p class=\"form-buttons\" id=\"verify-button\">{$button}</p>";
}
// Show Roundtrip Install Verification Status
$_html[] = $buttonHtml . '<style>' . ' #bronto-validation-status { color:grey; font-weight:bold; }' . ' #bronto-validation-status .valid { color: green; }' . ' #bronto-validation-status .invalid { color: red; }' . '</style>' . '<strong style="float: left; width: 80px">Last Status:</strong> ' . '<span id="bronto-validation-status">' . $this->helper('bronto_verify/apitoken')->getAdminScopedApitokenStatusText() . '</span>';
// Show everything Else
if (!empty($_html)) {
$elementHtml = $element->getElementHtml();
if ($element->getComment()) {
$elementHtml .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
$element->setComment(null);
}
$elementHtml .= '<div style="margin-top:10px">';
$elementHtml .= implode('<br />', $_html);
$elementHtml .= '</div>';
return $elementHtml;
}
}
return parent::_getElementHtml($element);
}
示例2: _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);
}
示例3: _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)
{
$brontoLink = '<a href="http://app.bronto.com" target="_blank"' . 'title="Home Dashboard | Bronto Marketing Platform">Bronto</a>';
$helpIcon = $this->getSkinUrl('bronto/images/site_name.png');
$comment = 'Found within ' . $brontoLink . ', located at:' . '<div class="bronto-with-help">' . '<strong>Home » Settings » General Settings</strong>' . '<div class="bronto-help bronto-vertical-align">' . '<div class="bronto-help-window bronto-large-image">' . '<img src="' . $helpIcon . '" width="640px"/></div></div></div>';
$element->setComment($comment);
return parent::_getElementHtml($element);
}
示例4: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$helper = Mage::helper('netzarbeiter_groupscatalog2');
if (!$helper->getConfig('show_multiselect_field')) {
$element->setComment($this->__('This field is read-only.<br/>(change the "Show multiselect customer group fields" option further down to enable this field)'));
}
return parent::render($element);
}
示例5: _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);
}
示例6: render
/**
* @see parent
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$exampleCode = 'ABC123';
$store = Mage::app()->getStore();
$helper = Mage::helper('bronto_common/coupon');
$comment = $element->getComment();
$comment = str_replace('{baseUrl}', $store->getUrl('/'), $comment);
$comment = str_replace('{code}', $helper->getCouponParam(), $comment);
$comment = str_replace('{example}', $exampleCode, $comment);
$comment = str_replace('{error}', $helper->getErrorCodeParam(), $comment);
$element->setComment($comment);
return parent::render($element);
}
示例7: render
/**
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$helper = $this->_getHelper();
if (!$helper->validApiToken()) {
// Route to API token
$url = $helper->getScopeUrl('*/system_config/edit', array('section' => 'bronto'));
$element->setComment("In order to receive <strong>{$element->getLegend()}</strong>, you must enter a valid <a href=\"{$url}\">API Token</a>.");
} else {
foreach ($this->_pullRssItems() as $rssItem) {
$this->addItemToFieldset($element, $rssItem)->setRenderer($this->_getRenderer());
}
}
return parent::render($element);
}
示例8: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$element->setComment("<strong>This form is provided as a centralized location for assigning all Magento email templates.<br />Each section contains a link to where this action would normally be performed.</strong><br /><br />");
// Only show template mapping if module is enabled
if (!$this->helper('bronto_email')->isEnabled()) {
return '';
}
$html = $this->_getHeaderHtml($element);
$html .= $this->_getScopeToggleHtml($element);
$fields = $this->_getSystemConfigPathsParts();
$order = 0;
foreach ($fields as $section => $groups) {
$html .= $this->_getSubsetHtml($element, $section, $groups, $order);
$order = $order + 5;
}
$html .= $this->_getFooterHtml($element);
return $html;
}
示例9: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$m = false;
if (Mage::helper('mstcore')->isModuleInstalled('GoMage_Navigation')) {
$m = 'GoMage Advanced Navigation';
} elseif (Mage::helper('mstcore')->isModuleInstalled('Amasty_Shopby')) {
$m = 'Amasty Shopby';
} elseif (Mage::helper('mstcore')->isModuleInstalled('Mana_Filters')) {
$m = 'Mana Filters';
} elseif (Mage::helper('mstcore')->isModuleInstalled('MGS_Filterslayer')) {
$m = 'MGS Filterslayer';
} elseif (Mage::helper('mstcore')->isModuleInstalled('EM_LayeredNavigation')) {
$m = 'EM LayeredNavigation';
}
if ($m) {
$element->setComment("We recommend to disable this option to avoid possible conflicts, because extension '{$m}' is installed");
}
return parent::_getElementHtml($element);
$element->setValue(Mage::app()->loadCache('admin_notifications_lastcheck'));
$format = Mage::app()->getLocale()->getDateTimeFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM);
return Mage::app()->getLocale()->date(intval($element->getValue()))->toString($format);
}
示例10: render
/**
* Return header comment part of html for fieldset
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$url = Mage::helper('adminhtml')->getUrl('*/system_email_template');
$element->setComment("Additional configuration located at: <strong>System › <a href=\"{$url}\">Transactional Emails</a></strong><br/><br/>");
return parent::render($element);
}
示例11: render
/**
* Returns the description for the module in a read-only html block
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$url = Mage::helper('adminhtml')->getUrl('*/recommendations');
$element->setComment(str_replace('{url}', $url, $element->getComment()));
return parent::render($element);
}