Fixing #2514 when using the "publish" button in the LP list adding session support

skala
Julio Montoya 14 years ago
parent ad44e0a196
commit 2e86a1959f
  1. 2
      main/inc/lib/course_home.lib.php
  2. 11
      main/newscorm/learnpath.class.php

@ -715,7 +715,7 @@ class CourseHome {
$class = '';
}
$qm_or_amp = strpos($tool['link'], '?') === false ? '?' : '&';
$qm_or_amp = strpos($tool['link'], '?') === false ? '?' : '&';
// If it's a link, we don't add the cidReq
if ($tool['image'] == 'file_html.gif' || $tool['image'] == 'file_html_na.gif') {
$tool['link'] = $tool['link'].$qm_or_amp;

@ -3488,8 +3488,8 @@ class learnpath {
* Publishes a learnpath. This basically means show or hide the learnpath
* on the course homepage
* Can be used as abstract
* @param integer Learnpath ID
* @param string New visibility
* @param integer Learnpath id
* @param string New visibility (v/s - visible/invisible)
*/
public function toggle_publish($lp_id, $set_visibility = 'v') {
//if ($this->debug > 0) { error_log('New LP - In learnpath::toggle_publish()', 0); }
@ -3513,7 +3513,7 @@ class learnpath {
$session_condition = api_get_session_condition($session_id);
$tbl_tool = Database :: get_course_table(TABLE_TOOL_LIST);
$link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id;
$link = 'newscorm/lp_controller.php?action=view&lp_id=' . $lp_id.'&id_session='.$session_id;
$sql = "SELECT * FROM $tbl_tool where name='$name' and image='scormbuilder.gif' and link LIKE '$link%' $session_condition";
$result = Database::query($sql);
$num = Database :: num_rows($result);
@ -3521,9 +3521,8 @@ class learnpath {
//if ($this->debug > 2) { error_log('New LP - '.$sql.' - '.$num, 0); }
if (($set_visibility == 'i') && ($num > 0)) {
$sql = "DELETE FROM $tbl_tool WHERE (name='$name' and image='scormbuilder.gif' and link LIKE '$link%' $session_condition)";
}
elseif (($set_visibility == 'v') && ($num == 0)) {
$sql = "INSERT INTO $tbl_tool (name, link, image, visibility, admin, address, added_tool, session_id) VALUES ('$name','newscorm/lp_controller.php?action=view&lp_id=$lp_id','scormbuilder.gif','$v','0','pastillegris.gif',0, $session_id)";
} elseif (($set_visibility == 'v') && ($num == 0)) {
$sql = "INSERT INTO $tbl_tool (name, link, image, visibility, admin, address, added_tool, session_id) VALUES ('$name','$link','scormbuilder.gif','$v','0','pastillegris.gif',0, $session_id)";
} else {
// Parameter and database incompatible, do nothing.
}

Loading…
Cancel
Save