5 * Class to build various forms
8 /** name of our form. Used as prefix for labels */
13 * @param string $name Name of the fieldset.
14 * @param string $content HTML content to put in.
15 * @return string HTML fieldset
17 function fieldset( $name, $content ) {
18 return "<fieldset><legend>".wfMsg($this->mName
.'-'.$name)."</legend>\n" .
19 $content . "\n</fieldset>\n";
24 * @param string $varname Name of the checkbox.
25 * @param boolean $checked Set true to check the box (default False).
27 function checkbox( $varname, $checked=false ) {
28 $checked = isset( $GLOBALS[$varname] ) && $GLOBALS[$varname] ;
29 return "<div><input type='checkbox' value=\"1\" id=\"{$varname}\" name=\"wpOp{$varname}\"" .
30 ( $checked ?
' checked="checked"' : '' ) .
31 " /><label for=\"{$varname}\">". wfMsg( $this->mName
.'-'.$varname ) .
37 * @param string $varname Name of the textbox.
38 * @param string $value Optional value (default empty)
39 * @param integer $size Optional size of the textbox (default 20)
41 function textbox( $varname, $value='', $size=20 ) {
42 $value = isset( $GLOBALS[$varname] ) ?
$GLOBALS[$varname] : $value;
43 return "<div><label>". wfMsg( $this->mName
.'-'.$varname ) .
44 "<input type='text' name=\"wpOp{$varname}\" value=\"{$value}\" size=\"{$size}\" /></label></div>\n";
49 * @param string $varname Name of the radiobox.
50 * @param array $fields Various fields.
52 function radiobox( $varname, $fields ) {
53 foreach ( $fields as $value => $checked ) {
54 $s .= "<div><label><input type='radio' name=\"wpOp{$varname}\" value=\"{$value}\"" .
55 ( $checked ?
' checked="checked"' : '' ) . " />" . wfMsg( $this->mName
.'-'.$varname.'-'.$value ) .
58 return $this->fieldset( $this->mName
.'-'.$varname, $s );
63 * @param string $varname Name of the textareabox.
64 * @param string $value Optional value (default empty)
65 * @param integer $size Optional size of the textarea (default 20)
67 function textareabox ( $varname, $value='', $size=20 ) {
68 $value = isset( $GLOBALS[$varname] ) ?
$GLOBALS[$varname] : $value;
69 return '<div><label>'.wfMsg( $this->mName
.'-'.$varname ).
70 "<textarea name=\"wpOp{$varname}\" rows=\"5\" cols=\"{$size}\">$value</textarea>\n";
75 * @param string $varname Name of the arraybox.
76 * @param integer $size Optional size of the textarea (default 20)
78 function arraybox( $varname , $size=20 ) {
80 if ( isset( $GLOBALS[$varname] ) && is_array( $GLOBALS[$varname] ) ) {
81 foreach ( $GLOBALS[$varname] as $index=>$element ) {
85 return "<div><label>".wfMsg( $this->mName
.'-'.$varname ).
86 "<textarea name=\"wpOp{$varname}\" rows=\"5\" cols=\"{$size}\">{$s}</textarea>\n";