Skip to content

Commit

Permalink
Move function
Browse files Browse the repository at this point in the history
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1235 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information
jakubvrana committed Nov 9, 2009
1 parent a561252 commit 098b74b
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions adminer/include/functions.inc.php
Expand Up @@ -75,24 +75,6 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "") {
return (strlen($label) ? "<label for='checkbox-$id'>$return" . h($label) . "</label>" : $return); 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 /** Generate list of HTML options
* @param array array of strings or arrays (creates optgroup) * @param array array of strings or arrays (creates optgroup)
* @param mixed * @param mixed
Expand All @@ -115,6 +97,24 @@ function optionlist($options, $selected = null, $use_keys = false) {
return $return; 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 /** Get list of values from database
* @param string * @param string
* @param mixed * @param mixed
Expand Down

0 comments on commit 098b74b

Please sign in to comment.