43 require_once $smarty->_get_plugin_filepath(
'shared',
'escape_special_chars');
55 foreach($params as $_key => $_val) {
67 $$_key = (array)$_val;
72 $$_key = array_values((array)$_val);
77 $selected = array_map(
'strval', array_values((array)$_val));
81 $smarty->trigger_error(
'html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead', E_USER_WARNING);
89 if(!is_array($_val)) {
92 $smarty->trigger_error(
"html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
98 if (!isset(
$options) && !isset($values))
101 settype($selected,
'array');
102 $_html_result = array();
111 foreach ($values as $_i=>$_key) {
112 $_val = isset($output[$_i]) ? $output[$_i] :
'';
118 if(!empty($params[
'assign'])) {
119 $smarty->assign($params[
'assign'], $_html_result);
121 return implode(
"\n",$_html_result);
128 if ($labels) $_output .=
'<label>';
129 $_output .=
'<input type="checkbox" name="'
133 if (in_array((
string)$value, $selected)) {
134 $_output .=
' checked="checked"';
136 $_output .= $extra .
' />' . $output;
137 if ($labels) $_output .=
'</label>';
138 $_output .= $separator;