Skip to content

Commit

Permalink
IOMAD: changes to completion overview report
Browse files Browse the repository at this point in the history
  • Loading branch information
turf212 committed Jun 2, 2023
1 parent 592fb14 commit 10c9835
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 12 deletions.
47 changes: 36 additions & 11 deletions local/report_completion_overview/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,17 @@
'email');

foreach ($courses as $courseid) {
$headers[] = $allcompanycourses[$courseid];
$columns[] = "c" . $courseid . "coursename";
if (!$download) {
$headers[] = $allcompanycourses[$courseid];
$columns[] = "c" . $courseid . "coursename";
} else {
$headers[] = get_string('coursestatus', 'local_report_completion_overview', $allcompanycourses[$courseid]);
$columns[] = "c" . $courseid . "coursestatus";
$headers[] = get_string('coursecompletion', 'local_report_completion_overview', $allcompanycourses[$courseid]);
$columns[] = "c" . $courseid . "coursecompletion";
$headers[] = get_string('courseexpiry', 'local_report_completion_overview', $allcompanycourses[$courseid]);
$columns[] = "c" . $courseid . "courseexpiry";
}
}

$sqlparams = array('companyid' => $companyid) + $searchinfo->searchparams;
Expand Down Expand Up @@ -421,6 +430,10 @@
echo $OUTPUT->download_dataformat_selector(get_string('downloadas', 'table'), $baseurl, 'downloadformat', $downloadparams);
}

// Are we showing all detail or not?
$showfulldetails = get_config('local_report_completion_overview', 'showfulldetail');

// Set up the table.
$table = new html_table();
$table->head = $headers;
foreach ($userlist as $user) {
Expand Down Expand Up @@ -480,17 +493,26 @@
$coursesummary['timeexpires'] = date($CFG->iomad_date_format, $usercourse->timeexpires);
}
$coursesummary['finalscore'] = $usercourse->finalscore;
if (!empty($expirecourses[$usercourse->courseid]) && empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary', 'local_report_completion_overview', (object) $coursesummary);
} else if (empty($expirecourses[$usercourse->courseid]) && empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary_noexpiry', 'local_report_completion_overview', (object) $coursesummary);
} else if (!empty($expirecourses[$usercourse->courseid]) && !empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary_nograde', 'local_report_completion_overview', (object) $coursesummary);
} else if (empty($expirecourses[$usercourse->courseid]) && !empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary_nograde_noexpiry', 'local_report_completion_overview', (object) $coursesummary);

// Make the extra info.
if (!$showfulldetails) {
$rowtext = get_string('coursesummary_partial', 'local_report_completion_overview', (object) $coursesummary);
} else {
if (!empty($expirecourses[$usercourse->courseid]) && empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary', 'local_report_completion_overview', (object) $coursesummary);
} else if (empty($expirecourses[$usercourse->courseid]) && empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary_noexpiry', 'local_report_completion_overview', (object) $coursesummary);
} else if (!empty($expirecourses[$usercourse->courseid]) && !empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary_nograde', 'local_report_completion_overview', (object) $coursesummary);
} else if (empty($expirecourses[$usercourse->courseid]) && !empty($gradelesscourses[$usercourse->courseid])) {
$rowtext = get_string('coursesummary_nograde_noexpiry', 'local_report_completion_overview', (object) $coursesummary);
}
}

// Set up the cell classes.
if (empty($expirecourses[$usercourse->courseid])) {
$rowclass = "ignored";
$statustext = "";
} else {
if (empty($usercourse->timeenrolled)) {
$rowclass = "notenrolled";
Expand All @@ -507,10 +529,13 @@
if (!empty($usercourse->timeenrolled) && !empty($usercourse->timecompleted) && $usercourse->timeexpires < $runtime) {
$rowclass = "expired";
}
$statustext = get_string($rowclass, 'local_report_completion_overview');
}

if ($download) {
$row[] = $rowtext;
$row[] = $statustext;
$row[] = $coursesummary['timecompleted'];
$row[] = $coursesummary['timeexpires'];
} else if (!$showtext) {
$row[] = "<div class='completion_overview_icon' title='$rowtext'><span class='dot $rowclass'></span></div>";
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
$string['showexpiry'] = 'Highlight all';
$string['showexpiryonly'] = 'Highlight course with valid length only';
$string['showexpiryonly_help'] = 'If this option is checked then courses which do not have a validlength will not be displayed in colour in the graphical overview by default';
$string['showfulldetail'] = 'Show full completion detail';
$string['showfulldetail_help'] = 'If this option is checked then all of the completion information is displayed otherwise it\'s just the completion and expiry dates';
$string['warningduration'] = 'Expired warning limit';
$string['warningduration_help'] = 'This is the value of time before a course expires where the report will show the expiry warning colours instead of the OK colours.';
$string['coursesummary'] = 'Enrolled: {$a->enrolled}
Expand All @@ -54,4 +56,14 @@
Started: {$a->timestarted}
Completed: {$a->timecompleted}
Result: Passed';
$string['coursesummary_partial'] = 'Completed: {$a->timecompleted}
Expires: {$a->timeexpires}';
$string['report_completion_overview_title'] = 'Completion overview report';
$string['notcompleted'] = 'In progress';
$string['notenrolled'] = 'Not enrolled';
$string['indate'] = 'OK';
$string['expiring'] = 'Due';
$string['expired'] = 'Expired';
$string['coursestatus'] = '{$a} status';
$string['coursecompletion'] = '{$a} completion';
$string['courseexpiry'] = '{$a} expiry';
7 changes: 7 additions & 0 deletions local/report_completion_overview/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
30*24*60*60)
);

$settings->add(new admin_setting_configcheckbox(
'local_report_completion_overview/showfulldetail',
get_string('showfulldetail', 'local_report_completion_overview'),
get_string('showfulldetail_help', 'local_report_completion_overview'),
true)
);

$settings->add(new admin_setting_configcheckbox(
'local_report_completion_overview/showexpiryonly',
get_string('showexpiryonly', 'local_report_completion_overview'),
Expand Down
2 changes: 1 addition & 1 deletion local/report_completion_overview/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
*/

$plugin->release = '4.1.2 (Build: 20230313)'; // Human-friendly version name
$plugin->version = 2023050300;
$plugin->version = 2023060200;
$plugin->requires = 2019052000;
$plugin->component = 'local_report_completion_overview';

0 comments on commit 10c9835

Please sign in to comment.