mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Merge branch 'MDL-32340-master-2' of git://git.luns.net.uk/moodle
This commit is contained in:
commit
04d7103804
@ -1491,15 +1491,16 @@ function calendar_get_default_courses() {
|
||||
}
|
||||
|
||||
$courses = array();
|
||||
if (!empty($CFG->calendar_adminseesall) && has_capability('moodle/calendar:manageentries', get_context_instance(CONTEXT_SYSTEM))) {
|
||||
if (!empty($CFG->calendar_adminseesall) && has_capability('moodle/calendar:manageentries', context_system::instance())) {
|
||||
list ($select, $join) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
|
||||
$sql = "SELECT DISTINCT c.* $select
|
||||
$sql = "SELECT c.* $select
|
||||
FROM {course} c
|
||||
JOIN {event} e ON e.courseid = c.id
|
||||
$join";
|
||||
$join
|
||||
WHERE EXISTS (SELECT 1 FROM {event} e WHERE e.courseid = c.id)
|
||||
";
|
||||
$courses = $DB->get_records_sql($sql, null, 0, 20);
|
||||
foreach ($courses as $course) {
|
||||
context_instance_preload($course);
|
||||
context_helper::preload_from_record($course);
|
||||
}
|
||||
return $courses;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user