git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/extensions/wrreport@314
7aebc617-e5e2-0310-91dc-
80fb5f6d2477
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_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_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;