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


PHP Varien_Data_Form_Element_Abstract::setName方法代码示例

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


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

示例1: render

 /**
  * Enter description here...
  *
  * @param Varien_Data_Form_Element_Abstract $element
  * @return string
  */
 public function render(Varien_Data_Form_Element_Abstract $element)
 {
     $fieldConfig = $element->getFieldConfig();
     $clonePath = (string) $fieldConfig->clone_path;
     $clonePaths = explode('/', $clonePath);
     // Prepare value for cloned element
     $name = 'groups[' . $clonePaths[1] . '][fields][' . $clonePaths[2] . '][value]';
     if (isset($this->_affiliateConfigData[$clonePath])) {
         $data = $this->_affiliateConfigData[$clonePath];
         $inherit = false;
     } else {
         $data = $this->_affiliateConfigRoot->descend($clonePath);
         $inherit = true;
     }
     if ($fieldConfig->backend_model) {
         $model = Mage::getModel((string) $fieldConfig->backend_model);
         if (!$model instanceof Mage_Core_Model_Config_Data) {
             Mage::throwException('Invalid config field backend model: ' . (string) $fieldConfig->backend_model);
         }
         $model->setPath($clonePath)->setValue($data)->afterLoad();
         $data = $model->getValue();
     }
     $element->setName($name)->setValue($data)->setInherit($inherit);
     // Render Element to HTML
     $html = parent::render($element);
     // Prepare Javascript for cloned element
     $cloneId = $element->getHtmlId();
     $origId = implode('_', $clonePaths);
     $html .= "<script type='text/javascript'>\r\nEvent.observe(window, 'load', function() {\r\n    \$('{$cloneId}').observe('change', function(){\r\n        Form.Element.setValue(\$('{$origId}'), Form.Element.getValue(\$('{$cloneId}')));\r\n    });\r\n    \$('{$origId}').observe('change', function(){\r\n        Form.Element.setValue(\$('{$cloneId}'), Form.Element.getValue(\$('{$origId}')));\r\n    });";
     if ($element->getCanUseWebsiteValue() || $element->getCanUseDefaultValue()) {
         $html .= "\r\n    \$('{$cloneId}_inherit').observe('click', function(){\r\n        var el = \$('{$origId}_inherit');\r\n        el.checked = \$('{$cloneId}_inherit').checked;\r\n        toggleValueElements(el, Element.previous(el.parentNode));\r\n    });\r\n    \$('{$origId}_inherit').observe('click', function(){\r\n        var el = \$('{$cloneId}_inherit');\r\n        el.checked = \$('{$origId}_inherit').checked;\r\n        toggleValueElements(el, Element.previous(el.parentNode));\r\n    });";
     }
     $html .= "\r\n});\r\n</script>";
     return $html;
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:41,代码来源:Clone.php

示例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);
 }
开发者ID:rob3000,项目名称:magento-notification-bar,代码行数:25,代码来源:Datepicker.php

示例3: _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;
 }
开发者ID:bogdy2p,项目名称:apstufgnto,代码行数:34,代码来源:Website.php

示例4: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $element->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');
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:12,代码来源:Longtext.php

