Fix lp session category actions BT#17196

pull/3254/head^2
Julio Montoya 6 years ago
parent 8dda3b96e5
commit 64fe0186ba
  1. 12
      main/lp/lp_list.php
  2. 4
      main/template/default/learnpath/list.tpl

@ -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);

@ -42,8 +42,8 @@
</a>
{% 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 %}
<a href="#">
<img src="{{ "up_na.png"|icon }}" alt="{{ "Move"|get_lang }}">
</a>

Loading…
Cancel
Save