From: Eloy Lafuente Date: Sat, 5 Dec 2009 17:46:58 +0000 (+0000) Subject: MDL-21029 glossary - fix display of entries belonging to site/course global glossarie... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d3c68b087d188a031baca9b6f0050e5e29b5c971;p=moodle.git MDL-21029 glossary - fix display of entries belonging to site/course global glossaries ; merged from 19_STABLE --- diff --git a/mod/glossary/showentry.php b/mod/glossary/showentry.php index e804fea6c7..a395c9d6f6 100644 --- a/mod/glossary/showentry.php +++ b/mod/glossary/showentry.php @@ -40,13 +40,17 @@ if ($eid) { } if ($entries) { - $modinfo = get_fast_modinfo($course); foreach ($entries as $key => $entry) { + // Need to get the course where the entry is, + // in order to check for visibility/approve permissions there + $entrycourse = $DB->get_record('course', array('id', $entry->courseid), '*', MUST_EXIST); + $modinfo = get_fast_modinfo($entrycourse); // make sure the entry is visible if (empty($modinfo->cms[$entry->cmid]->uservisible)) { unset($entries[$key]); continue; } + // make sure the entry is approved (or approvable by current user) if (!$entry->approved and ($USER->id != $entry->userid)) { $context = get_context_instance(CONTEXT_MODULE, $entry->cmid); if (!has_capability('mod/glossary:approve', $context)) { @@ -54,7 +58,6 @@ if ($entries) { continue; } } - //$entries[$key]->footer = "

» 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)."

"; // Could not get this to work satisfactorily in all cases - Martin $entries[$key]->footer = "

» wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname,true)."

"; add_to_log($entry->courseid, 'glossary', 'view entry', "showentry.php?eid=$entry->id", $entry->id, $entry->cmid); }