mirror of
https://github.com/moodle/moodle.git
synced 2025-02-22 02:49:53 +01:00
(While I was at it I also turned the autologinguests off for most module pages, except on the index.php pages and the view.php pages for those modules that allow guests)
67 lines
2.9 KiB
PHP
67 lines
2.9 KiB
PHP
<?php // $Id$
|
|
require_once("../../config.php");
|
|
require_once("lib.php");
|
|
|
|
optional_variable($concept);
|
|
optional_variable($courseid,0);
|
|
optional_variable($eid,0); // glossary entry id
|
|
optional_variable($displayformat,-1);
|
|
|
|
if ($CFG->forcelogin) {
|
|
require_login();
|
|
}
|
|
|
|
if ($eid) {
|
|
$entry = get_record("glossary_entries", "id", $eid);
|
|
$glossary = get_record('glossary','id',$entry->glossaryid);
|
|
$entry->glossaryname = $glossary->name;
|
|
$entries[] = $entry;
|
|
if (!$cm = get_coursemodule_from_instance("glossary", $glossary->id)) {
|
|
error("Could not determine which course module this belonged to!");
|
|
}
|
|
if (!$cm->visible and !isteacher($cm->course)) {
|
|
redirect($CFG->wwwroot.'/course/view.php?id='.$cm->course, get_string('activityiscurrentlyhidden'));
|
|
}
|
|
} else if ($concept) {
|
|
$entries = glossary_get_entries_search($concept, $courseid);
|
|
} else {
|
|
error('No valid entry specified');
|
|
}
|
|
|
|
if ($entries) {
|
|
foreach ($entries as $key => $entry) {
|
|
//$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\">$entry->glossaryname</a></p>"; // Could not get this to work satisfactorily in all cases - Martin
|
|
$entries[$key]->footer = "<p align=\"right\">» <a target=\"_blank\" href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">$entry->glossaryname</a></p>";
|
|
}
|
|
}
|
|
|
|
if (!empty($courseid)) {
|
|
$course = get_record("course", "id", $courseid);
|
|
if ($course->category) {
|
|
require_login($courseid);
|
|
}
|
|
|
|
$strglossaries = get_string("modulenameplural", "glossary");
|
|
$strsearch = get_string("search");
|
|
|
|
$CFG->framename = "newwindow";
|
|
if ($course->category) {
|
|
print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
|
|
"<a target=\"newwindow\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $strglossaries -> $strsearch", "", "", true, " ", " ");
|
|
} else {
|
|
print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
|
|
"$strglossaries -> $strsearch", "", "", true, " ", " ");
|
|
}
|
|
|
|
} else {
|
|
print_header(); // Needs to be something here to allow linking back to the whole glossary
|
|
}
|
|
|
|
if ($entries) {
|
|
glossary_print_dynaentry($courseid, $entries, $displayformat);
|
|
}
|
|
|
|
close_window_button();
|
|
|
|
?>
|