From ad9e934195d4e4d24ee6d0610de262c7ba246cec Mon Sep 17 00:00:00 2001 From: christianbeeznst Date: Wed, 29 May 2024 13:20:20 -0500 Subject: [PATCH] Learnpath: Set correct item type to avoid frameReady issue - refs BT#21752 --- public/main/exercise/exercise_result.php | 2 +- public/main/exercise/result.php | 2 +- public/main/inc/lib/display.lib.php | 5 +++++ public/main/lp/lp_view.php | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/main/exercise/exercise_result.php b/public/main/exercise/exercise_result.php index 53a768e266..821f038386 100644 --- a/public/main/exercise/exercise_result.php +++ b/public/main/exercise/exercise_result.php @@ -266,7 +266,7 @@ ExerciseLib::exercise_time_control_delete( ExerciseLib::delete_chat_exercise_session($exeId); if (!in_array($origin, ['learnpath', 'embeddable', 'mobileapp'])) { - $pageBottom .= '
'; + $pageBottom .= '
'; $pageBottom .= Display::url( get_lang('Return to Course Homepage'), api_get_course_url(), diff --git a/public/main/exercise/result.php b/public/main/exercise/result.php index 44d2717270..f0a3ba34f8 100644 --- a/public/main/exercise/result.php +++ b/public/main/exercise/result.php @@ -156,7 +156,7 @@ switch ($action) { $lpId = (int) $track_exercise_info['orig_lp_id']; $lpItemId = (int) $track_exercise_info['orig_lp_item_id']; $lpViewId = (int) $track_exercise_info['orig_lp_item_view_id']; -$pageBottom = '
'; +$pageBottom = '
'; $pageBottom .= Display::url( get_lang('Back to the attempt list'), api_get_path(WEB_CODE_PATH).'exercise/overview.php?exerciseId='.$exercise_id.'&'.api_get_cidreq(). diff --git a/public/main/inc/lib/display.lib.php b/public/main/inc/lib/display.lib.php index ae0f4c63ad..148e639ea2 100644 --- a/public/main/inc/lib/display.lib.php +++ b/public/main/inc/lib/display.lib.php @@ -2667,6 +2667,11 @@ class Display string $itemType = '', string $jsConditionalFunction = 'function () { return false; }' ): string { + + if (in_array($itemType, ['link', 'sco', 'xapi', 'quiz', 'h5p', 'forum'])) { + return false; + } + $colorThemeRepo = Container::$container->get(ColorThemeRepository::class); $router = Container::getRouter(); diff --git a/public/main/lp/lp_view.php b/public/main/lp/lp_view.php index 4778da4c7a..969a722b25 100644 --- a/public/main/lp/lp_view.php +++ b/public/main/lp/lp_view.php @@ -59,6 +59,7 @@ if (false === $visibility && } $lp_item_id = $oLP->get_current_item_id(); +$lpCurrentItemId = isset($_GET['lp_item_id']) ? (int) $_GET['lp_item_id'] : $oLP->get_current_item_id(); $lpType = $lp->getLpType(); if (!api_is_allowed_to_edit(null, true)) { @@ -191,7 +192,7 @@ $get_teacher_buttons = $oLP->get_teacher_toc_buttons(); $itemType = ''; $type_quiz = false; foreach ($get_toc_list as $toc) { - if ($toc['id'] == $lp_item_id) { + if ($toc['id'] == $lpCurrentItemId) { $itemType = $toc['type']; $type_quiz = 'quiz' === $toc['type']; } @@ -536,7 +537,7 @@ if (Tracking::minimumTimeAvailable(api_get_session_id(), api_get_course_int_id() $template->assign('lp_accumulate_work_time', $lpMinTime); $template->assign('lp_mode', $lp->getDefaultViewMod()); $template->assign('lp_title_scorm', stripslashes($lp->getTitle())); -$template->assign('lp_item_parents', $oLP->getCurrentItemParentNames($oLP->get_current_item_id())); +$template->assign('lp_item_parents', $oLP->getCurrentItemParentNames($lpCurrentItemId)); // @todo Fix lp_view_accordion /*if ('true' === api_get_setting('lp.lp_view_accordion') && 1 == $lpType) {