]> git.mjollnir.org Git - moodle.git/commitdiff
SOme fixes for
authormoodler <moodler>
Sun, 18 Apr 2004 05:54:33 +0000 (05:54 +0000)
committermoodler <moodler>
Sun, 18 Apr 2004 05:54:33 +0000 (05:54 +0000)
  - the URL used in recent activity links
  - the display of single entries

mod/glossary/lib.php
mod/glossary/view.php

index 0c716e0f4a72f6d3734d79b300b71f0f3e4ec3af..0aaf6631aeb2ff4aeb46777558b05accff00e17a 100644 (file)
@@ -243,7 +243,7 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) {
             $user = get_record("user","id",$entry->userid);
             $fullname = fullname($user, $isteacher);
             echo "<p><font size=1>$date - $fullname<br>";
-            echo "\"<a href=\"$CFG->wwwroot/mod/glossary/$entry->url\">";
+            echo "\"<a href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid&mode=entry&hook=$entry->id\">";
             echo "$entry->concept";
             echo "</a>\"</font></p>";
         }
index acca53421099a33648871a9c4a561efeb24e6650..dbf27f0c45701801cb8346f115e80e7efe9f9a4b 100644 (file)
@@ -6,7 +6,9 @@
     $debug = 0;
     $CFG->startpagetime = microtime();            
     
-    require_variable($id);           // Course Module ID
+    optional_variable($id);           // Course Module ID
+    optional_variable($g);            // Glossary ID
+
     optional_variable($tab,GLOSSARY_NO_VIEW); // browsing entries by categories?
 
     optional_variable($mode,"");  // [ "term"   | "entry"  | "cat"     | "date" | 
     optional_variable($show,"");       // [ concept | alias ] => mode=term hook=$show
     optional_variable($displayformat,-1);  // override of the glossary display format
 
-    if (! $cm = get_record("course_modules", "id", $id)) {
-        error("Course Module ID was incorrect");
-    }     
-    if (! $course = get_record("course", "id", $cm->course)) {
-        error("Course is misconfigured");
-    }     
-    if (! $glossary = get_record("glossary", "id", $cm->instance)) {
-        error("Course module is incorrect");
-    } 
+    if (!empty($id)) {
+        if (! $cm = get_record("course_modules", "id", $id)) {
+            error("Course Module ID was incorrect");
+        }     
+        if (! $course = get_record("course", "id", $cm->course)) {
+            error("Course is misconfigured");
+        }     
+        if (! $glossary = get_record("glossary", "id", $cm->instance)) {
+            error("Course module is incorrect");
+        } 
+    } else if (!empty($g)) {
+        if (! $glossary = get_record("glossary", "id", $g)) {
+            error("Course module is incorrect");
+        } 
+        if (! $course = get_record("course", "id", $glossary->course)) {
+            error("Could not determine which course this belonged to!");
+        }     
+        if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id, $course->id)) {
+            error("Could not determine which course module this belonged to!");
+        }
+    } else {
+        error("Must specify glossary ID or course module ID");
+    }
     
 /// redirecting if adding a new entry
     if ($tab == GLOSSARY_ADDENTRY_VIEW ) {
                 
                 if ( !$tableisopen ) {
                     if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS OR 
-                        $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE or $mode == 'entry') {
+                        $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE ) {
                         print_simple_box_start("center","95%","#ffffff","5","generalbox");
                         $tableisopen = 1;
                     }
         }
         if ( $tableisopen ) {
             if ($glossary->displayformat == GLOSSARY_FORMAT_CONTINUOUS OR 
-                $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE or $mode == 'entry') {
+                $glossary->displayformat == GLOSSARY_FORMAT_SIMPLE) {
                 print_simple_box_end();
                 $tableisopen = 0;
             }