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));
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
} 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>";
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>";
}