1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Added disabled param to SelectorOptions()

This commit is contained in:
billz 2019-12-27 03:08:51 +00:00
parent 93514a6787
commit 3292bc580b

View File

@ -147,8 +147,9 @@ function isAssoc($arr)
* @param string $selected: Selected option (optional) * @param string $selected: Selected option (optional)
* @param string $id: $options is an associative array this should be the key * @param string $id: $options is an associative array this should be the key
* @param string $event: onChange event (optional) * @param string $event: onChange event (optional)
* @param string $disabled (optional)
*/ */
function SelectorOptions($name, $options, $selected = null, $id = null, $event = null) function SelectorOptions($name, $options, $selected = null, $id = null, $event = null, $disabled = null)
{ {
echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'"'; echo '<select class="form-control" name="'.htmlspecialchars($name, ENT_QUOTES).'"';
if (isset($id)) { if (isset($id)) {
@ -164,8 +165,10 @@ function SelectorOptions($name, $options, $selected = null, $id = null, $event =
if ($key == $selected) { if ($key == $selected) {
$select = ' selected="selected"'; $select = ' selected="selected"';
} }
if ($key == $disabled) {
echo '<option value="'.htmlspecialchars($key, ENT_QUOTES).'"'.$select.'>'. $disabled = ' disabled';
}
echo '<option value="'.htmlspecialchars($key, ENT_QUOTES).'"'.$select.$disabled.'>'.
htmlspecialchars($label, ENT_QUOTES).'</option>' , PHP_EOL; htmlspecialchars($label, ENT_QUOTES).'</option>' , PHP_EOL;
} }