LP: Allow to create a LP in a session inside a base course category

The config "allow_session_lp_category" is required.

BT#18132
pull/3766/head^2
Julio Montoya 5 years ago
parent 3ffbf5dbca
commit fe2b1d0eff
  1. 8
      main/lp/learnpath.class.php
  2. 1
      main/lp/lp_add.php

@ -12454,21 +12454,21 @@ EOD;
$cats = [get_lang('SelectACategory')]; $cats = [get_lang('SelectACategory')];
} }
$checkSession = false; /*$checkSession = false;
$sessionId = api_get_session_id(); $sessionId = api_get_session_id();
if (api_get_configuration_value('allow_session_lp_category')) { if (api_get_configuration_value('allow_session_lp_category')) {
$checkSession = true; $checkSession = true;
} }*/
if (!empty($items)) { if (!empty($items)) {
foreach ($items as $cat) { foreach ($items as $cat) {
$categoryId = $cat->getId(); $categoryId = $cat->getId();
if ($checkSession) { /*if ($checkSession) {
$inSession = self::getCategorySessionId($categoryId); $inSession = self::getCategorySessionId($categoryId);
if ($inSession != $sessionId) { if ($inSession != $sessionId) {
continue; continue;
} }
} }*/
$cats[$categoryId] = $cat->getName(); $cats[$categoryId] = $cat->getName();
} }
} }

@ -36,6 +36,7 @@ function activate_end_date() {
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$isStudentView = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null; $isStudentView = isset($_REQUEST['isStudentView']) ? $_REQUEST['isStudentView'] : null;
$learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null; $learnpath_id = isset($_REQUEST['lp_id']) ? $_REQUEST['lp_id'] : null;
$sessionId = api_get_session_id();
if (!$is_allowed_to_edit || $isStudentView) { if (!$is_allowed_to_edit || $isStudentView) {
header('location:lp_controller.php?action=view&lp_id='.$learnpath_id.'&'.api_get_cidreq()); header('location:lp_controller.php?action=view&lp_id='.$learnpath_id.'&'.api_get_cidreq());

Loading…
Cancel
Save