From 67905acedab8310da8cf1b5a6e76a03e51dcbb92 Mon Sep 17 00:00:00 2001 From: moodler Date: Sun, 18 Apr 2004 05:54:33 +0000 Subject: [PATCH] SOme fixes for - the URL used in recent activity links - the display of single entries --- mod/glossary/lib.php | 2 +- mod/glossary/view.php | 40 ++++++++++++++++++++++++++++------------ 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 0c716e0f4a..0aaf6631ae 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -243,7 +243,7 @@ function glossary_print_recent_activity($course, $isteacher, $timestart) { $user = get_record("user","id",$entry->userid); $fullname = fullname($user, $isteacher); echo "

$date - $fullname
"; - echo "\"wwwroot/mod/glossary/$entry->url\">"; + echo "\"wwwroot/mod/glossary/view.php?g=$entry->glossaryid&mode=entry&hook=$entry->id\">"; echo "$entry->concept"; echo "\"

"; } diff --git a/mod/glossary/view.php b/mod/glossary/view.php index acca534210..dbf27f0c45 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -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" | @@ -25,15 +27,29 @@ 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 ) { @@ -394,7 +410,7 @@ 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; } @@ -420,7 +436,7 @@ } 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; } -- 2.39.5