]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed a little bug when glossary filter called from front page or
authormoodler <moodler>
Tue, 9 Mar 2004 16:30:36 +0000 (16:30 +0000)
committermoodler <moodler>
Tue, 9 Mar 2004 16:30:36 +0000 (16:30 +0000)
anywhere else a course is not defined

mod/glossary/filter.php

index f078d0fcc8a848becb0844cfd27c2c14dc9a670e..1fccd3dfe8028e3c21b0f781aa9dd8323de4891e 100644 (file)
@@ -7,17 +7,23 @@
     }
 
     function glossary_dynamic_link($courseid, $text) {
-    global $CFG;
+        global $CFG;
+
+        if (empty($courseid)) {
+            if ($site = get_site()) {
+                $courseid = $site->id;
+            }
+        }
 
         $GLOSSARY_CONCEPT_IS_ENTRY = 0;
         $GLOSSARY_CONCEPT_IS_CATEGORY = 1;
         switch ($CFG->dbtype) {
-        case 'postgres7':
-               $as = 'as';
-        break;
-        case 'mysql':
-               $as = '';
-        break;
+            case 'postgres7':
+                $as = 'as';
+                break;
+            case 'mysql':
+                $as = '';
+                break;
         }    
 
         $glossarieslist = get_records_select("glossary", "usedynalink != 0 and (course = $courseid or globalglossary != 0)","globalglossary, id");