Commit ade73d44 authored by Eloy Lafuente's avatar Eloy Lafuente Committed by Dan Poltawski
Browse files

Merge branch 'MDL-51495-m28' of https://github.com/NeillM/moodle into MOODLE_28_STABLE

parents 0fae5133 8102ded9
......@@ -173,6 +173,8 @@ class core_calendar_external extends external_api {
// Let us findout courses that we can return events from.
if (!$hassystemcap) {
$courses = enrol_get_my_courses('id');
$courses = array_keys($courses);
foreach ($params['events']['courseids'] as $id) {
try {
$context = context_course::instance($id);
......@@ -185,7 +187,6 @@ class core_calendar_external extends external_api {
'warningcode' => 'nopermissions',
'message' => 'No access rights in course context '.$e->getMessage().$e->getTraceAsString()
);
continue;
}
}
} else {
......
......@@ -363,6 +363,13 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
$events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
$this->assertEquals(1, count($events['events'])); // site.
$this->assertEquals(0, count($events['warnings']));
// Try getting a course event by its id.
$paramevents = array ('eventids' => array($courseevent->id));
$events = core_calendar_external::get_calendar_events($paramevents, $options);
$events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
$this->assertEquals(1, count($events['events']));
$this->assertEquals(0, count($events['warnings']));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment