]> git.joonet.de Git - adminer.git/commitdiff
Checkbox for bool in psql
authorAdam Kuśmierz <kusmierz@users.noreply.github.com>
Wed, 29 Jun 2016 16:27:34 +0000 (18:27 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 20 Feb 2017 11:31:36 +0000 (12:31 +0100)
adminer/include/functions.inc.php

index 8bde16d4648838ba406e843593e51e413404fca7..43c04fdfd6aa8414d7934ef857b68eb3d6019555 100644 (file)
@@ -890,6 +890,9 @@ function input($field, $value, $function) {
                $input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
                if ($input != "") {
                        echo $input;
+               } elseif (preg_match('~bool~', $field["type"])) {
+                       echo "<input type='hidden'$attrs value='0'>" .
+                               "<input type='checkbox'" . (in_array(strtolower($value), array('1',  't',  'true',  'y',  'yes',  'on')) ? " checked='checked'" : "") . "$attrs value='1'>";
                } elseif ($field["type"] == "set") { //! 64 bits
                        preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
                        foreach ($matches[1] as $i => $val) {