3 * HTML radio button object
5 * @author Ant P <p@cpi.merseine.nu>
6 * @license http://specialops.ath.cx/repos/so2/trunk/COPYING (New BSD Licence)
16 function __construct($name, $label, $value = '', $checked = false)
19 $this->label
= $label;
20 $this->value
= $value;
21 $this->checked
= $checked;
24 function is_selected()
26 return isset($_POST[$this->name
]) && $_POST[$this->name
] == $this->value
;
32 '<input type="radio" name="'.$this->name
.'" value="'.$this->value
.'"'.
33 ($this->checked ?
' checked="checked"' : '').'/>'.htmlspecialchars($this->label
).'</label>';
36 static function factory($name, array $buttons, $default = null)
39 foreach ( $buttons as $value => $label ) {
40 $ret[$value] = new HTML_Radiobutton($name, $label, $value, ($value==$default));