本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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');
}
示例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;
}
示例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;
}