diff --git a/lib/front/front.class.php b/lib/front/front.class.php index 99dedc8632..cab3b88f19 100644 --- a/lib/front/front.class.php +++ b/lib/front/front.class.php @@ -39,6 +39,43 @@ class html extends baseHTML return parent::a($href, $title, $misc, $newline); } + /** + * 生成多选按钮。 + * Create tags like "" + * + * @param string $name the name of the checkbox tag. + * @param array $options the array to create checkbox tag from. + * @param string $checked the value to checked by default, can be item1,item2 + * @param string $attrib other attribs. + * @param string $type inline or block + * @static + * @access public + * @return string + */ + static public function checkbox($name, $options, $checked = "", $attrib = "", $type = 'block') + { + $options = (array)($options); + if(!is_array($options) or empty($options)) return false; + + if(is_array($checked)) $checked = implode(',', $checked); + $string = ''; + $checked = ",$checked,"; + $isBlock = $type == 'block'; + + foreach($options as $key => $value) + { + $key = str_replace('item', '', $key); + if($isBlock) $string .= "