Checked the date usage and translated some variables.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 7 Nov 2008 18:04:45 +0000 (18:04 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Fri, 7 Nov 2008 18:04:45 +0000 (18:04 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/extensions/wrreport@314 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrreport.body.php

index 7a8a5b30119ce6b58b39748cc4c9d65e6d2f8068..06461cb419e7270385f3139cd7c5d609f1c83173 100644 (file)
@@ -63,20 +63,19 @@ function wrReportAfterTidy(&$parser, &$text) {
 function wrReportFormRender($hide_save_button = TRUE, $page_title = NULL, $date_report = NULL, $condition = NULL, $description = NULL, $author_name = NULL, $page_title_list = NULL) {
        if ($page_title) $page_title = htmlspecialchars($page_title);
        // Date options
 function wrReportFormRender($hide_save_button = TRUE, $page_title = NULL, $date_report = NULL, $condition = NULL, $description = NULL, $author_name = NULL, $page_title_list = NULL) {
        if ($page_title) $page_title = htmlspecialchars($page_title);
        // Date options
-       $tagnamen = array('Heute', 'Gestern', 'Vorgestern', 'Vor 3 Tagen', 'Vor 4 Tagen');
+       $daynames = array('Heute', 'Gestern', 'Vorgestern', 'Vor 3 Tagen', 'Vor 4 Tagen');
        $date_options = '';
        $date_options = '';
-       $date_selected = FALSE;
-       for ($tag=0; $tag!=5; ++$tag) {
-               $datum = time() - $tag*24*60*60;
-               $datum_f = strftime("%Y-%m-%d", $datum);
-               $date_options .= '<option value="' . $datum_f . '"';
-               // var_dump($date_report);
-               // var_dump($datum_f);
-               if ((is_null($date_report) && $tag == 0) || (!is_null($date_report) && $date_report == $datum_f)) {
+       $date_selected = false;
+       $time = time(); // number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
+       for ($day=0; $day!=5; ++$day) {
+               $date = strtotime("-$day days", $time);
+               $date_f = strftime("%Y-%m-%d", $date); // Formats it according to locale, that is set to CET.
+               $date_options .= '<option value="' . $date_f . '"';
+               if ((is_null($date_report) && $day == 0) || (!is_null($date_report) && $date_report == $date_f)) {
                        $date_options .= ' selected="selected"';
                        $date_options .= ' selected="selected"';
-                       $date_selected = TRUE;
+                       $date_selected = true;
                }
                }
-               $date_options .= '>' . htmlspecialchars($tagnamen[$tag]) . ' (' . strftime('%d.%m.', $datum) . ')</option>' . "\n";
+               $date_options .= '>' . htmlspecialchars($daynames[$day]) . ' (' . strftime('%d.%m.', $date) . ')</option>' . "\n";
        }
        if (!$date_selected) {
                $date_options = '<option value="' . $date_report . '" selected="selected">' . htmlspecialchars($date_report) . "</option>\n" . $date_options;
        }
        if (!$date_selected) {
                $date_options = '<option value="' . $date_report . '" selected="selected">' . htmlspecialchars($date_report) . "</option>\n" . $date_options;