Merged from MOODLE_14_STABLE moodle--eduforge--1.3.3--patch-305 - Postgres SQL bugfix for instance_is_visible()
This commit is contained in:
+12
-11
@@ -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!
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user