Ver código fonte

Fix hide/show LP icons in course home see BT#12200

jmontoyaa 8 anos atrás
pai
commit
1f72d4de10
2 arquivos alterados com 15 adições e 12 exclusões
  1. 4 1
      main/lp/learnpath.class.php
  2. 11 11
      main/lp/learnpathList.class.php

+ 4 - 1
main/lp/learnpath.class.php

@@ -4167,6 +4167,7 @@ class learnpath
                         )
                         $session_condition
                     ";
+
             $result = Database::query($sql);
             $num = Database :: num_rows($result);
             if ($set_visibility == 'i' && $num > 0) {
@@ -4199,7 +4200,9 @@ class learnpath
                             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 {

+ 11 - 11
main/lp/learnpathList.class.php

@@ -119,24 +119,24 @@ class LearnpathList
             // 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';
             }