Commit 10a6e99e authored by Juan Leyva's avatar Juan Leyva
Browse files

MDL-73084 enroll: Return timemodified field in get_users_courses

parent 16a5169a
...@@ -435,6 +435,7 @@ class core_enrol_external extends external_api { ...@@ -435,6 +435,7 @@ class core_enrol_external extends external_api {
'overviewfiles' => $overviewfiles, 'overviewfiles' => $overviewfiles,
'showactivitydates' => $course->showactivitydates, 'showactivitydates' => $course->showactivitydates,
'showcompletionconditions' => $course->showcompletionconditions, 'showcompletionconditions' => $course->showcompletionconditions,
'timemodified' => $course->timemodified,
]; ];
if ($returnusercount) { if ($returnusercount) {
$courseresult['enrolledusercount'] = $enrolledusercount; $courseresult['enrolledusercount'] = $enrolledusercount;
...@@ -483,6 +484,8 @@ class core_enrol_external extends external_api { ...@@ -483,6 +484,8 @@ class core_enrol_external extends external_api {
'overviewfiles' => new external_files('Overview files attached to this course.', VALUE_OPTIONAL), 'overviewfiles' => new external_files('Overview files attached to this course.', VALUE_OPTIONAL),
'showactivitydates' => new external_value(PARAM_BOOL, 'Whether the activity dates are shown or not'), 'showactivitydates' => new external_value(PARAM_BOOL, 'Whether the activity dates are shown or not'),
'showcompletionconditions' => new external_value(PARAM_BOOL, 'Whether the activity completion conditions are shown or not'), 'showcompletionconditions' => new external_value(PARAM_BOOL, 'Whether the activity completion conditions are shown or not'),
'timemodified' => new external_value(PARAM_INT, 'Last time course settings were updated (timestamp).',
VALUE_OPTIONAL),
) )
) )
); );
......
...@@ -546,6 +546,7 @@ class core_enrol_externallib_testcase extends externallib_advanced_testcase { ...@@ -546,6 +546,7 @@ class core_enrol_externallib_testcase extends externallib_advanced_testcase {
$this->assertTrue($courseenrol['hidden']); $this->assertTrue($courseenrol['hidden']);
$this->assertTrue($courseenrol['isfavourite']); $this->assertTrue($courseenrol['isfavourite']);
$this->assertEquals(2, $courseenrol['enrolledusercount']); $this->assertEquals(2, $courseenrol['enrolledusercount']);
$this->assertEquals($course1->timemodified, $courseenrol['timemodified']);
} else { } else {
// Check language pack. Should be empty since an incorrect one was used when creating the course. // Check language pack. Should be empty since an incorrect one was used when creating the course.
$this->assertEmpty($courseenrol['lang']); $this->assertEmpty($courseenrol['lang']);
...@@ -559,6 +560,7 @@ class core_enrol_externallib_testcase extends externallib_advanced_testcase { ...@@ -559,6 +560,7 @@ class core_enrol_externallib_testcase extends externallib_advanced_testcase {
$this->assertFalse($courseenrol['hidden']); $this->assertFalse($courseenrol['hidden']);
$this->assertFalse($courseenrol['isfavourite']); $this->assertFalse($courseenrol['isfavourite']);
$this->assertEquals(1, $courseenrol['enrolledusercount']); $this->assertEquals(1, $courseenrol['enrolledusercount']);
$this->assertEquals($course2->timemodified, $courseenrol['timemodified']);
} }
} }
......
...@@ -5,6 +5,7 @@ information provided here is intended especially for developers. ...@@ -5,6 +5,7 @@ information provided here is intended especially for developers.
* Final deprecation of the following webservice: * Final deprecation of the following webservice:
* core_enrol_edit_user_enrolment * core_enrol_edit_user_enrolment
* External function core_enrol_external::get_users_courses now returns the last time a course was modified (timemodified field)
=== 3.11 === === 3.11 ===
......
Supports Markdown
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