Commit 27c7ed0b authored by Juan Leyva's avatar Juan Leyva
Browse files

MDL-54800 core_enrol: Return category id in WS get_users_courses

parent a0a63678
......@@ -300,7 +300,7 @@ class core_enrol_external extends external_api {
$params = self::validate_parameters(self::get_users_courses_parameters(), array('userid'=>$userid));
$courses = enrol_get_users_courses($params['userid'], true, 'id, shortname, fullname, idnumber, visible,
summary, summaryformat, format, showgrades, lang, enablecompletion');
summary, summaryformat, format, showgrades, lang, enablecompletion, category');
$result = array();
foreach ($courses as $course) {
......@@ -324,11 +324,21 @@ class core_enrol_external extends external_api {
list($course->summary, $course->summaryformat) =
external_format_text($course->summary, $course->summaryformat, $context->id, 'course', 'summary', null);
$result[] = array('id' => $course->id, 'shortname' => $course->shortname, 'fullname' => $course->fullname,
'idnumber' => $course->idnumber, 'visible' => $course->visible, 'enrolledusercount' => $enrolledusercount,
'summary' => $course->summary, 'summaryformat' => $course->summaryformat, 'format' => $course->format,
'showgrades' => $course->showgrades, 'lang' => $course->lang, 'enablecompletion' => $course->enablecompletion
);
$result[] = array(
'id' => $course->id,
'shortname' => $course->shortname,
'fullname' => $course->fullname,
'idnumber' => $course->idnumber,
'visible' => $course->visible,
'enrolledusercount' => $enrolledusercount,
'summary' => $course->summary,
'summaryformat' => $course->summaryformat,
'format' => $course->format,
'showgrades' => $course->showgrades,
'lang' => $course->lang,
'enablecompletion' => $course->enablecompletion,
'category' => $course->category
);
}
return $result;
......@@ -355,7 +365,8 @@ class core_enrol_external extends external_api {
'showgrades' => new external_value(PARAM_BOOL, 'true if grades are shown, otherwise false', VALUE_OPTIONAL),
'lang' => new external_value(PARAM_LANG, 'forced course language', VALUE_OPTIONAL),
'enablecompletion' => new external_value(PARAM_BOOL, 'true if completion is enabled, otherwise false',
VALUE_OPTIONAL)
VALUE_OPTIONAL),
'category' => new external_value(PARAM_INT, 'course category id', VALUE_OPTIONAL),
)
)
);
......
This files describes API changes in /enrol/* - plugins,
information provided here is intended especially for developers.
=== 3.2 ===
* External function core_enrol_external::get_users_courses now return the category id as an additional optional field.
=== 3.1 ===
* core_enrol_external::get_enrolled_users now supports two additional parameters for ordering: sortby and sortdirection.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment