Skip to content

Commit

Permalink
MDL-71007 grade_report: Add course idnumber to grade report api
Browse files Browse the repository at this point in the history
The gradereport_user_get_grade_items now includes the idnumber
  • Loading branch information
brendanheywood committed Mar 4, 2021
1 parent 95dd305 commit 5e1e3b3
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions grade/report/user/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ protected static function get_report_data($course, $context, $user, $userid, $gr

$gpr = new grade_plugin_return(
array(
'type' => 'report',
'plugin' => 'user',
'courseid' => $course->id,
'userid' => $userid)
'type' => 'report',
'plugin' => 'user',
'courseid' => $course->id,
'courseidnumber' => $course->idnumber,
'userid' => $userid)
);

$reportdata = array();
Expand All @@ -162,11 +163,12 @@ protected static function get_report_data($course, $context, $user, $userid, $gr
$report->fill_table();

$gradeuserdata = array(
'courseid' => $course->id,
'userid' => $user->id,
'userfullname' => fullname($user),
'useridnumber' => $user->idnumber,
'maxdepth' => $report->maxdepth,
'courseid' => $course->id,
'courseidnumber' => $course->idnumber,
'userid' => $user->id,
'userfullname' => fullname($user),
'useridnumber' => $user->idnumber,
'maxdepth' => $report->maxdepth,
);
if ($tabledata) {
$gradeuserdata['tabledata'] = $report->tabledata;
Expand All @@ -189,11 +191,12 @@ protected static function get_report_data($course, $context, $user, $userid, $gr
$report->fill_table();

$gradeuserdata = array(
'courseid' => $course->id,
'userid' => $currentuser->id,
'userfullname' => fullname($currentuser),
'useridnumber' => $currentuser->idnumber,
'maxdepth' => $report->maxdepth,
'courseid' => $course->id,
'courseidnumber' => $course->idnumber,
'userid' => $currentuser->id,
'userfullname' => fullname($currentuser),
'useridnumber' => $currentuser->idnumber,
'maxdepth' => $report->maxdepth,
);
if ($tabledata) {
$gradeuserdata['tabledata'] = $report->tabledata;
Expand Down Expand Up @@ -478,6 +481,7 @@ public static function get_grade_items_returns() {
new external_single_structure(
array(
'courseid' => new external_value(PARAM_INT, 'course id'),
'courseidnumber' => new external_value(PARAM_TEXT, 'course idnumber'),
'userid' => new external_value(PARAM_INT, 'user id'),
'userfullname' => new external_value(PARAM_TEXT, 'user fullname'),
'useridnumber' => new external_value(PARAM_TEXT, 'user idnumber'),
Expand Down

0 comments on commit 5e1e3b3

Please sign in to comment.