Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
+67 -9
View File
@@ -395,10 +395,11 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $
}
break;
case 3:
/*
$oLP = new aicc(api_get_course_id(), $lpIid, api_get_user_id());
if ($oLP !== false) {
$lp_found = true;
}
}*/
break;
default:
$oLP = new learnpath(api_get_course_id(), $lpIid, api_get_user_id());
@@ -600,19 +601,19 @@ switch ($action) {
require 'lp_add_item.php';
} else {
Session::write('post_time', $_POST['post_time']);
$directoryParentId = isset($_POST['directory_parent_id']) ? $_POST['directory_parent_id'] : 0;
$directoryParentId = $_POST['directory_parent_id'] ?? 0;
$courseInfo = api_get_course_info();
if (empty($directoryParentId)) {
$_SESSION['oLP']->generate_lp_folder($courseInfo);
}
$parent = isset($_POST['parent']) ? $_POST['parent'] : '';
$previous = isset($_POST['previous']) ? $_POST['previous'] : '';
$type = isset($_POST['type']) ? $_POST['type'] : '';
$path = isset($_POST['path']) ? $_POST['path'] : '';
$description = isset($_POST['description']) ? $_POST['description'] : '';
$prerequisites = isset($_POST['prerequisites']) ? $_POST['prerequisites'] : '';
$maxTimeAllowed = isset($_POST['maxTimeAllowed']) ? $_POST['maxTimeAllowed'] : '';
$parent = $_POST['parent'] ?? '';
$previous = $_POST['previous'] ?? '';
$type = $_POST['type'] ?? '';
$path = $_POST['path'] ?? '';
$description = $_POST['description'] ?? '';
$prerequisites = $_POST['prerequisites'] ?? '';
$maxTimeAllowed = $_POST['maxTimeAllowed'] ?? '';
if ($_POST['type'] == TOOL_DOCUMENT) {
@@ -1238,6 +1239,63 @@ switch ($action) {
require 'lp_list.php';
}
break;
case 'reorder_categories':
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed(true);
}
$courseId = api_get_course_int_id();
$tableCategory = Database::get_course_table(TABLE_LP_CATEGORY);
$catOrder = isset($_POST['order']) ? (array) $_POST['order'] : [];
$pos = 1;
foreach ($catOrder as $catIid) {
$catIid = (int) $catIid;
if ($catIid <= 0) {
continue;
}
$sql = "UPDATE $tableCategory
SET position = $pos
WHERE c_id = $courseId
AND iid = $catIid";
Database::query($sql);
$pos++;
}
header('Content-Type: application/json');
echo json_encode(['ok' => true]);
exit;
case 'reorder_lps':
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed(true);
}
$courseId = api_get_course_int_id();
$sessionId = api_get_session_id();
$tableLp = Database::get_course_table(TABLE_LP_MAIN);
$lists = isset($_POST['lists']) ? (array) $_POST['lists'] : [];
foreach ($lists as $categoryIdStr => $lpIds) {
$categoryId = (int) $categoryIdStr;
$pos = 1;
foreach ((array) $lpIds as $lpId) {
$lpId = (int) $lpId;
if ($lpId <= 0) {
continue;
}
$sql = "UPDATE $tableLp
SET category_id = ".($categoryId ?: 0).", display_order = $pos
WHERE c_id = $courseId AND id = $lpId";
Database::query($sql);
$pos++;
}
}
header('Content-Type: application/json');
echo json_encode(['ok' => true]);
exit;
case 'edit':
if (!$is_allowed_to_edit) {
api_not_allowed(true);