MDL-45452 report_completion: Excel date format

When using either of the CSV download links (spreadsheet format or Excel-
compatible format) use an Excel-compatible format for date/times.

Co-Authored-By: Ray Morris <[email protected]>
This commit is contained in:
Leon Stringer
2023-07-21 15:03:48 +01:00
co-authored by Ray Morris
parent e77452220b
commit d2a563e79b
+8 -3
View File
@@ -56,6 +56,11 @@ $PAGE->set_pagelayout('report');
$firstnamesort = ($sort == 'firstname');
$excel = ($format == 'excelcsv');
$csv = ($format == 'csv' || $excel);
if ($csv) {
$dateformat = "%F %T";
} else {
$dateformat = get_string('strftimedatetimeshort', 'langconfig');
}
// Load CSV library
if ($csv) {
@@ -592,7 +597,7 @@ foreach ($progress as $user) {
$state = COMPLETION_INCOMPLETE;
}
if ($is_complete) {
$date = userdate($criteria_completion->timecompleted, get_string('strftimedatetimeshort', 'langconfig'));
$date = userdate($criteria_completion->timecompleted, $dateformat);
} else {
$date = '';
}
@@ -640,7 +645,7 @@ foreach ($progress as $user) {
$a->state = $describe;
if ($is_complete) {
$a->date = userdate($criteria_completion->timecompleted, get_string('strftimedatetimeshort', 'langconfig'));
$a->date = userdate($criteria_completion->timecompleted, $dateformat);
} else {
$a->date = '';
}
@@ -694,7 +699,7 @@ foreach ($progress as $user) {
$a = new StdClass;
if ($ccompletion->is_complete()) {
$a->date = userdate($ccompletion->timecompleted, get_string('strftimedatetimeshort', 'langconfig'));
$a->date = userdate($ccompletion->timecompleted, $dateformat);
} else {
$a->date = '';
}