Done. Now:

- students only view entries from visible glossaries.
- teachers view any entry from their course and only visible from global glossaries.
- admins view any entry from any course and any entry from global glossaries too.

Part of bug 2566
(http://moodle.org/bugs/bug.php?op=show&bugid=2566)
This commit is contained in:
stronk7
2005-02-17 18:58:53 +00:00
parent c369e2107e
commit 6c3512329b
+28 -8
View File
@@ -490,19 +490,39 @@ function glossary_get_entries($glossaryid, $entrylist, $pivot = "") {
}
function glossary_get_entries_search($concept, $courseid) {
global $CFG;
//Check if the user is an admin
$bypassadmin = 1; //This means NO (by default)
if (isadmin()) {
$bypassadmin = 0; //This means YES
}
//Check if the user is a teacher
$bypassteacher = 1; //This means NO (by default)
if (isteacher($courseid)) {
$bypassteacher = 0; //This means YES
}
$conceptupper = strtoupper(trim($concept));
return get_records_sql("SELECT e.*, g.name as glossaryname
FROM {$CFG->prefix}glossary_entries e,
{$CFG->prefix}glossary g
WHERE e.glossaryid = g.id
AND ( (e.casesensitive != 0 and UPPER(concept) = '$conceptupper')
OR (e.casesensitive = 0 and concept = '$concept'))
AND (g.course = '$courseid' OR g.globalglossary = 1)
AND e.usedynalink != 0
AND g.usedynalink != 0");
FROM {$CFG->prefix}glossary_entries e,
{$CFG->prefix}glossary g,
{$CFG->prefix}course_modules cm,
{$CFG->prefix}modules m
WHERE m.name = 'glossary' AND
cm.module = m.id AND
(cm.visible = 1 OR cm.visible = $bypassadmin OR
(cm.course = '$courseid' AND cm.visible = $bypassteacher)) AND
g.id = cm.instance AND
e.glossaryid = g.id AND
( (e.casesensitive != 0 AND UPPER(concept) = '$conceptupper') OR
(e.casesensitive = 0 and concept = '$concept')) AND
(g.course = '$courseid' OR g.globalglossary = 1) AND
e.usedynalink != 0 AND
g.usedynalink != 0");
}
function glossary_get_entries_sorted($glossary, $where="", $orderby="", $pivot = "") {