本文整理汇总了PHP中Varien_Data_Form_Element_Abstract::setChecked方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form_Element_Abstract::setChecked方法的具体用法?PHP Varien_Data_Form_Element_Abstract::setChecked怎么用?PHP Varien_Data_Form_Element_Abstract::setChecked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form_Element_Abstract
的用法示例。
在下文中一共展示了Varien_Data_Form_Element_Abstract::setChecked方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: 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();
}
示例3: _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;
}
示例4: _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;
}