示例5: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '';
     $r = Mage::getStoreConfig('gomage_activation/advancednavigation/ar');
     $value = explode(',', str_replace($r, '', Mage::helper('core')->decrypt($element->getValue())));
     $nameprefix = $element->getName();
     $idprefix = $element->getId();
     $element->setName($nameprefix . '[]');
     $info = Mage::helper('gomage_navigation')->ga();
     if (isset($info['d']) && isset($info['c']) && intval($info['c']) > 0) {
         foreach (Mage::app()->getWebsites() as $website) {
             $element->setChecked(false);
             $id = $website->getId();
             $name = $website->getName();
             $element->setId($idprefix . '_' . $id);
             $element->setValue($id);
             $element->setClass('gomage-navigation-available-sites');
             if (in_array($id, $value) !== false) {
                 $element->setChecked(true);
             }
             if ($id != 0) {
                 $html .= '<div><label>' . $element->getElementHtml() . ' ' . $name . ' </label></div>';
             }
         }
         $html .= '
     	<input id="' . $idprefix . '_diasbled" type="hidden" disabled="disabled" name="' . $nameprefix . '" />
     	<script type="text/javascript">
     	
     	function updateGomageNavigationWebsites(){
     		
     		$("' . $idprefix . '_diasbled").disabled = "disabled";
     		
     		if($$(".gomage-navigation-available-sites:checked").length >= ' . intval($info['c']) . '){
 				$$(".gomage-navigation-available-sites").each(function(e){
 					if(!e.checked){
 						e.disabled = "disabled";
 					}
 				});
 				
 			}else {
 				$$(".gomage-navigation-available-sites").each(function(e){
 					if(!e.checked){
 						e.disabled = "";
 					}
 				});
 				if($$(".gomage-navigation-available-sites:checked").length == 0){
 				
 					$("' . $idprefix . '_diasbled").disabled = "";
 				
 				}
 				
 			}
     	}
     	
     	$$(".gomage-navigation-available-sites").each(function(e){
     		e.observe("click", function(){
     			updateGomageNavigationWebsites();
     		});
     	});
     	
     	updateGomageNavigationWebsites();
     	
     </script>';
     } else {
         $html = sprintf('<strong class="required">%s</strong>', $this->__('Please enter a valid key'));
     }
     return $html;
 }
开发者ID:vstorm83,项目名称:ausport,代码行数:68,代码来源:Website.php

示例6: _getElementHtml

 protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
 {
     $html = '';
     $nameprefix = $element->getName();
     $idprefix = $element->getId();
     $element->setName($nameprefix . '[]');
     $info = array();
     $info['c'] = '5';
     $info['d'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
     if (isset($info['d']) && isset($info['c']) && intval($info['c']) > 0) {
         foreach (Mage::app()->getWebsites() as $website) {
             $element->setChecked(false);
             $id = $website->getId();
             $name = $website->getName();
             $element->setId($idprefix . '_' . $id);
             $element->setValue($id);
             $element->setClass('gomage-checkout-available-sites');
             if ($id !== false) {
                 $element->setChecked(true);
             }
             if ($id != 0) {
                 $html .= '<div><label>' . $element->getElementHtml() . ' ' . $name . ' </label></div>';
             }
         }
         $html .= '
     	<input id="' . $idprefix . '_diasbled" type="hidden" disabled="disabled" name="' . $nameprefix . '" />
     	<script type="text/javascript">
     	
     	function updateGomageCheckoutWebsites(){
     		
     		$("' . $idprefix . '_diasbled").disabled = "disabled";
     		
     		if($$(".gomage-checkout-available-sites:checked").length >= ' . intval($info['c']) . '){
 				$$(".gomage-checkout-available-sites").each(function(e){
 					if(!e.checked){
 						e.disabled = "disabled";
 					}
 				});
 				
 			}else {
 				$$(".gomage-checkout-available-sites").each(function(e){
 					if(!e.checked){
 						e.disabled = "";
 					}
 				});
 				if($$(".gomage-checkout-available-sites:checked").length == 0){
 				
 					$("' . $idprefix . '_diasbled").disabled = "";
 				
 				}
 				
 			}
     	}
     	
     	$$(".gomage-checkout-available-sites").each(function(e){
     		e.observe("click", function(){
     			updateGomageCheckoutWebsites();
     		});
     	});
     	
     	updateGomageCheckoutWebsites();
     	
     </script>';
     } else {
         $html = sprintf('<strong class="required">%s</strong>', $this->__('Please enter a valid key'));
     }
     return $html;
 }
开发者ID:jpedro21,项目名称:comerciodoboi,代码行数:68,代码来源:Website.php


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