use PMA_generate_html_radio()

This commit is contained in:
Marc Delisle
2008-02-10 13:25:08 +00:00
parent 7a5f951c64
commit 94ef9792ea
2 changed files with 16 additions and 11 deletions

View File

@@ -2299,9 +2299,13 @@ function PMA_externalBug($functionality, $component, $minimum_version, $bugref)
* @param string $checked_choice the choice to check by default
* @param boolean $line_break whether to add an HTML line break after a choice
* @param boolean $escape_label whether to use htmlspecialchars() on label
* @param string $class enclose each choice with a div of this class
*/
function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = '', $line_break = true, $escape_label = true) {
function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = '', $line_break = true, $escape_label = true, $class='') {
foreach ($choices as $choice_value => $choice_label) {
if (! empty($class)) {
echo '<div class="' . $class . '">';
}
$html_field_id = $html_field_name . '_' . $choice_value;
echo '<input type="radio" name="' . $html_field_name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
if ($choice_value == $checked_choice) {
@@ -2312,6 +2316,9 @@ function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = '
if ($line_break) {
echo '<br />';
}
if (! empty($class)) {
echo '</div>';
}
echo "\n";
}
}

View File

@@ -304,16 +304,14 @@ while (list($operator) = each($GLOBALS['cfg']['UnaryOperators'])) {
} // end for
?>
</select>
<div class="formelement">
<input type="radio" name="order" value="ASC" checked="checked" id="sortASC" />
<label for="sortASC"><?php echo $strAscending; ?></label>
</div>
<div class="formelement">
<input type="radio" name="order" value="DESC" id="sortDESC" />
<label for="sortDESC"><?php echo $strDescending; ?></label>
</div>
<?php
$choices = array(
'ASC' => $strAscending,
'DESC' => $strDescending
);
PMA_generate_html_radio('order', $choices, 'ASC', false, true, "formelement");
unset($choices);
?>
</fieldset>
</div>
</fieldset>