Move function

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1235 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana 2009-11-09 22:22:28 +00:00
parent a561252668
commit 098b74b660

View file

@ -75,24 +75,6 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "") {
return (strlen($label) ? "<label for='checkbox-$id'>$return" . h($label) . "</label>" : $return);
}
/** Generate HTML radio list
* @param string
* @param array
* @param string
* @param string true for no onchange, false for radio
* @return string
*/
function html_select($name, $options, $value = "", $onchange = true) {
if ($onchange) {
return "<select name='" . h($name) . "'" . (is_string($onchange) ? " onchange=\"$onchange\"" : "") . ">" . optionlist($options, $value) . "</select>";
}
$return = "";
foreach ($options as $key => $val) {
$return .= "<label><input type='radio' name='" . h($name) . "' value='" . h($key) . "'" . ($key == $value ? " checked" : "") . ">" . h($val) . "</label>";
}
return $return;
}
/** Generate list of HTML options
* @param array array of strings or arrays (creates optgroup)
* @param mixed
@ -115,6 +97,24 @@ function optionlist($options, $selected = null, $use_keys = false) {
return $return;
}
/** Generate HTML radio list
* @param string
* @param array
* @param string
* @param string true for no onchange, false for radio
* @return string
*/
function html_select($name, $options, $value = "", $onchange = true) {
if ($onchange) {
return "<select name='" . h($name) . "'" . (is_string($onchange) ? " onchange=\"$onchange\"" : "") . ">" . optionlist($options, $value) . "</select>";
}
$return = "";
foreach ($options as $key => $val) {
$return .= "<label><input type='radio' name='" . h($name) . "' value='" . h($key) . "'" . ($key == $value ? " checked" : "") . ">" . h($val) . "</label>";
}
return $return;
}
/** Get list of values from database
* @param string
* @param mixed