diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index 7479e25f0d..8162b2122e 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -127,14 +127,21 @@ if ($is_allowed_to_edit) { $token = Security::get_token(); $categoriesTempList = learnpath::getCategories($courseId); -if ($allowCategory && empty($sessionId)) { +$firstSessionCategoryId = 0; +if ($allowCategory) { $newCategoryFiltered = []; foreach ($categoriesTempList as $category) { $categorySessionId = (int) learnpath::getCategorySessionId($category->getId()); - if (empty($categorySessionId)) { + if ($categorySessionId === $sessionId || $categorySessionId === 0) { $newCategoryFiltered[] = $category; + } else { + + } + if (!empty($sessionId) && empty($firstSessionCategoryId) && $categorySessionId == $sessionId) { + $firstSessionCategoryId = $category->getId(); } } + $categoriesTempList = $newCategoryFiltered; } @@ -1008,6 +1015,7 @@ if ($ending && $allLpTimeValid && api_get_configuration_value('download_files_af } $template = new Template($nameTools); +$template->assign('first_session_category', $firstSessionCategoryId); $template->assign('session_star_icon', Display::return_icon('star.png', get_lang('Session'))); $template->assign('subscription_settings', $subscriptionSettings); $template->assign('is_allowed_to_edit', $is_allowed_to_edit); diff --git a/main/template/default/learnpath/list.tpl b/main/template/default/learnpath/list.tpl index 513a6898bc..61f1c91a56 100644 --- a/main/template/default/learnpath/list.tpl +++ b/main/template/default/learnpath/list.tpl @@ -42,8 +42,8 @@ {% endif %} - {% if not _c.session_id %} - {% if loop.index0 == 1 %} + {% if lp_data.category.sessionId == _c.session_id %} + {% if loop.index0 == 1 or first_session_category == lp_data.category.id %} {{