MDL-57636 frontpage: Fix display enrolled courses

This commit is contained in:
David Bogner
2019-01-04 10:56:24 +01:00
parent 79d87ad683
commit 98125d376a
+8 -2
View File
@@ -188,7 +188,8 @@ if (isloggedin() and !isguestuser() and isset($CFG->frontpageloggedin)) {
$frontpagelayout = $CFG->frontpage;
}
foreach (explode(',', $frontpagelayout) as $v) {
$frontpageoptions = explode(',', $frontpagelayout);
foreach ($frontpageoptions as $v) {
switch ($v) {
// Display the main part of the front page.
case FRONTPAGENEWS:
@@ -256,8 +257,13 @@ foreach (explode(',', $frontpagelayout) as $v) {
echo html_writer::tag('span', '', array('class' => 'skip-block-to', 'id' => 'skipmycourses'));
break;
} else {
// Temp fix/fallback in order to display available courses when enrolled courses should be shown,
// but user is not enrolled in any course.
if (array_search(FRONTPAGEALLCOURSELIST, $frontpageoptions)) {
break;
}
}
// No "break" here. If there are no enrolled courses - continue to 'Available courses'.
case FRONTPAGEALLCOURSELIST:
$availablecourseshtml = $courserenderer->frontpage_available_courses();