Fixed a little bug when glossary filter called from front page or

anywhere else a course is not defined
This commit is contained in:
moodler 2004-03-09 16:30:36 +00:00
parent 15ba837b5b
commit 940fca1a36

View file

@ -7,17 +7,23 @@
} }
function glossary_dynamic_link($courseid, $text) { function glossary_dynamic_link($courseid, $text) {
global $CFG; global $CFG;
if (empty($courseid)) {
if ($site = get_site()) {
$courseid = $site->id;
}
}
$GLOSSARY_CONCEPT_IS_ENTRY = 0; $GLOSSARY_CONCEPT_IS_ENTRY = 0;
$GLOSSARY_CONCEPT_IS_CATEGORY = 1; $GLOSSARY_CONCEPT_IS_CATEGORY = 1;
switch ($CFG->dbtype) { switch ($CFG->dbtype) {
case 'postgres7': case 'postgres7':
$as = 'as'; $as = 'as';
break; break;
case 'mysql': case 'mysql':
$as = ''; $as = '';
break; break;
} }
$glossarieslist = get_records_select("glossary", "usedynalink != 0 and (course = $courseid or globalglossary != 0)","globalglossary, id"); $glossarieslist = get_records_select("glossary", "usedynalink != 0 and (course = $courseid or globalglossary != 0)","globalglossary, id");