MDL-48285 webservices: default timeend to infinity and beyond

This commit is contained in:
David Monllao 2014-11-19 10:42:15 +08:00 committed by Dan Poltawski
parent 951af91e08
commit e07e04c123
2 changed files with 12 additions and 2 deletions

View File

@ -142,8 +142,8 @@ class core_calendar_external extends external_api {
"Time from which events should be returned",
VALUE_DEFAULT, 0, NULL_ALLOWED),
'timeend' => new external_value(PARAM_INT,
"Time to which the events should be returned",
VALUE_DEFAULT, time(), NULL_ALLOWED),
"Time to which the events should be returned. We treat 0 and null as no end",
VALUE_DEFAULT, 0, NULL_ALLOWED),
'ignorehidden' => new external_value(PARAM_BOOL,
"Ignore hidden events or not",
VALUE_DEFAULT, true, NULL_ALLOWED),
@ -215,6 +215,11 @@ class core_calendar_external extends external_api {
$funcparam['courses'][] = $SITE->id;
}
// We treat 0 and null as no end.
if (empty($params['options']['timeend'])) {
$params['options']['timeend'] = PHP_INT_MAX;
}
$eventlist = calendar_get_events($params['options']['timestart'], $params['options']['timeend'], $funcparam['users'], $funcparam['groups'],
$funcparam['courses'], true, $params['options']['ignorehidden']);
// WS expects arrays.

View File

@ -1,6 +1,11 @@
This files describes API changes in /calendar/* ,
information provided here is intended especially for developers.
=== 2.9 ===
default values changes in code:
* core_calendar_external::get_calendar_events_parameters() 'timeend' default option changed; now, by default,
all events are returned, not only the past ones.
=== 2.5 ===
required changes in code:
* calendar_add_icalendar_event() now requires a valid subscriptionid