mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
Merge branch 'MDL-58659-master' of git://github.com/jleyva/moodle
This commit is contained in:
commit
4c7dc6af94
@ -2398,6 +2398,7 @@ class core_course_external extends external_api {
|
||||
'showgrades' => new external_value(PARAM_INT, '1 if grades are shown, otherwise 0', VALUE_OPTIONAL),
|
||||
'newsitems' => new external_value(PARAM_INT, 'Number of recent items appearing on the course page', 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),
|
||||
'maxbytes' => new external_value(PARAM_INT, 'Largest size of file that can be uploaded into', VALUE_OPTIONAL),
|
||||
'showreports' => new external_value(PARAM_INT, 'Are activity report shown (yes = 1, no =0)', VALUE_OPTIONAL),
|
||||
'visible' => new external_value(PARAM_INT, '1: available to student, 0:not available', VALUE_OPTIONAL),
|
||||
@ -3025,7 +3026,7 @@ class core_course_external extends external_api {
|
||||
continue;
|
||||
}
|
||||
// Return information for any user that can access the course.
|
||||
$coursefields = array('format', 'showgrades', 'newsitems', 'startdate', 'maxbytes', 'showreports', 'visible',
|
||||
$coursefields = array('format', 'showgrades', 'newsitems', 'startdate', 'enddate', 'maxbytes', 'showreports', 'visible',
|
||||
'groupmode', 'groupmodeforce', 'defaultgroupingid', 'enablecompletion', 'completionnotify', 'lang', 'theme',
|
||||
'marker');
|
||||
|
||||
|
@ -2003,16 +2003,16 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
$result = external_api::clean_returnvalue(core_course_external::get_courses_by_field_returns(), $result);
|
||||
$this->assertCount(3, $result['courses']);
|
||||
// Expect to receive all the fields.
|
||||
$this->assertCount(36, $result['courses'][0]);
|
||||
$this->assertCount(36, $result['courses'][1]);
|
||||
$this->assertCount(36, $result['courses'][2]);
|
||||
$this->assertCount(37, $result['courses'][0]);
|
||||
$this->assertCount(37, $result['courses'][1]);
|
||||
$this->assertCount(37, $result['courses'][2]);
|
||||
|
||||
$result = core_course_external::get_courses_by_field('id', $course1->id);
|
||||
$result = external_api::clean_returnvalue(core_course_external::get_courses_by_field_returns(), $result);
|
||||
$this->assertCount(1, $result['courses']);
|
||||
$this->assertEquals($course1->id, $result['courses'][0]['id']);
|
||||
// Expect to receive all the fields.
|
||||
$this->assertCount(36, $result['courses'][0]);
|
||||
$this->assertCount(37, $result['courses'][0]);
|
||||
|
||||
$result = core_course_external::get_courses_by_field('id', $course2->id);
|
||||
$result = external_api::clean_returnvalue(core_course_external::get_courses_by_field_returns(), $result);
|
||||
@ -2054,15 +2054,15 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
$result = core_course_external::get_courses_by_field();
|
||||
$result = external_api::clean_returnvalue(core_course_external::get_courses_by_field_returns(), $result);
|
||||
$this->assertCount(2, $result['courses']);
|
||||
$this->assertCount(29, $result['courses'][0]);
|
||||
$this->assertCount(29, $result['courses'][1]);
|
||||
$this->assertCount(30, $result['courses'][0]);
|
||||
$this->assertCount(30, $result['courses'][1]);
|
||||
|
||||
$result = core_course_external::get_courses_by_field('id', $course1->id);
|
||||
$result = external_api::clean_returnvalue(core_course_external::get_courses_by_field_returns(), $result);
|
||||
$this->assertCount(1, $result['courses']);
|
||||
$this->assertEquals($course1->id, $result['courses'][0]['id']);
|
||||
// Expect to receive all the files that a student can see.
|
||||
$this->assertCount(29, $result['courses'][0]);
|
||||
$this->assertCount(30, $result['courses'][0]);
|
||||
|
||||
// Check default filters.
|
||||
$filters = $result['courses'][0]['filters'];
|
||||
@ -2107,7 +2107,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
|
||||
$result = core_course_external::get_courses_by_field();
|
||||
$result = external_api::clean_returnvalue(core_course_external::get_courses_by_field_returns(), $result);
|
||||
$this->assertCount(2, $result['courses']);
|
||||
$this->assertCount(29, $result['courses'][0]); // Site course.
|
||||
$this->assertCount(30, $result['courses'][0]); // Site course.
|
||||
$this->assertCount(13, $result['courses'][1]); // Only public information, not enrolled.
|
||||
|
||||
$result = core_course_external::get_courses_by_field('id', $course1->id);
|
||||
|
@ -4,6 +4,7 @@ information provided here is intended especially for developers.
|
||||
=== 3.3 ===
|
||||
|
||||
* External function core_course_external::get_courses_by_field now returns the course filters list and status.
|
||||
* External function core_course_external::get_courses_by_field now returns the end date of the course.
|
||||
* External function core_course_external::get_course_contents now return the following additional file fields:
|
||||
- mimetype (the file mime type)
|
||||
- isexternalfile (if is a file reference to a external repository)
|
||||
|
@ -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