mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-58659 enroll: Add start and end date fields required by overview
Those fields are required to display the courses overview for final users.
This commit is contained in:
parent
ef83fc2a33
commit
01c26702d3
@ -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, category');
|
||||
summary, summaryformat, format, showgrades, lang, enablecompletion, category, startdate, enddate');
|
||||
$result = array();
|
||||
|
||||
foreach ($courses as $course) {
|
||||
@ -346,6 +346,8 @@ class core_enrol_external extends external_api {
|
||||
'enablecompletion' => $course->enablecompletion,
|
||||
'category' => $course->category,
|
||||
'progress' => $progress,
|
||||
'startdate' => $course->startdate,
|
||||
'enddate' => $course->enddate,
|
||||
);
|
||||
}
|
||||
|
||||
@ -376,6 +378,8 @@ class core_enrol_external extends external_api {
|
||||
VALUE_OPTIONAL),
|
||||
'category' => new external_value(PARAM_INT, 'course category id', VALUE_OPTIONAL),
|
||||
'progress' => new external_value(PARAM_FLOAT, 'Progress percentage', VALUE_OPTIONAL),
|
||||
'startdate' => new external_value(PARAM_INT, 'Timestamp when the course start', VALUE_OPTIONAL),
|
||||
'enddate' => new external_value(PARAM_INT, 'Timestamp when the course end', VALUE_OPTIONAL),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -363,6 +363,7 @@ class core_enrol_externallib_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
$timenow = time();
|
||||
$coursedata1 = array(
|
||||
'fullname' => '<b>Course 1</b>', // Adding tags here to check that external_format_string works.
|
||||
'shortname' => '<b>Course 1</b>', // Adding tags here to check that external_format_string works.
|
||||
@ -370,7 +371,9 @@ class core_enrol_externallib_testcase extends externallib_advanced_testcase {
|
||||
'summaryformat' => FORMAT_MOODLE,
|
||||
'lang' => 'en',
|
||||
'enablecompletion' => true,
|
||||
'showgrades' => true
|
||||
'showgrades' => true,
|
||||
'startdate' => $timenow,
|
||||
'enddate' => $timenow + WEEKSECS
|
||||
);
|
||||
|
||||
$course1 = self::getDataGenerator()->create_course($coursedata1);
|
||||
|
@ -1,6 +1,10 @@
|
||||
This files describes API changes in /enrol/* - plugins,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.3 ===
|
||||
|
||||
* External function core_enrol_external::get_users_courses now return the user progress, start and the end course dates.
|
||||
|
||||
=== 3.2 ===
|
||||
|
||||
* External function core_enrol_external::get_users_courses now return the category id as an additional optional field.
|
||||
|
Loading…
x
Reference in New Issue
Block a user