diff --git a/NEWS b/NEWS index 9746f31a..a6bd3b66 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ + - added $all_extra, $hour_extra, $minute_extra, + $second_extra and $meridian_extra parameters to + html_select_time function (Rainer Collet, Monte) - update debug console to print objects (Simon Willison, Monte) - fix Config_File class to not error when there are no diff --git a/docs/designers.sgml b/docs/designers.sgml index 67e5666e..b2059346 100644 --- a/docs/designers.sgml +++ b/docs/designers.sgml @@ -3480,6 +3480,46 @@ OUTPUT: (current year is 2000) n/a outputs values to array of this name + + all_extra + string + No + null + adds extra attributes to select/input tags if + given + + + hour_extra + string + No + null + adds extra attributes to select/input tags if + given + + + minute_extra + string + No + null + adds extra attributes to select/input tags if + given + + + second_extra + string + No + null + adds extra attributes to select/input tags if + given + + + meridian_extra + string + No + null + adds extra attributes to select/input tags if + given + diff --git a/libs/plugins/function.html_select_time.php b/libs/plugins/function.html_select_time.php index 12996ff6..0e82ce07 100644 --- a/libs/plugins/function.html_select_time.php +++ b/libs/plugins/function.html_select_time.php @@ -27,6 +27,11 @@ function smarty_function_html_select_time($params, &$smarty) "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". Can be combined with prefix. */ $field_array = null; + $all_extra = null; + $hour_extra = null; + $minute_extra = null; + $second_extra = null; + $meridian_extra = null; extract($params); @@ -41,10 +46,17 @@ function smarty_function_html_select_time($params, &$smarty) $hours[$i] = sprintf('%02d', $hours[$i]); $html_result .= ''."\n"; + $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"'; } else { - $html_result .= '"' . $prefix . 'Minute">'."\n"; + $html_result .= '"' . $prefix . 'Minute"'; } + if (null !== $minute_extra){ + $html_result .= ' ' . $minute_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + $html_result .= smarty_function_html_options(array('output' => $minutes, 'values' => $minutes, 'selected' => $selected, @@ -79,10 +99,19 @@ function smarty_function_html_select_time($params, &$smarty) $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); $html_result .= ''."\n"; + $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"'; } else { - $html_result .= '"' . $prefix . 'Meridian">'."\n"; + $html_result .= '"' . $prefix . 'Meridian"'; } + + if (null !== $meridian_extra){ + $html_result .= ' ' . $meridian_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'), 'values' => array('am', 'pm'), 'selected' => strtolower(strftime('%p', $time)), diff --git a/plugins/function.html_select_time.php b/plugins/function.html_select_time.php index 12996ff6..0e82ce07 100644 --- a/plugins/function.html_select_time.php +++ b/plugins/function.html_select_time.php @@ -27,6 +27,11 @@ function smarty_function_html_select_time($params, &$smarty) "birthday[Minute]", "birthday[Seconds]" & "birthday[Meridian]". Can be combined with prefix. */ $field_array = null; + $all_extra = null; + $hour_extra = null; + $minute_extra = null; + $second_extra = null; + $meridian_extra = null; extract($params); @@ -41,10 +46,17 @@ function smarty_function_html_select_time($params, &$smarty) $hours[$i] = sprintf('%02d', $hours[$i]); $html_result .= ''."\n"; + $html_result .= '"' . $field_array . '[' . $prefix . 'Minute]"'; } else { - $html_result .= '"' . $prefix . 'Minute">'."\n"; + $html_result .= '"' . $prefix . 'Minute"'; } + if (null !== $minute_extra){ + $html_result .= ' ' . $minute_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + $html_result .= smarty_function_html_options(array('output' => $minutes, 'values' => $minutes, 'selected' => $selected, @@ -79,10 +99,19 @@ function smarty_function_html_select_time($params, &$smarty) $selected = intval(floor(strftime('%S', $time) / $second_interval) * $second_interval); $html_result .= ''."\n"; + $html_result .= '"' . $field_array . '[' . $prefix . 'Meridian]"'; } else { - $html_result .= '"' . $prefix . 'Meridian">'."\n"; + $html_result .= '"' . $prefix . 'Meridian"'; } + + if (null !== $meridian_extra){ + $html_result .= ' ' . $meridian_extra; + } + if (null !== $all_extra){ + $html_result .= ' ' . $all_extra; + } + $html_result .= '>'."\n"; + $html_result .= smarty_function_html_options(array('output' => array('AM', 'PM'), 'values' => array('am', 'pm'), 'selected' => strtolower(strftime('%p', $time)),