Merge branch 'MDL-40424-master' of git://github.com/FMCorz/moodle

Conflicts:
	admin/oacleanup.php
This commit is contained in:
Eloy Lafuente (stronk7) 2013-07-17 01:21:51 +02:00
commit fb1788c598
18 changed files with 105 additions and 46 deletions

View file

@ -276,7 +276,9 @@ function enrol_get_shared_courses($user1, $user2, $preloadcontexts = false, $che
$ctxselect = '';
$ctxjoin = '';
if ($preloadcontexts) {
list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
$ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
$params['contextlevel'] = CONTEXT_COURSE;
}
$sql = "SELECT c.* $ctxselect
@ -572,7 +574,9 @@ function enrol_get_my_courses($fields = NULL, $sort = 'visible DESC,sortorder AS
}
$coursefields = 'c.' .join(',c.', $fields);
list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$ccselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
$ccjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
$params['contextlevel'] = CONTEXT_COURSE;
$wheres = implode(" AND ", $wheres);
//note: we can not use DISTINCT + text fields due to Oracle and MS limitations, that is why we have the subselect there
@ -830,7 +834,9 @@ function enrol_get_all_users_courses($userid, $onlyactive = false, $fields = NUL
}
$coursefields = 'c.' .join(',c.', $fields);
list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$ccselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
$ccjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
$params['contextlevel'] = CONTEXT_COURSE;
//note: we can not use DISTINCT + text fields due to Oracle and MS limitations, that is why we have the subselect there
$sql = "SELECT $coursefields $ccselect