added passthru attribute feature to html_select_date

This commit is contained in:
mohrt
2005-07-08 13:36:34 +00:00
parent e72893f839
commit b98c95a904
2 changed files with 13 additions and 5 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- add passthru attribute feature to html_select_date (kills,
monte)
- add "middle" parameter to truncate (monte)
- make form input label ids optional (monte)
- add error message for empty if/elseif statements (eykanal,

View File

@@ -34,6 +34,7 @@
*/
function smarty_function_html_select_date($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
require_once $smarty->_get_plugin_filepath('function','html_options');
/* Default values. */
@@ -78,6 +79,7 @@ function smarty_function_html_select_date($params, &$smarty)
$day_empty = null;
$month_empty = null;
$year_empty = null;
$extra_attrs = '';
foreach ($params as $_key=>$_value) {
switch ($_key) {
@@ -119,8 +121,12 @@ function smarty_function_html_select_date($params, &$smarty)
break;
default:
$smarty->trigger_error("[html_select_date] unknown parameter $_key", E_USER_WARNING);
if(!is_array($_value)) {
$extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
} else {
$smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
break;
}
}
@@ -194,7 +200,7 @@ function smarty_function_html_select_date($params, &$smarty)
if (null !== $all_extra){
$month_result .= ' ' . $all_extra;
}
$month_result .= '>'."\n";
$month_result .= $extra_attrs . '>'."\n";
$month_result .= smarty_function_html_options(array('output' => $month_names,
'values' => $month_values,
@@ -230,7 +236,7 @@ function smarty_function_html_select_date($params, &$smarty)
if (null !== $day_extra){
$day_result .= ' ' . $day_extra;
}
$day_result .= '>'."\n";
$day_result .= $extra_attrs . '>'."\n";
$day_result .= smarty_function_html_options(array('output' => $days,
'values' => $day_values,
'selected' => $time[2],
@@ -276,7 +282,7 @@ function smarty_function_html_select_date($params, &$smarty)
if (null !== $year_extra){
$year_result .= ' ' . $year_extra;
}
$year_result .= '>'."\n";
$year_result .= $extra_attrs . '>'."\n";
$year_result .= smarty_function_html_options(array('output' => $years,
'values' => $yearvals,
'selected' => $time[0],