diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 939b00cc4..3f579836f 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -973,12 +973,23 @@ class e_form * @param string $name * @param mixed $value * @param boolean $checked - * @param array $options + * @param mixed $options query-string or array or string for a label. eg. label=Hello&foo=bar or array('label'=>Hello') or 'Hello' * @return void */ function checkbox($name, $value, $checked = false, $options = array()) { - if(!is_array($options)) parse_str($options, $options); + if(!is_array($options)) + { + if(strpos($options,"=")!==false) + { + parse_str($options, $options); + } + else // Assume it's a label. + { + $options = array('label'=>$options); + } + + } $options = $this->format_options('checkbox', $name, $options); $options['checked'] = $checked; //comes as separate argument just for convenience diff --git a/e107_handlers/userclass_class.php b/e107_handlers/userclass_class.php index c8ce785cd..997c1bd20 100644 --- a/e107_handlers/userclass_class.php +++ b/e107_handlers/userclass_class.php @@ -557,6 +557,7 @@ class user_class public function uc_checkboxes($fieldname, $curval='', $optlist = '', $showdescription = FALSE, $asArray = FALSE) { $show_classes = $this->uc_required_class_list($optlist); + $frm = e107::getForm(); $curArray = explode(',', $curval); // Array of current values $ret = array(); @@ -565,9 +566,14 @@ class user_class { if ($k != e_UC_BLANK) { - $c = (in_array($k,$curArray)) ? " checked='checked'" : ''; + // $c = (in_array($k,$curArray)) ? " checked='checked'" : ''; + $c = (in_array($k,$curArray)) ? true : false; if ($showdescription) $v .= ' ('.$this->uc_get_classdescription($k).')'; - $ret[] = "
\n"; + //$ret[] = "
\n"; + + $ret[] = $frm->checkbox($fieldname[$k],$k,$c,$v); + //$ret[] = "
\n"; + } } if ($asArray) return $ret;