/** * Returns a list of <input type="radio" /> buttons, optionally with one selected * * @param string Name for radio buttons * @param array Array of value => text pairs representing '<input type="radio" value="$key" />$value' fields * @param string Selected radio button value * @param boolean Whether or not to htmlspecialchars the text for the buttons * @param string Indent string to place before buttons * * @return string List of <input type="radio" /> buttons */ function construct_radio_options($name, $array, $checkedid = '', $htmlise = false, $indent = '') { global $vbulletin; $options = "<div class=\"ctrl_{$ctrl}\">"; if (is_array($array)) { $uniqueid = fetch_uniqueid_counter(); foreach ($array as $key => $val) { if (is_array($val)) { $options .= "\t\t<b>" . iif($htmlise, htmlspecialchars_uni($key), $key) . "</b><br />\n"; $options .= construct_radio_options($name, $val, $checkedid, $htmlise, ' '); } else { $options .= "\t\t<label for=\"rb_{$name}{$key}_{$uniqueid}\">{$indent}<input type=\"radio\" name=\"{$name}\" id=\"rb_{$name}{$key}_{$uniqueid}\" tabindex=\"1\" value=\"" . iif($key !== 'no_value', $key) . "\"" . iif($vbulletin->debug, " title=\"name="{$name}" value="{$key}"\"") . iif($key == $checkedid, ' checked="checked"') . " />" . iif($htmlise, htmlspecialchars_uni($val), $val) . "</label><br />\n"; } } } $options .= "</div>"; return $options; }
protected function print_yes_no_row($title, $stylevarid, $input_type, $value, $stylevar_value) { global $vbphrase; $vb5_config =& vB::getConfig(); $name = 'stylevar[' . $stylevarid . '][' . $input_type . ']'; $uniqueid = fetch_uniqueid_counter(); $value = intval($value); $cell = "<div id=\"ctrl_{$name}\" class=\"smallfont\" style=\"white-space:nowrap\">\n\t\t\t<label for=\"rb_1_{$name}_{$uniqueid}\"><input type=\"radio\" name=\"{$name}\" id=\"rb_1_{$name}_{$uniqueid}\" value=\"1\" tabindex=\"1\"" . iif($vb5_config['Misc']['debug'], " title=\"name="{$name}" value="1"\"") . iif($value == 1, ' checked="checked"') . " />{$vbphrase['yes']}" . iif(vB_Template_Runtime::fetchStyleVar('textdirection') == 'rtl', "‏") . "</label>\n\t\t\t<label for=\"rb_0_{$name}_{$uniqueid}\"><input type=\"radio\" name=\"{$name}\" id=\"rb_0_{$name}_{$uniqueid}\" value=\"0\" tabindex=\"1\"" . iif($vb5_config['Misc']['debug'], " title=\"name="{$name}" value="0"\"") . iif($value == 0, ' checked="checked"') . " />{$vbphrase['no']}" . iif(vB_Template_Runtime::fetchStyleVar('textdirection') == 'rtl', "‏") . "</label>" . "\n\t"; $cell .= $this->fetch_stylevar_input($stylevarid, $input_type, $stylevar_value); $cell .= "</div>\n"; print_label_row($title, $cell, '', 'top', $name); construct_hidden_code('stylevar[' . $stylevarid . '][original_' . $input_type . ']', $value, false); }