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 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 $line_break whether to add an HTML line break after a choice
* @param boolean $escape_label whether to use htmlspecialchars() on label * @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) { foreach ($choices as $choice_value => $choice_label) {
if (! empty($class)) {
echo '<div class="' . $class . '">';
}
$html_field_id = $html_field_name . '_' . $choice_value; $html_field_id = $html_field_name . '_' . $choice_value;
echo '<input type="radio" name="' . $html_field_name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"'; echo '<input type="radio" name="' . $html_field_name . '" id="' . $html_field_id . '" value="' . htmlspecialchars($choice_value) . '"';
if ($choice_value == $checked_choice) { if ($choice_value == $checked_choice) {
@@ -2312,6 +2316,9 @@ function PMA_generate_html_radio($html_field_name, $choices, $checked_choice = '
if ($line_break) { if ($line_break) {
echo '<br />'; echo '<br />';
} }
if (! empty($class)) {
echo '</div>';
}
echo "\n"; echo "\n";
} }
} }

View File

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