本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::getId方法的具体用法?PHP Varien_Data_Form_Element_Abstract::getId怎么用?PHP Varien_Data_Form_Element_Abstract::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _toHtml
protected function _toHtml()
{
$elementId = $this->_element->getId();
$html = <<<HTML
<span id="slider-library-help"></span>
<script>
\t\tEvent.observe(\$("{$elementId}"),'change', function(){
\t\t\tvar library = this.value;
\t\t\tvar help = 'http://sorgalla.com/jcarousel/ (requires jQuery)';
\t\t\tswitch(library){
\t\t\t\tcase 'jcarousel':
\t\t\t\t\thelp = 'http://sorgalla.com/jcarousel/ (requires jQuery)';
\t\t\t\t\tbreak;
\t\t\t\tcase 'jcarousel_lite':
\t\t\t\t\thelp = 'http://www.gmarwaha.com/jquery/jcarousellite/ (requires jQuery)';
\t\t\t\t\tbreak;
\t\t\t\tcase 'tiny_carousel':
\t\t\t\t\thelp = 'http://baijs.com/tinycarousel/ (requires jQuery)';
\t\t\t\t\tbreak;
\t\t\t\tcase 'carousel':
\t\t\t\t\thelp = 'http://getbootstrap.com/javascript/#carousel/ (requires Bootstrap)';
\t\t\t\t\tbreak;
\t\t\t\tcase 'prototype_carousel':
\t\t\t\t\thelp = 'http://dev.victorstanciu.ro/prototype/carousel/ (requires scriptaculous, is included automatically)';
\t\t\t\t\tbreak;
\t\t\t}
\t\t\t\$('slider-library-help').innerHTML = help;
\t\t})
</script>
HTML;
return $html;
}
示例2: _getElementHtml
/**
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$javaScript = "\n <script type=\"text/javascript\">\n Event.observe('{$element->getId()}', 'change', function(){\n split_payment=\$('{$element->getId()}').value;\n \$('{$this->_getSplitPaymentElementId($element)}').disabled = (!split_payment || split_payment!=1);\n });\n </script>";
$element->setData('after_element_html', $javaScript . $element->getAfterElementHtml());
$this->toggleDisabled($element);
return parent::_getElementHtml($element);
}
示例3: _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);
}
示例4: _getAdditionalElementHtml
/**
* Custom additional elemnt html
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getAdditionalElementHtml($element)
{
// Add name attribute to checkboxes that correspond to multiselect elements
$nameAttributeHtml = $element->getExtType() === 'multiple' ? 'name="' . $element->getId() . '_checkbox"' : '';
return '<span class="attribute-change-checkbox"><input type="checkbox" id="' . $element->getId() . '-checkbox" ' . $nameAttributeHtml . ' onclick="toogleFieldEditMode(this, \'' . $element->getId() . '\')" /><label for="' . $element->getId() . '-checkbox">' . Mage::helper('catalog')->__('Change') . '</label></span>
<script type="text/javascript">initDisableFields(\'' . $element->getId() . '\')</script>';
}
示例5: _getCollapseState
/**
* Return collapse state
*
* @param Varien_Data_Form_Element_Abstract $element
* @return bool
*/
protected function _getCollapseState($element)
{
$extra = Mage::getSingleton('admin/session')->getUser()->getExtra();
if (isset($extra['configState'][$element->getId()])) {
return $extra['configState'][$element->getId()];
}
return true;
}
示例6: switch
function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element_id = str_replace('payment_payfort_', '', $element->getId());
switch ($element_id) {
case 'more_info':
return '<a href="http://www.payfort.com/contact-us/" target="_blank">Contact Us</a>';
break;
// case 'how_to_test':
// return '<a href="https://secure.payfort.com/Ncol/PayFort_Testacc_EN.pdf?CSRFSP=%2fncol%2ftest%2fbackoffice%2fsupportgetdownloaddocument.asp&CSRFKEY=83E267BD93379EC7A63B9D5BDBE67B83E81240E9&CSRFTS=20130906221442&branding=PAYFORT" target="_blank">How to create a test account</a>';
// break;
// case 'how_to_test':
// return '<a href="https://secure.payfort.com/Ncol/PayFort_Testacc_EN.pdf?CSRFSP=%2fncol%2ftest%2fbackoffice%2fsupportgetdownloaddocument.asp&CSRFKEY=83E267BD93379EC7A63B9D5BDBE67B83E81240E9&CSRFTS=20130906221442&branding=PAYFORT" target="_blank">How to create a test account</a>';
// break;
case 'feedback_urls':
return '
Accepturl: http://[example.com]/[store lanuage code]/payfort/payment/response?response_type=accept <br />
Declineurl: http://[example.com]/[store lanuage code]/payfort/payment/response?response_type=decline <br />
Exceptionurl: http://[example.com]/[store lanuage code]/payfort/payment/response?response_type=exception <br />
Cancelurl: http://[example.com]/[store lanuage code]/payfort/payment/response?response_type=cancel <br />
';
break;
}
}
示例7: prepareElementHtml
/**
* Prepare chooser element HTML
*
* @param Varien_Data_Form_Element_Abstract $element Form Element
* @return Varien_Data_Form_Element_Abstract
*/
public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$uniqId = Mage::helper('core')->uniqHash($element->getId());
$sourceUrl = $this->getUrl('adminhtml/rapidcampaign_chooser/chooser', array('uniq_id' => $uniqId));
$chooser = $this->getLayout()->createBlock('widget/adminhtml_widget_chooser')->setElement($element)->setTranslationHelper($this->getTranslationHelper())->setConfig($this->getConfig())->setFieldsetId($this->getFieldsetId())->setSourceUrl($sourceUrl)->setUniqId($uniqId);
$errorMessage = '';
/** @var RapidCampaign_Promotions_Model_Storage $promotionsStorage */
$promotionsStorage = Mage::getModel('rapidcampaign_promotions/storage');
try {
$promotionModel = $promotionsStorage->getPromotionsModel();
} catch (Exception $e) {
$errorMessage = $this->__($e->getMessage());
$promotionModel = $promotionsStorage->getCachedPromotionsModel();
}
if ($element->getValue()) {
$promotion = $promotionModel->load($element->getValue());
if ($promotion->getId()) {
$chooser->setLabel($promotion->getName());
}
}
$chooserHtml = $chooser->toHtml();
if ($errorMessage) {
// Wrap error message
$chooserHtml .= '<div class="validation-advice">' . $errorMessage . '</div>';
}
$element->setData('after_element_html', $chooserHtml);
return $element;
}
示例8: addElement
/**
* Add form element
*
* @param Varien_Data_Form_Element_Abstract $element
* @return Varien_Data_Form
*/
public function addElement(Varien_Data_Form_Element_Abstract $element, $after = false)
{
$this->checkElementId($element->getId());
parent::addElement($element, $after);
$this->addElementToCollection($element);
return $this;
}
示例9: _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();
}
示例10: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$html = '';
$data = Mage::getStoreConfig('auspost/activation/data');
$ele_value = explode(',', str_replace($data, '', Mage::helper('core')->decrypt($element->getValue())));
$ele_name = $element->getName();
$ele_id = $element->getId();
$element->setName($ele_name . '[]');
$data_info = Mage::helper('auspost')->getDataInfo();
if (isset($data_info['dom']) && intval($data_info['c']) > 0 && intval($data_info['suc']) == 1) {
foreach (Mage::app()->getWebsites() as $website) {
$url = $website->getConfig('web/unsecure/base_url');
$url = Mage::helper('auspost')->getFormatUrl(trim(preg_replace('/^.*?\\/\\/(.*)?\\//', '$1', $url)));
foreach ($data_info['dom'] as $web) {
if ($web['dom'] == $url && $web['suc'] == 1) {
$element->setChecked(false);
$id = $website->getId();
$name = $website->getName();
$element->setId($ele_id . '_' . $id);
$element->setValue($id);
if (in_array($id, $ele_value) !== false) {
$element->setChecked(true);
}
if ($id != 0) {
$html .= '<div><label>' . $element->getElementHtml() . ' ' . $name . ' </label></div>';
}
}
}
}
} else {
$html = sprintf('<strong class="required">%s</strong>', $this->__('Please enter a valid key'));
}
return $html;
}
示例11: prepareElementHtml
/**
* Prepare chooser element HTML
*
* @param Varien_Data_Form_Element_Abstract $element Form Element
* @return Varien_Data_Form_Element_Abstract
*/
public function prepareElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$uniqId = Mage::helper('core')->uniqHash($element->getId());
$sourceUrl = $this->getUrl('*/multiproducts/chooser', array('uniq_id' => $uniqId, 'use_massaction' => true));
$chooser = $this->getLayout()->createBlock('widget/adminhtml_widget_chooser')->setElement($element)->setTranslationHelper($this->getTranslationHelper())->setConfig($this->getConfig())->setFieldsetId($this->getFieldsetId())->setSourceUrl($sourceUrl)->setUniqId($uniqId);
if ($element->getValue()) {
$label = "";
$ids = explode('}{', $element->getValue());
$cleanIds = array();
foreach ($ids as $id) {
$id = str_replace('{', '', $id);
$id = str_replace('}', '', $id);
$cleanIds[] = $id;
}
$products = $this->_getProductsByIDs($cleanIds);
if ($products) {
$label .= '<ul>';
foreach ($products as $product) {
$label .= '<li>' . $product->getName() . '</li>';
}
$label .= '</ul>';
$chooser->setLabel($label);
}
}
$element->setData('after_element_html', $chooser->toHtml());
return $element;
}
示例12: _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>';
}
示例13: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$res = '';
$divId = $element->getId();
$res .= <<<EOD
\t\t<input name="{$element->getName()}" id="{$divId}_date" value="{$element->getValue()}" type="text" style="width:130px !important;" /> <img src="{$this->getSkinUrl('images/grid-cal.gif')}" alt="" id="{$divId}_date_trig" title="{$this->__('Select Date')}" style="" />
\t\t<script type="text/javascript">
\t\t//<![CDATA[
\t\t\t//this example uses dd.MM.yyyy hh:mm format.
\t\t\tCalendar.setup({
\t\t\t\tinputField: "{$divId}_date",
\t\t\t\tifFormat: "%Y-%m-%d %H:%M:%S",
\t\t\t\tshowsTime: true,
\t\t\t\tfirstDay: 1,
\t\t\t\ttimeFormat: "24",
\t\t\t\tbutton: "{$divId}_date_trig",
\t\t\t\talign: "Bl",
\t\t\t\tsingleClick : true
\t\t\t});
\t\t\t
\t\t//]]>
\t\t</script>
EOD;
return $res;
}
示例14: render
public function render(Varien_Data_Form_Element_Abstract $element)
{
$editor = new TM_Core_Block_Adminhtml_Widget_Form_Element_Wysiwyg($element->getData());
$editor->setId($element->getId());
$editor->setForm($element->getForm());
return parent::render($editor);
}
示例15: _getElementHtml
/**
* Adds some Javascript to the drop-down to place recommended defaults
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$defaultSizes = array('image' => array('width' => '265', 'height' => ''), 'small_image' => array('width' => '88', 'height' => '77'), 'thumbnail' => array('width' => '75', 'height' => '75'));
$element->setData('onchange', "defaultImageSize();");
$element->setData('after_element_html', "\r\n\t\t\t<script>\r\n\t\t\t\tfunction defaultImageSize() {\r\n\t\t\t\t\tvar sizes = " . json_encode($defaultSizes) . ";\r\n\t\t\t\t\tvar size = sizes[\$('{$element->getId()}').value];\r\n\t\t\t\t\tif (size) {\r\n\t\t\t\t\t\tfor (var name in size) {\r\n\t\t\t\t\t\t\t\$('bronto_format_image_' + name).value = size[name];\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t</script>\r\n\t\t");
return parent::_getElementHtml($element);
}