From acb00941c401ccbbc74fdec70437f1955f85a03c Mon Sep 17 00:00:00 2001 From: Julio Date: Sat, 7 Dec 2019 13:47:58 +0100 Subject: [PATCH] Use cid/sid in params --- public/main/lp/learnpath.class.php | 232 ++++++++++++------------- public/main/lp/learnpathList.class.php | 12 +- public/main/lp/lp_controller.php | 112 ++++++------ public/main/lp/lp_stats.php | 2 +- public/main/lp/scorm_api.php | 4 +- 5 files changed, 181 insertions(+), 181 deletions(-) diff --git a/public/main/lp/learnpath.class.php b/public/main/lp/learnpath.class.php index 5febada63c..0c3d33bb5b 100644 --- a/public/main/lp/learnpath.class.php +++ b/public/main/lp/learnpath.class.php @@ -201,10 +201,10 @@ class learnpath // Selecting by view_count descending allows to get the highest view_count first. $sql = "SELECT * FROM $lp_table - WHERE - c_id = $course_id AND - lp_id = $lp_id AND - user_id = $user_id + WHERE + c_id = $course_id AND + lp_id = $lp_id AND + user_id = $user_id $session ORDER BY view_count DESC"; $res = Database::query($sql); @@ -602,7 +602,7 @@ class learnpath if (!empty($next)) { $sql = "UPDATE $tbl_lp_item - SET previous_item_id = $new_item_id + SET previous_item_id = $new_item_id WHERE c_id = $course_id AND id = $next AND item_type != '".TOOL_LP_FINAL_ITEM."'"; Database::query($sql); } @@ -756,7 +756,7 @@ class learnpath // There is already one such name, update the current one a bit. $i++; $name = $name.' - '.$i; - $check_name = "SELECT * FROM $tbl_lp + $check_name = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND name = '".Database::escape_string($name)."' "; $res_name = Database::query($check_name); } @@ -782,7 +782,7 @@ class learnpath break; case 'manual': default: - $get_max = "SELECT MAX(display_order) + $get_max = "SELECT MAX(display_order) FROM $tbl_lp WHERE c_id = $course_id"; $res_max = Database::query($get_max); if (Database::num_rows($res_max) < 1) { @@ -831,7 +831,7 @@ class learnpath Database::query($sql); // Insert into item_property. - api_item_property_update( + /*api_item_property_update( $courseInfo, TOOL_LEARNPATH, $id, @@ -845,7 +845,7 @@ class learnpath $courseInfo, $session_id, $userId - ); + );*/ return $id; } @@ -1027,7 +1027,7 @@ class learnpath WHERE c_id = $course_id AND lp_id = ".$this->lp_id; Database::query($sql); - $sql = "DELETE FROM $lp_view + $sql = "DELETE FROM $lp_view WHERE c_id = $course_id AND lp_id = ".$this->lp_id; Database::query($sql); @@ -1042,9 +1042,9 @@ class learnpath $row = Database::fetch_array($res); $path = $row['path']; $sql = "SELECT id FROM $lp - WHERE + WHERE c_id = $course_id AND - path = '$path' AND + path = '$path' AND iid != ".$this->lp_id; $res = Database::query($sql); if (Database::num_rows($res) > 0) { @@ -1079,7 +1079,7 @@ class learnpath WHERE c_id = $course_id AND (link LIKE '$link%' AND image='scormbuilder.gif')"; Database::query($sql); - $sql = "DELETE FROM $lp + $sql = "DELETE FROM $lp WHERE iid = ".$this->lp_id; Database::query($sql); // Updates the display order of all lps. @@ -1127,12 +1127,12 @@ class learnpath return false; } $lp_item = Database::get_course_table(TABLE_LP_ITEM); - $sql = "SELECT * FROM $lp_item + $sql = "SELECT * FROM $lp_item WHERE c_id = $course_id AND parent_item_id = $id"; $res = Database::query($sql); while ($row = Database::fetch_array($res)) { $num += $this->delete_children_items($row['iid']); - $sql = "DELETE FROM $lp_item + $sql = "DELETE FROM $lp_item WHERE c_id = $course_id AND iid = ".$row['iid']; Database::query($sql); $num++; @@ -1185,15 +1185,15 @@ class learnpath Database::query($sql_upd); // Now update all following items with new display order. $sql_all = "UPDATE $lp_item SET display_order = display_order-1 - WHERE - c_id = $course_id AND - lp_id = $lp AND - parent_item_id = $parent AND + WHERE + c_id = $course_id AND + lp_id = $lp AND + parent_item_id = $parent AND display_order > $display"; Database::query($sql_all); //Removing prerequisites since the item will not longer exist - $sql_all = "UPDATE $lp_item SET prerequisite = '' + $sql_all = "UPDATE $lp_item SET prerequisite = '' WHERE c_id = $course_id AND prerequisite = $id"; Database::query($sql_all); @@ -1205,8 +1205,8 @@ class learnpath // Remove from search engine if enabled. if (api_get_setting('search_enabled') === 'true') { $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF); - $sql = 'SELECT * FROM %s - WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level=%d + $sql = 'SELECT * FROM %s + WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level=%d LIMIT 1'; $sql = sprintf($sql, $tbl_se_ref, $this->cc, TOOL_LEARNPATH, $lp, $id); $res = Database::query($sql); @@ -1215,8 +1215,8 @@ class learnpath $di = new ChamiloIndexer(); $di->remove_document($row2['search_did']); } - $sql = 'DELETE FROM %s - WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level=%d + $sql = 'DELETE FROM %s + WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level=%d LIMIT 1'; $sql = sprintf($sql, $tbl_se_ref, $this->cc, TOOL_LEARNPATH, $lp, $id); Database::query($sql); @@ -1262,7 +1262,7 @@ class learnpath } $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); - $sql = "SELECT * FROM $tbl_lp_item + $sql = "SELECT * FROM $tbl_lp_item WHERE iid = $id"; $res_select = Database::query($sql); $row_select = Database::fetch_array($res_select); @@ -1791,10 +1791,10 @@ class learnpath $settings = api_get_configuration_value('lp_view_settings'); $display = isset($settings['display']) ? $settings['display'] : false; $reportingIcon = ' - '.$reportingText.' '; @@ -1815,13 +1815,13 @@ class learnpath $nextIcon = ''; if ($hideArrows === false) { $previousIcon = ' - '.$previousText.' '; $nextIcon = ' - '.$nextText.' '; @@ -1831,9 +1831,9 @@ class learnpath $navbar = ' '.$reportingIcon.' - '.$previousIcon.' + '.$previousIcon.' '.$nextIcon.' - '.$fullScreenText.' @@ -1843,7 +1843,7 @@ class learnpath '.$reportingIcon.' '.$previousIcon.' - '.$nextIcon.' + '.$nextIcon.' '; } @@ -2052,7 +2052,7 @@ class learnpath } // Getting all the information about the item. - $sql = "SELECT lpi.audio, lpi.item_type, lp_view.status + $sql = "SELECT lpi.audio, lpi.item_type, lp_view.status FROM $tbl_lp_item as lpi INNER JOIN $tbl_lp_item_view as lp_view ON (lpi.iid = lp_view.lp_item_id) @@ -2442,8 +2442,8 @@ class learnpath { $text = $percentage.$text_add; $output = '
-
'.$text.'
@@ -4280,6 +4280,7 @@ class learnpath $sql = "SELECT * FROM $tbl_lp WHERE iid = $lp_id"; $result = Database::query($sql); + if (Database::num_rows($result)) { $row = Database::fetch_array($result); $name = Database::escape_string($row['name']); @@ -4562,17 +4563,16 @@ class learnpath * * @return bool */ - public static function categoryIsPublished( - CLpCategory $category, - $courseId - ) { + public static function categoryIsPublished(CLpCategory $category, $courseId) + { + return false; $link = self::getCategoryLinkForTool($category->getId()); $em = Database::getManager(); $tools = $em ->createQuery(" SELECT t FROM ChamiloCourseBundle:CTool t - WHERE t.course = :course AND + WHERE t.course = :course AND t.name = :name AND t.image LIKE 'lp_category.%' AND t.link LIKE :link @@ -6106,9 +6106,9 @@ class learnpath ); } - $delete_icon .= ' lp_id.'" + onclick="return confirmation(\''.addslashes($title).'\');" class="btn btn-default">'; $delete_icon .= Display::return_icon( 'delete.png', @@ -6217,14 +6217,14 @@ class learnpath Display::tag( 'div', "
- $previewIcon - $audio - $edit_icon + $previewIcon + $audio + $edit_icon $pluginCalendarIcon - $forumIcon - $prerequisities_icon - $move_item_icon - $audio_icon + $forumIcon + $prerequisities_icon + $move_item_icon + $audio_icon $orderIcons $delete_icon
", @@ -6858,7 +6858,7 @@ class learnpath if (empty($documentInfo)) { // Try with iid $table = Database::get_course_table(TABLE_DOCUMENT); - $sql = "SELECT id, path FROM $table + $sql = "SELECT id, path FROM $table WHERE c_id = $course_id AND iid = $document_id AND path NOT LIKE '%_DELETED_%' "; $res_doc = Database::query($sql); $row = Database::fetch_array($res_doc); @@ -8294,7 +8294,7 @@ class learnpath if ($action === 'add') { if (is_numeric($extra_info)) { $extra_info = (int) $extra_info; - $sql_doc = "SELECT path FROM $tbl_doc + $sql_doc = "SELECT path FROM $tbl_doc WHERE c_id = $course_id AND iid = ".$extra_info; $result = Database::query($sql_doc); $path_file = Database::result($result, 0, 0); @@ -9066,7 +9066,7 @@ class learnpath $item_url = stripslashes($extra_info['url']); } elseif (is_numeric($extra_info)) { $extra_info = (int) $extra_info; - $sql = "SELECT title, description, url + $sql = "SELECT title, description, url FROM $tbl_link WHERE c_id = $course_id AND iid = $extra_info"; $result = Database::query($sql); @@ -9399,7 +9399,7 @@ class learnpath $return = '
'; $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); - $sql = "SELECT * FROM $tbl_lp_item + $sql = "SELECT * FROM $tbl_lp_item WHERE iid = ".$item_id; $result = Database::query($sql); $row = Database::fetch_assoc($result); @@ -9466,9 +9466,9 @@ class learnpath // Try with iid $table = Database::get_course_table(TABLE_DOCUMENT); $sql = "SELECT path FROM $table - WHERE - c_id = ".api_get_course_int_id()." AND - iid = ".$row['path']." AND + WHERE + c_id = ".api_get_course_int_id()." AND + iid = ".$row['path']." AND path NOT LIKE '%_DELETED_%'"; $result = Database::query($sql); $documentData = Database::fetch_array($result); @@ -9505,9 +9505,9 @@ class learnpath $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $sql = "SELECT * FROM ".$tbl_lp_item." - WHERE - c_id = $course_id AND - lp_id = ".$this->lp_id." AND + WHERE + c_id = $course_id AND + lp_id = ".$this->lp_id." AND parent_item_id = 0 ORDER BY display_order ASC"; $res_zero = Database::query($sql); @@ -9554,12 +9554,12 @@ class learnpath if (!id) { return false; } - + var cbo = document.getElementById('previous'); for(var i = cbo.length - 1; i > 0; i--) { cbo.options[i] = null; } - + var k=0; for(var i = 1; i <= child_name[id].length; i++){ var option = new Option(child_name[id][i - 1], child_value[id][i - 1]); @@ -9567,7 +9567,7 @@ class learnpath cbo.options[i] = option; k = i; } - + cbo.options[k].selected = true; $('#previous').selectpicker('refresh'); }"; @@ -9757,55 +9757,55 @@ class learnpath } $return .= ''; - $return .= ''; $return .= ''; $return .= ''; - $return .= ''; $return .= ''; } if ($item['item_type'] == TOOL_HOTPOTATOES) { $return .= ''; - $return .= ''; $return .= ''; $return .= ''; - $return .= ''; $return .= ''; } @@ -10011,10 +10011,10 @@ class learnpath } $sql_quiz = "SELECT * FROM $tbl_quiz - WHERE - c_id = $course_id AND + WHERE + c_id = $course_id AND $activeCondition - $condition_session + $condition_session $categoryCondition $keywordCondition ORDER BY title ASC"; @@ -10172,7 +10172,7 @@ class learnpath 'link.session_id' ); - $sql = "SELECT + $sql = "SELECT link.id as link_id, link.title as link_title, link.session_id as link_session_id, @@ -11645,9 +11645,9 @@ EOD; $max_order = $row_max_order->display_order; // Get the previous item ID $sql = "SELECT iid as previous FROM $table_lp_item - WHERE - c_id = $course_id AND - lp_id = ".$this->lp_id." AND + WHERE + c_id = $course_id AND + lp_id = ".$this->lp_id." AND display_order = '$max_order' "; $rs_max = Database::query($sql); $row_max = Database::fetch_object($rs_max); @@ -11988,7 +11988,7 @@ EOD; // Delete link tool $tbl_tool = Database::get_course_table(TABLE_TOOL_LIST); - $link = 'lp/lp_controller.php?cidReq='.$courseInfo['code'].'&id_session='.$sessionId.'&gidReq=0&gradebook=0&origin=&action=view_category&id='.$id; + $link = 'lp/lp_controller.php?cid='.$courseInfo['real_id'].'&sid='.$sessionId.'&gidReq=0&gradebook=0&origin=&action=view_category&id='.$id; // Delete tools $sql = "DELETE FROM $tbl_tool WHERE c_id = ".$courseId." AND (link LIKE '$link%' AND image='lp_category.gif')"; @@ -12687,7 +12687,7 @@ EOD; $this->accumulateScormTime = (int) $value; $lp_table = Database::get_course_table(TABLE_LP_MAIN); $lp_id = $this->get_id(); - $sql = "UPDATE $lp_table + $sql = "UPDATE $lp_table SET accumulate_scorm_time = ".$this->accumulateScormTime." WHERE iid = $lp_id"; Database::query($sql); @@ -12918,7 +12918,7 @@ EOD; $learningPathId = (int) $learningPathId; $id_in_path = (int) $id_in_path; - $sql = "SELECT item_type, title, ref + $sql = "SELECT item_type, title, ref FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id = $learningPathId AND iid = $id_in_path"; $res_item = Database::query($sql); @@ -13266,8 +13266,8 @@ EOD; public function getAccumulateWorkTimeTotalCourse() { $table = Database::get_course_table(TABLE_LP_MAIN); - $sql = "SELECT SUM(accumulate_work_time) AS total - FROM $table + $sql = "SELECT SUM(accumulate_work_time) AS total + FROM $table WHERE c_id = ".$this->course_int_id; $result = Database::query($sql); $row = Database::fetch_array($result); @@ -13310,8 +13310,8 @@ EOD; $courseId = (int) $courseId; $table = Database::get_course_table(TABLE_LP_MAIN); - $sql = "SELECT accumulate_work_time - FROM $table + $sql = "SELECT accumulate_work_time + FROM $table WHERE c_id = $courseId AND id = $lpId"; $result = Database::query($sql); $row = Database::fetch_array($result); @@ -13437,7 +13437,7 @@ EOD; $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); $course_id = api_get_course_int_id(); - $sql = "SELECT * FROM $tbl_lp_item + $sql = "SELECT * FROM $tbl_lp_item WHERE c_id = $course_id AND lp_id = ".$this->lp_id; if ($addParentCondition) { diff --git a/public/main/lp/learnpathList.class.php b/public/main/lp/learnpathList.class.php index 1deb2f03c8..e63f656887 100644 --- a/public/main/lp/learnpathList.class.php +++ b/public/main/lp/learnpathList.class.php @@ -110,22 +110,22 @@ class LearnpathList $link = 'lp/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id; $oldLink = 'newscorm/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id; - $sql2 = "SELECT visibility FROM $tbl_tool + /*$sql2 = "SELECT visibility FROM $tbl_tool WHERE - c_id = $course_id AND + c_id = $course_id AND name = '$name' AND image = 'scormbuilder.gif' AND ( link LIKE '$link%' OR - link LIKE '$oldLink%' + link LIKE '$oldLink%' ) "; - $res2 = Database::query($sql2); + $res2 = Database::query($sql2);*/ $pub = 'i'; - if (Database::num_rows($res2) > 0) { + /*if (Database::num_rows($res2) > 0) { $row2 = Database::fetch_array($res2); $pub = $row2['visibility']; - } + }*/ // Check if visible. $visibility = api_get_item_visibility( diff --git a/public/main/lp/lp_controller.php b/public/main/lp/lp_controller.php index 54b941b2b4..c540b9e065 100644 --- a/public/main/lp/lp_controller.php +++ b/public/main/lp/lp_controller.php @@ -55,7 +55,7 @@ $htmlHeadXtra[] = ' /* Script to manipulate Learning Path items with Drag and drop */ - var newOrderData = ""; + var newOrderData = ""; function buildLPtree(in_elem, in_parent_id) { var item_tag = in_elem.get(0).tagName; var item_id = in_elem.attr("id"); @@ -80,7 +80,7 @@ $htmlHeadXtra[] = ' return in_parent_integer_id; } - $(function() { + $(function() { $(".lp_resource").sortable({ items: ".lp_resource_element ", handle: ".moved", //only the class "moved" @@ -95,15 +95,15 @@ $htmlHeadXtra[] = ' $(ui.item).css("width", "100%"); } }); - - $(".li_container .order_items").click(function(e) { + + $(".li_container .order_items").click(function(e) { var dir = $(this).data("dir"); - var itemId = $(this).data("id"); - var jItems = $("#lp_item_list li.li_container"); - var jItem = $("#"+ itemId); + var itemId = $(this).data("id"); + var jItems = $("#lp_item_list li.li_container"); + var jItem = $("#"+ itemId); var index = jItems.index(jItem); - var total = jItems.length; - + var total = jItems.length; + switch (dir) { case "up": if (index != 0 && jItems[index - 1]) { @@ -111,58 +111,58 @@ $htmlHeadXtra[] = ' if (subItems.length >= 0) { index = index - 1; }*/ - var subItems = $(jItems[index - 1]).find("li.sub_item"); - var parentClass = $(jItems[index - 1]).parent().parent().attr("class"); - var parentId = $(jItems[index]).parent().parent().attr("id"); + var subItems = $(jItems[index - 1]).find("li.sub_item"); + var parentClass = $(jItems[index - 1]).parent().parent().attr("class"); + var parentId = $(jItems[index]).parent().parent().attr("id"); var myParentId = $(jItems[index - 1]).parent().parent().attr("id"); //console.log(parentId + " - " + myParentId); - + // We are brothers! if (parentId == myParentId) { console.log("Brothers"); console.log(subItems.length); if (subItems.length > 0) { - var lastItem = $(jItems[index - 1]).find("li.sub_item"); - parentIndex = jItems.index(lastItem); + var lastItem = $(jItems[index - 1]).find("li.sub_item"); + parentIndex = jItems.index(lastItem); console.log(parentIndex); - jItem.detach().insertAfter(lastItem); + jItem.detach().insertAfter(lastItem); //console.log("not classic"); } else { //console.log("classic"); - jItem.detach().insertBefore(jItems[index - 1]); - } + jItem.detach().insertBefore(jItems[index - 1]); + } break; } - + //console.log(parentClass); if (parentClass == "record li_container") { // previous is a chapter - var lastItem = $(jItems[index - 1]).parent().parent().find("li.li_container").last(); - parentIndex = jItems.index(lastItem); + var lastItem = $(jItems[index - 1]).parent().parent().find("li.li_container").last(); + parentIndex = jItems.index(lastItem); //console.log(parentIndex); - jItem.detach().insertAfter(jItems[parentIndex]); + jItem.detach().insertAfter(jItems[parentIndex]); } else { - jItem.detach().insertBefore(jItems[index - 1]); - } - } + jItem.detach().insertBefore(jItems[index - 1]); + } + } break; case "down": - if (index != total - 1) { + if (index != total - 1) { const originIndex = index; // The element is a chapter with items - var subItems = jItem.find("li.li_container"); - if (subItems.length > 0) { + var subItems = jItem.find("li.li_container"); + if (subItems.length > 0) { index = subItems.length + index; - //console.log("element is a chapter with items"); + //console.log("element is a chapter with items"); //console.log("new index = " + index); - } - + } + var subItems = $(jItems[index + 1]).find("li.sub_item"); //console.log("next subItems.length: "+subItems.length); // This is an element entering in a chapter - if (subItems.length > 0) { + if (subItems.length > 0) { // Check if im a child - var parentClass = jItem.parent().parent().attr("class"); + var parentClass = jItem.parent().parent().attr("class"); //console.log(parentClass); if (parentClass == "record li_container") { // Parent position @@ -171,29 +171,29 @@ $htmlHeadXtra[] = ' //console.log(parentIndex); jItem.detach().insertAfter(jItems[parentIndex]); } else { - jItem.detach().insertAfter(subItems); - } + jItem.detach().insertAfter(subItems); + } break; - } - + } + var currentSubItems = $(jItems[index]).parent().find("li.sub_item"); //console.log("currentSubItems"+currentSubItems.length); - - var parentId = $(jItems[originIndex]).parent().parent().attr("id"); + + var parentId = $(jItems[originIndex]).parent().parent().attr("id"); var myParentId = $(jItems[index + 1]).parent().parent().attr("id"); //console.log("parent ids: "+ parentId + " - " + myParentId); - + // We are brothers! if (parentId == myParentId) { if ((index + 1) < total) { //console.log(index + 1); //console.log("We are brothers"); jItem.detach().insertAfter(jItems[index + 1]); - } + } break; } - - if (currentSubItems.length > 0) { + + if (currentSubItems.length > 0) { var parentIndex = jItems.index(jItem.parent().parent()); //console.log("has currentSubItems"); //console.log("id " + jItem.parent().parent().attr("id")); @@ -202,14 +202,14 @@ $htmlHeadXtra[] = ' jItem.detach().insertAfter(jItems[parentIndex]); break; } - //jItem.detach().insertAfter($(jItems[index]).parent().parent()); - } - - //var lastItem = $(jItems[index + 1]).parent().parent().find("li.li_container").last(); + //jItem.detach().insertAfter($(jItems[index]).parent().parent()); + } + + //var lastItem = $(jItems[index + 1]).parent().parent().find("li.li_container").last(); if (subItems.length > 0) { index = originIndex; } - + if ((index + 1) < total) { //console.log(index + 1); //console.log("changed"); @@ -217,11 +217,11 @@ $htmlHeadXtra[] = ' } } break; - } - + } + //console.log("rebuild"); buildLPtree($("#lp_item_list"), 0); - + var order = "new_order="+ newOrderData + "&a=update_lp_item_order"; $.post( "'.$ajax_url.'", @@ -231,7 +231,7 @@ $htmlHeadXtra[] = ' order = ""; newOrderData = ""; } - ); + ); }); $("#lp_item_list").sortable({ @@ -272,7 +272,7 @@ $htmlHeadXtra[] = ' "type": type, "title" : title }; - + $.ajax({ type: "GET", url: "'.$ajax_url.'", @@ -281,7 +281,7 @@ $htmlHeadXtra[] = ' success: function(data) { $("#lp_item_list").html(data); } - }); + }); } } } // End receive @@ -516,7 +516,7 @@ switch ($action) { if (!empty($sessionId)) { $sessionInfo = api_get_session_info($sessionId); $courseName = $sessionInfo['name']; - $courseUrl .= '?id_session='.$sessionId; + $courseUrl .= '?sid='.$sessionId; } $url = Display::url($courseName, $courseUrl, ['title' => get_lang('Go to the course')]); @@ -1447,7 +1447,7 @@ switch ($action) { error_log('save_current()'); error_log('save_last()'); } - $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id(); + $url = $_course['course_public_url'].'?sid='.api_get_session_id(); $redirectTo = isset($_GET['redirectTo']) ? $_GET['redirectTo'] : ''; switch ($redirectTo) { case 'lp_list': diff --git a/public/main/lp/lp_stats.php b/public/main/lp/lp_stats.php index fac489811f..3acb3b962c 100644 --- a/public/main/lp/lp_stats.php +++ b/public/main/lp/lp_stats.php @@ -16,7 +16,7 @@ if (!isset($origin)) { $origin = 'learnpath'; } -$sessionId = isset($_GET['id_session']) ? (int) $_GET['id_session'] : api_get_session_id(); +$sessionId = isset($_GET['sid']) ? (int) $_GET['sid'] : api_get_session_id(); $courseCode = isset($_GET['course']) ? $_GET['course'] : api_get_course_id(); $userId = isset($_GET['student_id']) ? (int) $_GET['student_id'] : api_get_user_id(); $lpId = isset($_GET['lp_id']) ? $_GET['lp_id'] : null; diff --git a/public/main/lp/scorm_api.php b/public/main/lp/scorm_api.php index 355835c2ac..2ed4304ca1 100644 --- a/public/main/lp/scorm_api.php +++ b/public/main/lp/scorm_api.php @@ -214,7 +214,7 @@ olms.userfname = ''; olms.userlname = ''; olms.execute_stats = false; -var courseUrl = '?cidReq='+olms.lms_course_code+'&id_session='+olms.lms_session_id; +var courseUrl = '?cid='+olms.lms_course_id+'&sid='+olms.lms_session_id; /** * Add the "addListeners" function to the "onload" event of the window and @@ -1662,7 +1662,7 @@ function switch_item(current_item, next_item) } var mysrc = 'lp/lp_controller.php?action=content&lp_id=' + olms.lms_lp_id + - '&item_id=' + next_item + '&cidReq=' + olms.lms_course_code + '&id_session=' + olms.lms_session_id; + '&item_id=' + next_item + '&cid=' + olms.lms_course_id + '&sid=' + olms.lms_session_id; var cont_f = $("#content_id"); mode == 'fullscreen') {