Browse code

Neue Funktion zur Anzeige eines Datum-Auswahlfelds

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2208 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on25/02/2012 15:16:43
Showing1 changed files
... ...
@@ -323,5 +323,27 @@ function html_select($name, $options, $default='', $free='')
323 323
 }
324 324
 
325 325
 
326
+function html_datepicker($nameprefix, $timestamp)
327
+{
328
+  $valid_days = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
329
+                       6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
330
+                      11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15,
331
+                      16 => 16, 17 => 17, 18 => 18, 19 => 19, 20 => 20,
332
+                      21 => 21, 22 => 22, 23 => 23, 24 => 24, 25 => 25,
333
+                      26 => 26, 27 => 27, 28 => 28, 29 => 29, 30 => 30,
334
+                      31 => 31);
335
+  $valid_months = array( 1 =>  1,  2 =>  2,  3 =>  3,  4 =>  4,  5 =>  5,
336
+                         6 =>  6,  7 =>  7,  8 =>  8,  9 =>  9, 10 => 10,
337
+                        11 => 11, 12 => 12);
338
+  $selected_day = date('d', $timestamp);
339
+  $selected_month = date('m', $timestamp);
340
+  $selected_year = date('Y', $timestamp);
341
+  $ret = '';
342
+  $ret .= html_select($nameprefix.'_day', $valid_days, $selected_day, 'style="text-align: right;"').". ";
343
+  $ret .= html_select($nameprefix.'_month', $valid_months, $selected_month, 'style="text-align: right;"').". ";
344
+  $ret .= '<input type="text" name="'.$nameprefix.'_year" value="'.$selected_year.'" size="5" />';
345
+  return $ret;
346
+}
347
+
326 348
 
327 349
 ?>