mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'MDL-40424-master' of git://github.com/FMCorz/moodle
Conflicts: admin/oacleanup.php
This commit is contained in:
commit
fb1788c598
18 changed files with 105 additions and 46 deletions
|
@ -458,8 +458,9 @@ class core_enrol_external extends external_api {
|
|||
}
|
||||
|
||||
list($enrolledsql, $enrolledparams) = get_enrolled_sql($coursecontext, $withcapability, $groupid, $onlyactive);
|
||||
list($ctxselect, $ctxjoin) = context_instance_preload_sql('u.id', CONTEXT_USER, 'ctx');
|
||||
$sqlparams['courseid'] = $courseid;
|
||||
$ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
|
||||
$ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = :contextlevel)";
|
||||
$enrolledparams['contextlevel'] = CONTEXT_USER;
|
||||
$sql = "SELECT u.* $ctxselect
|
||||
FROM {user} u $ctxjoin
|
||||
WHERE u.id IN ($enrolledsql)
|
||||
|
|
|
@ -40,9 +40,10 @@ class enrol_meta_addinstance_form extends moodleform {
|
|||
|
||||
// TODO: this has to be done via ajax or else it will fail very badly on large sites!
|
||||
$courses = array('' => get_string('choosedots'));
|
||||
list ($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
|
||||
$select = ', ' . context_helper::get_preload_record_columns_sql('ctx');
|
||||
$join = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
|
||||
$sql = "SELECT c.id, c.fullname, c.shortname, c.visible $select FROM {course} c $join ORDER BY c.sortorder ASC";
|
||||
$rs = $DB->get_recordset_sql($sql);
|
||||
$rs = $DB->get_recordset_sql($sql, array('contextlevel' => CONTEXT_COURSE));
|
||||
foreach ($rs as $c) {
|
||||
if ($c->id == SITEID or $c->id == $course->id or isset($existing[$c->id])) {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue