diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 19d6a55846..aef44a517f 100644 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -2918,8 +2918,7 @@ class CourseManager { } /** - * Display courses (without special courses) as several HTML divs - * of course categories, as class userportal-catalog-item. + * Display courses (without special courses) as several HTML divs of course categories * @uses display_courses_in_category() to display the courses themselves * @param int user id * @param bool Whether to show the document quick-loader or not @@ -2986,6 +2985,7 @@ class CourseManager { } // Use user's classification for courses (if any). $sql_select_courses .= " ORDER BY course_rel_user.user_course_cat, course_rel_user.sort ASC"; + $result = Database::query($sql_select_courses); $key = 0; $status_icon = ''; diff --git a/main/inc/lib/userportal.lib.php b/main/inc/lib/userportal.lib.php index 579e2044e8..6c95a61554 100644 --- a/main/inc/lib/userportal.lib.php +++ b/main/inc/lib/userportal.lib.php @@ -923,13 +923,14 @@ class IndexManager { } if (!empty($courses_tree)) { - foreach ($courses_tree as $cat => $sessions) { - $courses_tree[$cat]['details'] = SessionManager::get_session_category($cat); - //Get courses - if ($cat == 0) { + foreach ($courses_tree as $cat => $sessions) { + //Getting session categories + $courses_tree[$cat]['details'] = SessionManager::get_session_category($cat); + if ($cat == 0) { $courses_tree[$cat]['courses'] = CourseManager::get_courses_list_by_user_id($user_id, false); } $courses_tree[$cat]['sessions'] = array_flip(array_flip($sessions)); + //Get courses in sessions if (count($courses_tree[$cat]['sessions']) > 0) { foreach ($courses_tree[$cat]['sessions'] as $k => $s_id) { @@ -955,7 +956,7 @@ class IndexManager { // Sessions and courses that are not in a session category. // If we're not in the history view... - if (!isset($_GET['history'])) { // + if (!isset($_GET['history'])) { //Display special courses $html .= CourseManager :: display_special_courses($user_id, $this->load_directories_preview); //Display courses