Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moodle
moodle
Commits
27c7ed0b
Commit
27c7ed0b
authored
Jun 15, 2016
by
Juan Leyva
Browse files
MDL-54800 core_enrol: Return category id in WS get_users_courses
parent
a0a63678
Changes
2
Show whitespace changes
Inline
Side-by-side
enrol/externallib.php
View file @
27c7ed0b
...
...
@@ -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,10 +324,20 @@ 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
);
}
...
...
@@ -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
),
)
)
);
...
...
enrol/upgrade.txt
View file @
27c7ed0b
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.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment