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:
co-authored by
Ray Morris
parent
e77452220b
commit
d2a563e79b
@@ -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 = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user