2 require_once("../../config.php");
3 require_once("lib.php");
5 $concept = optional_param('concept', '', PARAM_CLEAN
);
6 $courseid = optional_param('courseid', 0, PARAM_INT
);
7 $eid = optional_param('eid', 0, PARAM_INT
); // glossary entry id
8 $displayformat = optional_param('displayformat',-1, PARAM_SAFEDIR
);
10 if ($CFG->forcelogin
) {
15 $entry = get_record("glossary_entries", "id", $eid);
16 $glossary = get_record('glossary','id',$entry->glossaryid
);
17 $entry->glossaryname
= format_string($glossary->name
,true);
18 if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id
)) {
19 error("Could not determine which course module this belonged to!");
21 if (!$cm->visible
and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE
, $cm->id
))) {
22 redirect($CFG->wwwroot
.'/course/view.php?id='.$cm->course
, get_string('activityiscurrentlyhidden'));
24 $entry->cmid
= $cm->id
;
25 $entry->courseid
= $cm->course
;
27 } else if ($concept) {
28 $entries = glossary_get_entries_search($concept, $courseid);
30 error('No valid entry specified');
34 foreach ($entries as $key => $entry) {
35 //$entries[$key]->footer = "<p align=\"right\">» <a onClick=\"if (window.opener) {window.opener.location.href='$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid'; return false;} else {openpopup('/mod/glossary/view.php?g=$entry->glossaryid', 'glossary', 'menubar=1,location=1,toolbar=1,scrollbars=1,directories=1,status=1,resizable=1', 0); return false;}\" href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\" target=\"_blank\">".format_string($entry->glossaryname,true)."</a></p>"; // Could not get this to work satisfactorily in all cases - Martin
36 $entries[$key]->footer
= "<p style=\"text-align:right\">» <a href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname
,true)."</a></p>";
37 add_to_log($entry->courseid
, "glossary", "view entry", "showentry.php?eid=$entry->id", $entry->id
, $entry->cmid
);
41 if (!empty($courseid)) {
42 $course = get_record("course", "id", $courseid);
43 if ($course->id
!= SITEID
) {
44 require_login($courseid);
47 $strglossaries = get_string("modulenameplural", "glossary");
48 $strsearch = get_string("search");
50 $CFG->framename
= "newwindow";
51 if ($course->id
!= SITEID
) {
53 $navlinks[] = array('name' => $strglossaries, 'link' => '', 'type' => 'activity');
54 $navlinks[] = array('name' => $strsearch, 'link' => '', 'type' => 'title');
56 $navigation = build_navigation($navlinks);
58 print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname
, $navigation, "", "", true, " ", " ");
60 print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname
,
61 "$strglossaries -> $strsearch", "", "", true, " ", " ");
65 print_header(); // Needs to be something here to allow linking back to the whole glossary
69 glossary_print_dynaentry($courseid, $entries, $displayformat);
72 close_window_button();
74 /// Show one reduced footer