diff options
Diffstat (limited to 'utils/forms.php')
-rw-r--r-- | utils/forms.php | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/utils/forms.php b/utils/forms.php index 45939e7..126d29f 100644 --- a/utils/forms.php +++ b/utils/forms.php @@ -19,6 +19,26 @@ class LineEdit { } } +class LineEditPwd { + public $label, $name, $value; + + function LineEditPwd($label, $name, $value = "") + { + $this->label = $label; + $this->name = $name; + $this->value = $value; + } + + function render($indent = "") + { + $str = $indent . "<div class=\"input\">\n"; + $str .= $indent . " <div class=\"label\">". $this->label ."</div>\n"; + $str .= $indent . " <div class=\"widget\"><input name=\"vars[".$this->name."]\" value=\"".$this->value."\" type=\"password\"/></div>\n"; + $str .= $indent . "</div>\n"; + return $str; + } +} + class FileUpload { public $label, $name, $accept; @@ -358,6 +378,36 @@ class ListEditor { } } +class MultiList { + public $label, $name, $values; + + function MultiList($label, $name, $values = "") + { + $this->label = $label; + $this->name = $name; + $this->values = $values; + } + + function render($indent = "") + { + $str = $indent . "<div class=\"input\">\n"; + $str .= $indent . " <div class=\"label\">". $this->label ."</div>\n"; + $str .= $indent . " <div class=\"widget\">\n"; + $str .= $indent . " <select multiple size=\"8\" id=\"items\" name=\"".$this->name."[]\">\n"; + if(sizeof($this->values)) { + foreach($this->values as $value => $active) { + if($active == true) $sel = " selected=\"true\""; + else $sel = ""; + $str .= $indent . " <option value=\"".$value."\"".$sel.">".$value."</option>\n"; + } + } + $str .= $indent . " </select>\n"; + $str .= $indent . " </div>\n"; + $str .= $indent . "</div>\n"; + return $str; + } +} + class Form { public $widgets = array(); public $action; |