html_select_date [PATCH] (again)

"Nicklas Bondesson" <[email protected]> Mon, 4 Jul 2005 15:44:12 +0200
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Attached the patch as a .txt file.

Nicklas

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
function.html_select_date.php_20050703_1937.diff.txt (text/plain, 2.4 KB)
--- function.html_select_date.php.orig	2005-07-03 19:43:16.000000000 +0200
+++ function.html_select_date.php	2005-07-03 19:42:23.000000000 +0200
@@ -81,6 +81,9 @@
 
     foreach ($params as $_key=>$_value) {
         switch ($_key) {
+            case 'start_year_user':
+            case 'start_month_user':
+            case 'start_day_user':
             case 'prefix':
             case 'time':
             case 'start_year':
@@ -198,7 +201,7 @@
 
         $month_result .= smarty_function_html_options(array('output'     => $month_names,
                                                             'values'     => $month_values,
-                                                            'selected'   => $a=$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
+                                                            'selected'   => $start_month_user ? $start_month_user : $a=$time[1] ? strftime($month_value_format, mktime(0, 0, 0, (int)$time[1], 1, 2000)) : '',
                                                             'print_result' => false),
                                                       $smarty);
         $month_result .= '</select>';
@@ -233,7 +236,7 @@
         $day_result .= '>'."\n";
         $day_result .= smarty_function_html_options(array('output'     => $days,
                                                           'values'     => $day_values,
-                                                          'selected'   => $time[2],
+                                                          'selected'   => $start_day_user ? $start_day_user : $time[2],
                                                           'print_result' => false),
                                                     $smarty);
         $day_result .= '</select>';
@@ -279,7 +282,7 @@
             $year_result .= '>'."\n";
             $year_result .= smarty_function_html_options(array('output' => $years,
                                                                'values' => $yearvals,
-                                                               'selected'   => $time[0],
+                                                               'selected'   => $start_year_user ? $start_year_user : $time[0],
                                                                'print_result' => false),
                                                          $smarty);
             $year_result .= '</select>';