diff --git a/main/inc/lib/course_home.lib.php b/main/inc/lib/course_home.lib.php index 9f60da1427..3de73c380e 100755 --- a/main/inc/lib/course_home.lib.php +++ b/main/inc/lib/course_home.lib.php @@ -97,19 +97,19 @@ class CourseHome { } foreach ($all_tools as & $tool) { - - if ($tool['image'] == 'scormbuilder.gif') { + + if ($tool['image'] == 'scormbuilder.gif') { // display links to lp only for current session if (api_get_session_id() != $tool['session_id']) { continue; - } + } // check if the published learnpath is visible for student $published_lp_id = self::get_published_lp_id_from_link($tool['link']); if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id,api_get_user_id())) { continue; } } - + if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) { continue; } @@ -297,19 +297,19 @@ class CourseHome { if (isset($all_tools_list)) { $lnk = array(); foreach ($all_tools_list as & $tool) { - - if ($tool['image'] == 'scormbuilder.gif') { + + if ($tool['image'] == 'scormbuilder.gif') { // display links to lp only for current session if (api_get_session_id() != $tool['session_id']) { continue; - } + } // check if the published learnpath is visible for student $published_lp_id = self::get_published_lp_id_from_link($tool['link']); if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id,api_get_user_id())) { continue; - } + } } - + if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) { continue; } @@ -573,32 +573,32 @@ class CourseHome { } return $all_tools_list; } - + /** * Displays the tools of a certain category. * @param array List of tools as returned by get_tools_category() * @return void */ - public static function show_tools_category($all_tools_list, $theme = 'activity') { - - if ($theme == 'vertical_activity') { + global $_user; + if ($theme == 'vertical_activity') { //ordering by get_lang name $order_tool_list = array(); - foreach($all_tools_list as $key=>$new_tool) { - $tool_name = self::translate_tool_name($new_tool); - $order_tool_list [$key]= $tool_name; - } - natsort($order_tool_list); - $my_temp_tool_array = array(); - foreach($order_tool_list as $key=>$new_tool) { - $my_temp_tool_array[] = $all_tools_list[$key]; + if (is_array($all_tools_list) && count($all_tools_list)>0) { + foreach($all_tools_list as $key=>$new_tool) { + $tool_name = self::translate_tool_name($new_tool); + $order_tool_list [$key]= $tool_name; + } + natsort($order_tool_list); + $my_temp_tool_array = array(); + foreach($order_tool_list as $key=>$new_tool) { + $my_temp_tool_array[] = $all_tools_list[$key]; + } + $all_tools_list = $my_temp_tool_array; + } else { + $all_tools_list = array(); } - $all_tools_list = $my_temp_tool_array; } - - - global $_user; $web_code_path = api_get_path(WEB_CODE_PATH); $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); @@ -609,19 +609,19 @@ class CourseHome { $lnk = ''; if ($theme == 'vertical_activity') echo '