public static function radioButtonList($name, $select, $data, $htmlOptions = array())
    {
        $inline = TbArray::popValue('inline', $htmlOptions, false);
        $separator = TbArray::popValue('separator', $htmlOptions, ' ');
        $container = TbArray::popValue('container', $htmlOptions, 'span');
        $containerOptions = TbArray::popValue('containerOptions', $htmlOptions, array());
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());

        $items = array();
        $baseID = $containerOptions['id'] = TbArray::popValue('baseID', $htmlOptions, parent::getIdByName($name));

        $id = 0;
        foreach ($data as $value => $label) {
            $checked = !strcmp($value, $select);
            $htmlOptions['value'] = $value;
            $htmlOptions['id'] = $baseID . '_' . $id++;
            if ($inline) {
                $htmlOptions['label'] = $label;
                self::addCssClass('inline', $labelOptions);
                $htmlOptions['labelOptions'] = $labelOptions;
                $items[] = self::radioButton($name, $checked, $htmlOptions);
            } else {
                $option = self::radioButton($name, $checked, $htmlOptions);
                self::addCssClass('radio', $labelOptions);
                $items[] = self::label($option . ' ' . $label, false, $labelOptions);
            }
        }

        $inputs = implode($separator, $items);
        return !empty($container) ? self::tag($container, $containerOptions, $inputs) : $inputs;
    }
public static function radioButtonList($name, $select, $data, $htmlOptions = array())
    {
        $inline = TbArray::popValue('inline', $htmlOptions, false);
        $separator = TbArray::popValue('separator', $htmlOptions, ' ');
        $container = TbArray::popValue('container', $htmlOptions, 'span');
        $containerOptions = TbArray::popValue('containerOptions', $htmlOptions, array());
        $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());

        $items = array();
        $baseID = $containerOptions['id'] = TbArray::popValue('baseID', $htmlOptions, parent::getIdByName($name));

        $id = 0;
        foreach ($data as $value => $label) {
            $checked = !strcmp($value, $select);
            $htmlOptions['value'] = $value;
            $htmlOptions['id'] = $baseID . '_' . $id++;
            if ($inline) {
                $htmlOptions['label'] = $label;
                self::addCssClass('inline', $labelOptions);
                $htmlOptions['labelOptions'] = $labelOptions;
                $items[] = self::radioButton($name, $checked, $htmlOptions);
            } else {
                $option = self::radioButton($name, $checked, $htmlOptions);
                self::addCssClass('radio', $labelOptions);
                $items[] = self::label($option . ' ' . $label, false, $labelOptions);
            }
        }

        $inputs = implode($separator, $items);
        return !empty($container) ? self::tag($container, $containerOptions, $inputs) : $inputs;
    }
public static function radioButtonList ( $ name , $ select , $ data , $ htmlOptions = array ( ) ) { $ inline = TbArray :: popValue ( 'inline' , $ htmlOptions , false ) ; $ separator = TbArray :: popValue ( 'separator' , $ htmlOptions , ' ' ) ; $ container = TbArray :: popValue ( 'container' , $ htmlOptions , 'span' ) ; $ containerOptions = TbArray :: popValue ( 'containerOptions' , $ htmlOptions , array ( ) ) ; $ labelOptions = TbArray :: popValue ( 'labelOptions' , $ htmlOptions , array ( ) ) ; $ items = array ( ) ; $ baseID = $ containerOptions [ 'id' ] = TbArray :: popValue ( 'baseID' , $ htmlOptions , parent :: getIdByName ( $ name ) ) ; $ id = 0 ; foreach ( $ data as $ value => $ label ) { $ checked = ! strcmp ( $ value , $ select ) ; $ htmlOptions [ 'value' ] = $ value ; $ htmlOptions [ 'id' ] = $ baseID . '_' . $ id ++ ; if ( $ inline ) { $ htmlOptions [ 'label' ] = $ label ; self :: addCssClass ( 'inline' , $ labelOptions ) ; $ htmlOptions [ 'labelOptions' ] = $ labelOptions ; $ items [ ] = self :: radioButton ( $ name , $ checked , $ htmlOptions ) ; } else { $ option = self :: radioButton ( $ name , $ checked , $ htmlOptions ) ; self :: addCssClass ( 'radio' , $ labelOptions ) ; $ items [ ] = self :: label ( $ option . ' ' . $ label , false , $ labelOptions ) ; } } $ inputs = implode ( $ separator , $ items ) ; return ! empty ( $ container ) ? self :: tag ( $ container , $ containerOptions , $ inputs ) : $ inputs ; }
Generates a radio button list.
@param string $name name of the radio button list.
@param mixed $select selection of the radio buttons.
@param array $data $data value-label pairs used to generate the radio button list.
@param array $htmlOptions additional HTML attributes.
@return string the generated list.
Generates a radio button list .