Skip to content

Commit

Permalink
MDL-55229 course: Handle invisible course categories
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Aug 10, 2016
1 parent 56394c8 commit 369856e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions course/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2235,8 +2235,8 @@ public static function search_courses($criterianame,
$coursecontext = context_course::instance($course->id);

// Category information.
if (!isset($categoriescache[$course->category])) {
$categoriescache[$course->category] = coursecat::get($course->category);
if (!array_key_exists($course->category, $categoriescache)) {
$categoriescache[$course->category] = coursecat::get($course->category, IGNORE_MISSING);
}
$category = $categoriescache[$course->category];

Expand Down Expand Up @@ -2281,7 +2281,7 @@ public static function search_courses($criterianame,
$coursereturns['displayname'] = external_format_string($displayname, $coursecontext->id);
$coursereturns['shortname'] = external_format_string($course->shortname, $coursecontext->id);
$coursereturns['categoryid'] = $course->category;
$coursereturns['categoryname'] = $category->name;
$coursereturns['categoryname'] = $category == null ? '' : $category->name;
$coursereturns['summary'] = $summary;
$coursereturns['summaryformat'] = $summaryformat;
$coursereturns['overviewfiles'] = $files;
Expand Down

0 comments on commit 369856e

Please sign in to comment.