diff options
Diffstat (limited to 'include/controls.php')
-rwxr-xr-x | include/controls.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/controls.php b/include/controls.php index e3349d31b..b65a166c2 100755 --- a/include/controls.php +++ b/include/controls.php @@ -5,6 +5,11 @@ $rv = ""; foreach ($attributes as $k => $v) { + + // special handling for "disabled" + if ($k === "disabled" && !sql_bool_to_bool($v)) + continue; + $rv .= "$k=\"" . htmlspecialchars($v) . "\""; } @@ -30,6 +35,18 @@ return "<button dojoType=\"dijit.form.Button\" ".attributes_to_string($attributes)." type=\"$type\">$value</button>"; } + function input_tag(string $name, string $value, string $type = "text", array $attributes = [], string $id = "") { + $attributes_str = attributes_to_string($attributes); + $dojo_type = strpos($attributes_str, "dojoType") === false ? "dojoType='dijit.form.TextBox'" : ""; + + return "<input name=\"".htmlspecialchars($name)."\" $dojo_type ".attributes_to_string($attributes)." id=\"".htmlspecialchars($id)."\" + type=\"$type\" value=\"".htmlspecialchars($value)."\">"; + } + + function number_spinner_tag(string $name, string $value, array $attributes = [], string $id = "") { + return input_tag($name, $value, "text", array_merge(["dojoType" => "dijit.form.NumberSpinner"], $attributes), $id); + } + function submit_tag(string $value, array $attributes = []) { return button_tag($value, "submit", array_merge(["class" => "alt-primary"], $attributes)); } |