From 683d68afeefd38fd80126e61a50bf89bec25029b Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Wed, 12 Apr 2017 14:44:12 -0500 Subject: [PATCH] Fixing learning paths with audio - refs BT#12608 --- main/lp/learnpath.class.php | 6 +++--- main/lp/lp_nav.php | 9 ++++++++- main/lp/lp_view.php | 2 +- main/lp/scorm_api.php | 4 +++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/main/lp/learnpath.class.php b/main/lp/learnpath.class.php index 9b73441be7..9ff359b9ec 100755 --- a/main/lp/learnpath.class.php +++ b/main/lp/learnpath.class.php @@ -2210,7 +2210,7 @@ class learnpath * Returns the HTML necessary to print a mediaplayer block inside a page * @return string The mediaplayer HTML */ - public function get_mediaplayer($autostart = 'true') + public function get_mediaplayer($lpItemId, $autostart = 'true') { $course_id = api_get_course_int_id(); $_course = api_get_course_info(); @@ -2222,7 +2222,7 @@ class learnpath INNER JOIN $tbl_lp_item_view as lp_view ON (lp.id = lp_view.lp_item_id AND lp.c_id = lp_view.c_id) WHERE - lp.id = '".$_SESSION['oLP']->current."' AND + lp.id = '$lpItemId' AND lp.c_id = $course_id AND lp_view.c_id = $course_id"; $result = Database::query($sql); @@ -2241,7 +2241,7 @@ class learnpath if ($type_quiz) { if ($_SESSION['oLP']->prevent_reinit == 1) { - $row['status'] === 'completed' ? $autostart_audio = 'false' : $autostart_audio = 'true'; + $autostart_audio = $row['status'] === 'completed' ? 'false' : 'true'; } else { $autostart_audio = $autostart; } diff --git a/main/lp/lp_nav.php b/main/lp/lp_nav.php index 2848d3912b..6a632930bd 100755 --- a/main/lp/lp_nav.php +++ b/main/lp/lp_nav.php @@ -16,6 +16,13 @@ $htmlHeadXtra[] = ''; +$lpItemId = isset($_REQUEST['lp_item']) ? intval($_REQUEST['lp_item']) : 0; + +if (!$lpItemId) { + echo ''; + exit; +} + $progress_bar = ''; $navigation_bar = ''; $display_mode = ''; @@ -44,7 +51,7 @@ if ($myLP) { $progress_bar = $myLP->getProgressBar(); $navigation_bar = $myLP->get_navigation_bar(); - $mediaplayer = $myLP->get_mediaplayer($autostart); + $mediaplayer = $myLP->get_mediaplayer($lpItemId, $autostart); } session_write_close(); ?> diff --git a/main/lp/lp_view.php b/main/lp/lp_view.php index 8e8cf71cdb..04c6e94caa 100755 --- a/main/lp/lp_view.php +++ b/main/lp/lp_view.php @@ -382,7 +382,7 @@ if (!api_is_invitee()) { } $navigation_bar = $_SESSION['oLP']->get_navigation_bar(); $navigation_bar_bottom = $_SESSION['oLP']->get_navigation_bar("control-bottom", "display:none"); -$mediaplayer = $_SESSION['oLP']->get_mediaplayer($autostart); +$mediaplayer = $_SESSION['oLP']->get_mediaplayer($_SESSION['oLP']->current, $autostart); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $show_audioplayer = false; diff --git a/main/lp/scorm_api.php b/main/lp/scorm_api.php index 0cf3431451..9c1957bd62 100755 --- a/main/lp/scorm_api.php +++ b/main/lp/scorm_api.php @@ -1649,7 +1649,9 @@ function switch_item(current_item, next_item){ $.ajax({ type: "POST", url: "lp_nav.php", - data: "", + data: { + lp_item: next_item + }, beforeSend: function() { $.each($('audio'), function () { var player = new MediaElementPlayer($(this));