mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
Assignment MDL-23192
- fixed query to reflect updated field name mdl_block_instances.contextid->mdl_block_instances.parentcontextid - fixed records iteration.
This commit is contained in:
parent
7054b01d38
commit
ba138d4730
@ -131,14 +131,14 @@
|
|||||||
// get list of courses containing blocks if required
|
// get list of courses containing blocks if required
|
||||||
if (!empty($blocklist) and confirm_sesskey()) {
|
if (!empty($blocklist) and confirm_sesskey()) {
|
||||||
$blockname = $DB->get_field('block', 'name', array('id' => $blocklist));
|
$blockname = $DB->get_field('block', 'name', array('id' => $blocklist));
|
||||||
$courses = $DB->get_recordset_sql("
|
$courses = array();
|
||||||
|
$courses = $DB->get_records_sql("
|
||||||
SELECT * FROM {course} WHERE id IN (
|
SELECT * FROM {course} WHERE id IN (
|
||||||
SELECT DISTINCT ctx.instanceid
|
SELECT DISTINCT ctx.instanceid
|
||||||
FROM {context} ctx
|
FROM {context} ctx
|
||||||
JOIN {block_instances} bi ON bi.contextid = ctx.id
|
JOIN {block_instances} bi ON bi.parentcontextid = ctx.id
|
||||||
WHERE ctx.contextlevel = " . CONTEXT_COURSE . " AND bi.blockname = ?)",
|
WHERE ctx.contextlevel = " . CONTEXT_COURSE . " AND bi.blockname = ?)",
|
||||||
array($blockname));
|
array($blockname));
|
||||||
$courses = array();
|
|
||||||
foreach ($courses as $course) {
|
foreach ($courses as $course) {
|
||||||
$courses[$course->id] = $course;
|
$courses[$course->id] = $course;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user