Skip to content

Commit

Permalink
Fix hide/show LP icons in course home see BT#12200
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Feb 13, 2017
1 parent 378c57d commit 1f72d4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
5 changes: 4 additions & 1 deletion main/lp/learnpath.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4167,6 +4167,7 @@ public static function toggle_publish($lp_id, $set_visibility = 'v')
)
$session_condition
";

$result = Database::query($sql);
$num = Database :: num_rows($result);
if ($set_visibility == 'i' && $num > 0) {
Expand Down Expand Up @@ -4199,7 +4200,9 @@ public static function toggle_publish($lp_id, $set_visibility = 'v')
session_id = $session_id
WHERE
c_id = ".$course_id." AND
(link='$link' and image='scormbuilder.gif' $session_condition)
(link = '$link' OR link = '$oldLink') AND
image='scormbuilder.gif'
$session_condition
";
Database::query($sql);
} else {
Expand Down
22 changes: 11 additions & 11 deletions main/lp/learnpathList.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,24 +119,24 @@ public function __construct(
// it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
// is done using domesticate()
$name = domesticate($row->getName());
$link = 'lp/lp_controller.php?action=view&lp_id=' . $row->getIid() . '&id_session='.$session_id;
$oldLink = 'newscorm/lp_controller.php?action=view&lp_id=' . $row->getIid() . '&id_session='.$session_id;
$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 * FROM $tbl_tool
WHERE
c_id = $course_id AND (
name='$name' AND
image='scormbuilder.gif' AND
(
link LIKE '$link%' OR
link LIKE '$oldLink%'
)
)";

c_id = $course_id AND
name = '$name' AND
image = 'scormbuilder.gif' AND
(
link LIKE '$link%' OR
link LIKE '$oldLink%'
)
";
$res2 = Database::query($sql2);
if (Database::num_rows($res2) > 0) {
$row2 = Database::fetch_array($res2);
$pub = $row2['visibility'];

} else {
$pub = 'i';
}
Expand Down

0 comments on commit 1f72d4d

Please sign in to comment.