@@ -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') {