Skip to content

Commit

Permalink
MDL-42060 block_course_list: fixed sorting of mycourses
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Hemelryk committed Nov 17, 2013
1 parent b58bc15 commit 19b13d5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion blocks/course_list/block_course_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ function get_content() {

if (empty($CFG->disablemycourses) and isloggedin() and !isguestuser() and
!(has_capability('moodle/course:update', context_system::instance()) and $adminseesall)) { // Just print My Courses
if ($courses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) {
// As this is producing navigation sort order should default to $CFG->navsortmycoursessort instead
// of using the default.
if (!empty($CFG->navsortmycoursessort)) {
$sortorder = 'visible DESC, ' . $CFG->navsortmycoursessort . ' ASC';
} else {
$sortorder = 'visible DESC, sortorder ASC';
}
if ($courses = enrol_get_my_courses(NULL, $sortorder)) {
foreach ($courses as $course) {
$coursecontext = context_course::instance($course->id);
$linkcss = $course->visible ? "" : " class=\"dimmed\" ";
Expand Down

0 comments on commit 19b13d5

Please sign in to comment.