mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-12263, under certain conditions, $catctxids is NULL, so an if statement should be here.
This commit is contained in:
parent
a5fe6177d6
commit
c7a7112781
@ -685,7 +685,8 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a
|
|||||||
}
|
}
|
||||||
$ctxids = array_unique($ctxids);
|
$ctxids = array_unique($ctxids);
|
||||||
$catctxids = implode( ',' , $ctxids);
|
$catctxids = implode( ',' , $ctxids);
|
||||||
unset($catpaths);unset($cpath);
|
unset($catpaths);
|
||||||
|
unset($cpath);
|
||||||
} else {
|
} else {
|
||||||
// take the ctx path from the first course
|
// take the ctx path from the first course
|
||||||
// as all categories will be the same...
|
// as all categories will be the same...
|
||||||
@ -718,12 +719,17 @@ function get_courses_wmanagers($categoryid=0, $sort="c.sortorder ASC", $fields=a
|
|||||||
ON ra.roleid = r.id
|
ON ra.roleid = r.id
|
||||||
LEFT OUTER JOIN {$CFG->prefix}course c
|
LEFT OUTER JOIN {$CFG->prefix}course c
|
||||||
ON (ctx.instanceid=c.id AND ctx.contextlevel=".CONTEXT_COURSE.")
|
ON (ctx.instanceid=c.id AND ctx.contextlevel=".CONTEXT_COURSE.")
|
||||||
WHERE ( c.id IS NOT NULL
|
WHERE ( c.id IS NOT NULL";
|
||||||
OR ra.contextid IN ($catctxids) )
|
// under certain conditions, $catctxids is NULL
|
||||||
AND ra.roleid IN ({$CFG->coursemanager})
|
if($catctxids == NULL){
|
||||||
|
$sql .= ") ";
|
||||||
|
}else{
|
||||||
|
$sql .= " OR ra.contextid IN ($catctxids) )";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql .= "AND ra.roleid IN ({$CFG->coursemanager})
|
||||||
$categoryclause
|
$categoryclause
|
||||||
ORDER BY r.sortorder ASC, ctx.contextlevel ASC, ra.sortorder ASC";
|
ORDER BY r.sortorder ASC, ctx.contextlevel ASC, ra.sortorder ASC";
|
||||||
|
|
||||||
$rs = get_recordset_sql($sql);
|
$rs = get_recordset_sql($sql);
|
||||||
|
|
||||||
// This loop is fairly stupid as it stands - might get better
|
// This loop is fairly stupid as it stands - might get better
|
||||||
|
Loading…
x
Reference in New Issue
Block a user