]> git.mjollnir.org Git - moodle.git/commitdiff
- Duplicated entries are now shown together when a dynamic link is clicked on.
authorwillcast <willcast>
Tue, 30 Sep 2003 02:17:09 +0000 (02:17 +0000)
committerwillcast <willcast>
Tue, 30 Sep 2003 02:17:09 +0000 (02:17 +0000)
mod/glossary/dynalink.php
mod/glossary/lib.php
mod/glossary/showentry.php

index e2ac283224d7d036e08165c82afb855a6dd6d3fc..86410fce97385d197c03454fc43fbac70de24bf0 100644 (file)
@@ -15,8 +15,8 @@
             if ( $entries ) {
                 foreach ( $entries as $entry ) {
 
-                    $href_tag_begin = "<a target=\"entry\" title=\"" . strip_tags("$glossary->name: $entry->concept") ."\" href=\"$CFG->wwwroot/mod/glossary/showentry.php?courseid=$courseid&eid=$entry->id\" ".
-                         "onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$courseid&eid=$entry->id', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">";
+                    $href_tag_begin = "<a target=\"entry\" title=\"" . strip_tags("$glossary->name: $entry->concept") ."\" href=\"$CFG->wwwroot/mod/glossary/showentry.php?courseid=$courseid&concept=$entry->concept\" ".
+                         "onClick=\"return openpopup('/mod/glossary/showentry.php?courseid=$courseid&concept=$entry->concept', 'entry', 'menubar=0,location=0,scrollbars,resizable,width=600,height=450', 0);\">";
 
                     $concept = trim(strip_tags($entry->concept));
                     
index 5a90ecf948a6e5ff2076eab6a68a386f3cfce728..944e1c50aefdc60450e993d39da3f887eae5d430 100644 (file)
@@ -466,7 +466,7 @@ function glossary_add_attachment($entry, $newfile) {
     return $newfile_name;
 }
 
-function glossary_print_attachments($entry, $return=NULL) {
+function glossary_print_attachments($entry, $return=NULL, $align="left") {
 // if return=html, then return a html string.
 // if return=text, then return a text-only string.
 // otherwise, print HTML for non-images, and return image HTML
@@ -499,7 +499,7 @@ function glossary_print_attachments($entry, $return=NULL) {
 
                 } else {
                     if ($icon == "image.gif") {    // Image attachments don't get printed as links
-                        $imagereturn .= "<br /><img src=\"$CFG->wwwroot/$ffurl\">";
+                        $imagereturn .= "<br /><img src=\"$CFG->wwwroot/$ffurl\" align=$align>";
                     } else {
                         link_to_popup_window("/$ffurl", "attachment", $image, 500, 500, $strattachment);
                         echo "<a target=_image href=\"$CFG->wwwroot/$ffurl\">$file</a>";
index 5735c3095cb5c2e9720ad738bea3d0dab5a3bb14..112717f386d023e15b84024b46e862d9d0103cf6 100644 (file)
@@ -3,31 +3,42 @@
     require_once("lib.php");
 
     require_variable($courseid);
-    require_variable($eid);  // entry id
+    require_variable($concept);  // entry id
 
-    $entry = get_record("glossary_entries","id",$eid);
+    $entries = get_records("glossary_entries","ucase(concept)",strtoupper(trim($concept)));
 
     print_header();
     
-    glossary_show_entry($courseid, $entry);
+    glossary_show_entry($courseid, $entries);
     
     close_window_button();
 
-    function glossary_show_entry($courseid, $entry) {
+    function glossary_show_entry($courseid, $entries) {
         global $THEME, $USER;
 
         $colour = $THEME->cellheading2;
 
         echo "\n<center><table width=95% border=0><TR>";
         echo "<TD WIDTH=100% BGCOLOR=\"#FFFFFF\">";
-        if ($entry->attachment) {
-            $entry->course = $courseid;
-            echo "<table border=0 align=right><tr><td>";
-            echo glossary_print_attachments($entry,"html");
-            echo "</td></tr></table>";
+        if ( $entries ) {
+            foreach ( $entries as $entry ) {
+                if( $ConceptIsPrinted ) {
+                    echo "<hr>";
+                }
+                if ( !$ConceptIsPrinted ) {
+                    echo "<b>" . $entry->concept . "</b>:<br>";
+                    $ConceptIsPrinted = 1;
+                }
+
+                if ($entry->attachment) {
+                    $entry->course = $courseid;
+                    echo "<table border=0 align=right><tr><td>";
+                    echo glossary_print_attachments($entry,"html");
+                    echo "</td></tr></table>";
+                }
+                echo format_text($entry->definition, $entry->format);
+            }
         }
-        echo "<b>$entry->concept</b>: ";
-        echo format_text($entry->definition, $entry->format);
         echo "</td>";
         echo "</TR></table></center>";
     }