1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Checkbox alignment fix

This commit is contained in:
Cameron 2013-04-16 18:03:34 -07:00
parent 9baa5a601a
commit 750ac914a2
2 changed files with 20 additions and 8 deletions

View File

@ -605,7 +605,7 @@ class e_form
* @param array or str
* @example $frm->datepicker('my_field',time(),'type=date');
* @example $frm->datepicker('my_field',time(),'type=datetime&inline=1');
* @example $frm->datepicker('my_field',time(),'type=date&dateformat=yy-mm-dd');
* @example $frm->datepicker('my_field',time(),'type=date&dateformat=yyyy-mm-dd');
*
* @url http://trentrichardson.com/examples/timepicker/
*/
@ -1825,7 +1825,6 @@ class e_form
break;
case 'checkbox':
$def_options['class'] = 'checkbox';
unset($def_options['size'], $def_options['selected']);
break;

View File

@ -732,24 +732,37 @@ class user_class
*/
public function checkbox($treename, $classnum, $current_value, $nest_level, $opt_options = '')
{
$classIndex = abs($classnum); // Handle negative class values
$classSign = (substr($classnum, 0, 1) == '-') ? '-' : '';
$frm = e107::getForm();
$classIndex = abs($classnum); // Handle negative class values
$classSign = (substr($classnum, 0, 1) == '-') ? '-' : '';
if ($classIndex == e_UC_BLANK) return '';
$tmp = explode(',',$current_value);
$chk = in_array($classnum, $tmp) ? " checked='checked'" : '';
$tmp = explode(',',$current_value);
$chk = in_array($classnum, $tmp) ? " checked='checked'" : '';
$style = "";
if ($nest_level == 0)
{
$style = " style='font-weight:bold'";
}
else
elseif($nest_level > 1)
{
$style = " style='text-indent:".(1.2*$nest_level)."em'";
$style = " style='text-indent:".(1.2 * $nest_level)."em'";
}
$ucString = $this->class_tree[$classIndex]['userclass_name'];
if ($classSign == '-')
{
$ucString = str_replace('--CLASS--', $ucString, UC_LAN_INVERT);
}
$checked = in_array($classnum, $tmp) ? true : false;
return "<div {$style}>".$frm->checkbox($treename.'[]',$classSign.$classIndex,$checked,array('label'=> $ucString))."</div>\n";
return "<div {$style}><input type='checkbox' class='checkbox' name='{$treename}[]' id='{$treename}_{$classSign}{$classIndex}' value='{$classSign}{$classIndex}'{$chk} />".$ucString."</div>\n";
}