Skip to content

Commit

Permalink
Merge branch 'MDL-57990-32' of git://github.com/crazyserver/moodle in…
Browse files Browse the repository at this point in the history
…to MOODLE_32_STABLE
  • Loading branch information
danpoltawski committed Mar 7, 2017
2 parents 63464df + fa60a11 commit 73fd6f2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion course/externallib.php
Expand Up @@ -2241,6 +2241,7 @@ protected static function get_course_public_information(course_in_list $course,
$coursereturns['overviewfiles'] = $files;
$coursereturns['contacts'] = $coursecontacts;
$coursereturns['enrollmentmethods'] = $enroltypes;
$coursereturns['sortorder'] = $course->sortorder;
return $coursereturns;
}

Expand Down Expand Up @@ -2983,7 +2984,7 @@ public static function get_courses_by_field($field = '', $value = '') {
// Return information for any user that can access the course.
$coursefields = array('format', 'showgrades', 'newsitems', 'startdate', 'maxbytes', 'showreports', 'visible',
'groupmode', 'groupmodeforce', 'defaultgroupingid', 'enablecompletion', 'completionnotify', 'lang', 'theme',
'sortorder', 'marker');
'marker');

// Information for managers only.
if ($canupdatecourse) {
Expand Down
4 changes: 2 additions & 2 deletions course/tests/externallib_test.php
Expand Up @@ -2063,14 +2063,14 @@ public function test_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(28, $result['courses'][0]); // Site course.
$this->assertCount(12, $result['courses'][1]); // Only public information, not enrolled.
$this->assertCount(13, $result['courses'][1]); // Only public information, not enrolled.

$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 authenticated can see.
$this->assertCount(12, $result['courses'][0]);
$this->assertCount(13, $result['courses'][0]);

// Course 2 is not visible.
$result = core_course_external::get_courses_by_field('id', $course2->id);
Expand Down

0 comments on commit 73fd6f2

Please sign in to comment.