element['class'] ? ' class="radio '.(string) $this->element['class'].'"' : ' class="radio"'; // Start the radio field output. $html[] = '
'; $design = ( (string)$this->element['typedesign'] ? $this->element['typedesign'] : 0 ); if ($design == 1) { $options = $this->getOptionsDesign1(); } if ($design == 2) { $options = $this->getOptionsDesign2(); } //$output .= ''; // Build the radio field output. foreach ($options as $i => $option) { // Initialize some option attributes. $checked = ((string) $option->value == (string) $this->value) ? ' checked="checked"' : ''; $class = !empty($option->class) ? ' class="'.$option->class.'"' : ''; $disabled = !empty($option->disable) ? ' disabled="disabled"' : ''; // Initialize some JavaScript option attributes. $onclick = !empty($option->onclick) ? ' onclick="'.$option->onclick.'"' : ''; $html[] = '
'; $html[] = ''; $html[] = '
'; /*if ($design == 1) { $html[] = '' . '
'.$option->img.'
'; } if ($design == 2) { if($option->imgnr % 3 == 0) { $cssPart = ''; $htmlPart = '
'; } else { $cssPart ='margin-right:10px;'; $htmlPart = '
'; } $html[] = '' . '
'.$option->img.'
'. $htmlPart; }*/ } // End the radio field output. $html[] = '
'; return implode($html); } protected function getOptionsDesign1() { $options = array(); foreach ($this->element->children() as $option) { $tmp = new CMSObject(); if ($option->getName() != 'option') { continue; } $tmp->value = (string) $option['value']; $tmp->text = trim((string) $option); switch((int)$option['value']) { case 1: $optName = 'grey'; break; case 2: $optName = 'grey'; break;//$optName = 'greywb';the same but other padding case 3: $optName = 'greyrc'; break; case 4: $optName = 'black'; break; default: case 0: $optName = 'none'; break; } if ((int)$option['value'] == 0) { $tmp->img = ''; } else { $tmp->img = HTMLHelper::_('image', 'components/com_phocamaps/assets/images/box-'.$optName.'-tl.png', '', array('style' => 'margin:0;padding:0')); } //$tmp->class = (string) $option['class']; //$tmp->onclick = (string) $option['onclick']; $options[] = $tmp; } reset($options); return $options; } protected function getOptionsDesign2() { $options = array(); $i = 1; foreach ($this->element->children() as $option) { $tmp = new CMSObject(); if ($option->getName() != 'option') { continue; } $tmp->value = (string) $option['value']; $tmp->text = trim((string) $option); switch((int)$option['value']) { case 1: $optName = 'igrey'; break; case 2: $optName = 'iyellow'; break; case 3: $optName = 'ihome'; break; case 4: $optName = 'igreen'; break; case 5: $optName = 'istar'; break; case 6: $optName = 'iinfoh'; break; case 7: $optName = 'iinfoi'; break; case 8: $optName = 'iinfop'; break; case 9: $optName = 'iinfoph'; break; case 10:$optName = 'iinfoz'; break; default: case 0: $optName = 'default'; break; } if ((int)$option['value'] == 0) { $tmp->img = ''; $tmp->imgnr = 0; } else { $tmp->img = HTMLHelper::_('image', 'media/com_phocamaps/images/'.$optName.'/image.png', '', array('style' => 'margin:0;padding:0')); $tmp->imgnr = $i; $i++; } //$tmp->class = (string) $option['class']; //$tmp->onclick = (string) $option['onclick']; $options[] = $tmp; } reset($options); return $options; } }