[svn r9923] Fixed bug of visibility on multiple paths with same name

skala
Yannick Warnier 18 years ago
parent ed78feeda0
commit b6d32aee33
  1. 10
      main/newscorm/learnpath.class.php
  2. 3
      main/newscorm/learnpathList.class.php

@ -3358,14 +3358,16 @@ class learnpath {
$tbl_tool = Database::get_course_table(TOOL_LIST_TABLE);
$sql="SELECT * FROM $tbl_tool where name='$name' and image='scormbuilder.gif'";
$link = 'newscorm/lp_controller.php?mode=view&lp_id='.$lp_id;
$sql="SELECT * FROM $tbl_tool where name='$name' and image='scormbuilder.gif' and link LIKE '$link%'";
$result=api_sql_query($sql,__FILE__,__LINE__);
$num=Database::num_rows($result);
$row2=Database::fetch_array($result);
//if($this->debug>2){error_log('New LP - '.$sql.' - '.$num,0);}
if(($set_visibility == 'i') && ($num>0))
@ -3378,7 +3380,7 @@ class learnpath {
{
$sql ="DELETE FROM $tbl_tool WHERE (name='$name' and image='scormbuilder.gif')";
$sql ="DELETE FROM $tbl_tool WHERE (name='$name' and image='scormbuilder.gif' and link LIKE '$link%')";
}
@ -3386,7 +3388,7 @@ class learnpath {
{
$sql ="UPDATE $tbl_tool set visibility=1 WHERE (name='$name' and image='scormbuilder.gif')";
$sql ="UPDATE $tbl_tool set visibility=1 WHERE (name='$name' and image='scormbuilder.gif' and link LIKE '$link%')";
}

@ -45,7 +45,8 @@ class learnpathList {
//it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
//is done using domesticate()
$myname = domesticate($row['name']);
$sql2="SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif')";
$mylink = 'newscorm/lp_controller.php?mode=view&lp_id='.$row['id'];
$sql2="SELECT * FROM $tbl_tool where (name='$myname' and image='scormbuilder.gif' and link LIKE '$mylink%')";
//error_log('New LP - learnpathList::learnpathList - getting visibility - '.$sql2,0);
$res2 = api_sql_query($sql2,__FILE__,__LINE__);
if(Database::num_rows($res2)>0){

Loading…
Cancel
Save