Merged from MOODLE_14_STABLE moodle--eduforge--1.3.3--patch-305 - Postgres SQL bugfix for instance_is_visible()

This commit is contained in:
martinlanghoff
2004-11-18 02:37:52 +00:00
parent 362d9c0e7e
commit 2b49ae96a6
+12 -11
View File
@@ -2494,19 +2494,20 @@ function instance_is_visible($moduletype, $module) {
global $CFG;
if ($records = get_records_sql("SELECT cm.instance, cm.visible
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules m
WHERE cm.course = '$module->course' AND
cm.module = m.id AND
m.name = '$moduletype' AND
cm.instance = '$module->id'")) {
foreach ($records as $record) { // there should only be one - use the first one
return $record->visible;
if (!empty($module->id)) {
if ($records = get_records_sql("SELECT cm.instance, cm.visible
FROM {$CFG->prefix}course_modules cm,
{$CFG->prefix}modules m
WHERE cm.course = '$module->course' AND
cm.module = m.id AND
m.name = '$moduletype' AND
cm.instance = '$module->id'")) {
foreach ($records as $record) { // there should only be one - use the first one
return $record->visible;
}
}
}
return true; // visible by default!
}