From: willcast Date: Tue, 30 Sep 2003 02:17:09 +0000 (+0000) Subject: - Duplicated entries are now shown together when a dynamic link is clicked on. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=de53b9ac252715dfdf25865022d660b559dc82bd;p=moodle.git - Duplicated entries are now shown together when a dynamic link is clicked on. --- diff --git a/mod/glossary/dynalink.php b/mod/glossary/dynalink.php index e2ac283224..86410fce97 100644 --- a/mod/glossary/dynalink.php +++ b/mod/glossary/dynalink.php @@ -15,8 +15,8 @@ if ( $entries ) { foreach ( $entries as $entry ) { - $href_tag_begin = "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 = "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)); diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 5a90ecf948..944e1c50ae 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -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 .= "
wwwroot/$ffurl\">"; + $imagereturn .= "
wwwroot/$ffurl\" align=$align>"; } else { link_to_popup_window("/$ffurl", "attachment", $image, 500, 500, $strattachment); echo "
wwwroot/$ffurl\">$file"; diff --git a/mod/glossary/showentry.php b/mod/glossary/showentry.php index 5735c3095c..112717f386 100644 --- a/mod/glossary/showentry.php +++ b/mod/glossary/showentry.php @@ -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
"; echo ""; echo "
"; - if ($entry->attachment) { - $entry->course = $courseid; - echo "
"; - echo glossary_print_attachments($entry,"html"); - echo "
"; + if ( $entries ) { + foreach ( $entries as $entry ) { + if( $ConceptIsPrinted ) { + echo "
"; + } + if ( !$ConceptIsPrinted ) { + echo "" . $entry->concept . ":
"; + $ConceptIsPrinted = 1; + } + + if ($entry->attachment) { + $entry->course = $courseid; + echo "
"; + echo glossary_print_attachments($entry,"html"); + echo "
"; + } + echo format_text($entry->definition, $entry->format); + } } - echo "$entry->concept: "; - echo format_text($entry->definition, $entry->format); echo "
"; }