mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 19:34:27 +02:00
added passthru attribute feature to html_select_date
This commit is contained in:
2
NEWS
2
NEWS
@@ -1,3 +1,5 @@
|
|||||||
|
- add passthru attribute feature to html_select_date (kills,
|
||||||
|
monte)
|
||||||
- add "middle" parameter to truncate (monte)
|
- add "middle" parameter to truncate (monte)
|
||||||
- make form input label ids optional (monte)
|
- make form input label ids optional (monte)
|
||||||
- add error message for empty if/elseif statements (eykanal,
|
- add error message for empty if/elseif statements (eykanal,
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
*/
|
*/
|
||||||
function smarty_function_html_select_date($params, &$smarty)
|
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('shared','make_timestamp');
|
||||||
require_once $smarty->_get_plugin_filepath('function','html_options');
|
require_once $smarty->_get_plugin_filepath('function','html_options');
|
||||||
/* Default values. */
|
/* Default values. */
|
||||||
@@ -78,6 +79,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
$day_empty = null;
|
$day_empty = null;
|
||||||
$month_empty = null;
|
$month_empty = null;
|
||||||
$year_empty = null;
|
$year_empty = null;
|
||||||
|
$extra_attrs = '';
|
||||||
|
|
||||||
foreach ($params as $_key=>$_value) {
|
foreach ($params as $_key=>$_value) {
|
||||||
switch ($_key) {
|
switch ($_key) {
|
||||||
@@ -119,8 +121,12 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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){
|
if (null !== $all_extra){
|
||||||
$month_result .= ' ' . $all_extra;
|
$month_result .= ' ' . $all_extra;
|
||||||
}
|
}
|
||||||
$month_result .= '>'."\n";
|
$month_result .= $extra_attrs . '>'."\n";
|
||||||
|
|
||||||
$month_result .= smarty_function_html_options(array('output' => $month_names,
|
$month_result .= smarty_function_html_options(array('output' => $month_names,
|
||||||
'values' => $month_values,
|
'values' => $month_values,
|
||||||
@@ -230,7 +236,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
if (null !== $day_extra){
|
if (null !== $day_extra){
|
||||||
$day_result .= ' ' . $day_extra;
|
$day_result .= ' ' . $day_extra;
|
||||||
}
|
}
|
||||||
$day_result .= '>'."\n";
|
$day_result .= $extra_attrs . '>'."\n";
|
||||||
$day_result .= smarty_function_html_options(array('output' => $days,
|
$day_result .= smarty_function_html_options(array('output' => $days,
|
||||||
'values' => $day_values,
|
'values' => $day_values,
|
||||||
'selected' => $time[2],
|
'selected' => $time[2],
|
||||||
@@ -276,7 +282,7 @@ function smarty_function_html_select_date($params, &$smarty)
|
|||||||
if (null !== $year_extra){
|
if (null !== $year_extra){
|
||||||
$year_result .= ' ' . $year_extra;
|
$year_result .= ' ' . $year_extra;
|
||||||
}
|
}
|
||||||
$year_result .= '>'."\n";
|
$year_result .= $extra_attrs . '>'."\n";
|
||||||
$year_result .= smarty_function_html_options(array('output' => $years,
|
$year_result .= smarty_function_html_options(array('output' => $years,
|
||||||
'values' => $yearvals,
|
'values' => $yearvals,
|
||||||
'selected' => $time[0],
|
'selected' => $time[0],
|
||||||
|
Reference in New Issue
Block a user