20
20
* - options (optional) - associative array
21
21
* - checked (optional) - array default not set
22
22
* - separator (optional) - ie <br> or
23
* - output (optional) - without this one the buttons don't have names
23
* - output (optional) - the output next to each checkbox
24
* - assign (optional) - assign the output as an array to this variable
26
27
* {html_checkboxes values=$ids output=$names}
30
31
* @link http://smarty.php.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
31
32
* (Smarty online manual)
32
33
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
33
* @author credits to Monte Ohrt <monte@ispi.net>
34
* @author credits to Monte Ohrt <monte at ohrt dot com>
95
99
return ''; /* raise error here? */
97
101
settype($selected, 'array');
102
$_html_result = array();
100
if (is_array($options)) {
104
if (isset($options)) {
102
106
foreach ($options as $_key=>$_val)
103
$_html_result .= smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
107
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
107
111
foreach ($values as $_i=>$_key) {
108
112
$_val = isset($output[$_i]) ? $output[$_i] : '';
109
$_html_result .= smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
113
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels);
114
return $_html_result;
118
if(!empty($params['assign'])) {
119
$smarty->assign($params['assign'], $_html_result);
121
return implode("\n",$_html_result);