Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

External calendar API

Copyright: 2012 Ankit Agarwal
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1477 lines (62 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_calendar_external:: (45 methods):
  delete_calendar_events_parameters()
  delete_calendar_events()
  delete_calendar_events_returns()
  get_calendar_events_parameters()
  get_calendar_events()
  get_calendar_events_returns()
  get_calendar_action_events_by_timesort_parameters()
  get_calendar_action_events_by_timesort()
  get_calendar_action_events_by_timesort_returns()
  get_calendar_action_events_by_course_parameters()
  get_calendar_action_events_by_course()
  get_calendar_action_events_by_course_returns()
  get_calendar_action_events_by_courses_parameters()
  get_calendar_action_events_by_courses()
  get_calendar_action_events_by_courses_returns()
  create_calendar_events_parameters()
  create_calendar_events()
  create_calendar_events_returns()
  get_calendar_event_by_id_parameters()
  get_calendar_event_by_id()
  get_calendar_event_by_id_returns()
  submit_create_update_form_parameters()
  submit_create_update_form()
  submit_create_update_form_returns()
  get_calendar_monthly_view()
  get_calendar_monthly_view_parameters()
  get_calendar_monthly_view_returns()
  get_calendar_day_view()
  get_calendar_day_view_parameters()
  get_calendar_day_view_returns()
  update_event_start_day_parameters()
  update_event_start_day()
  update_event_start_day_returns()
  get_calendar_upcoming_view()
  get_calendar_upcoming_view_parameters()
  get_calendar_upcoming_view_returns()
  get_calendar_access_information_parameters()
  get_calendar_access_information()
  get_calendar_access_information_returns()
  get_allowed_event_types_parameters()
  get_allowed_event_types()
  get_allowed_event_types_returns()
  get_timestamps()
  get_timestamps_parameters()
  get_timestamps_returns()


Class: core_calendar_external  - X-Ref

Calendar external functions

delete_calendar_events_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

delete_calendar_events($events)   X-Ref
Delete Calendar events

return: null
param: array $eventids A list of event ids with repeat flag to delete

delete_calendar_events_returns()   X-Ref
Returns description of method result value

return: external_description

get_calendar_events_parameters()   X-Ref
Returns description of method parameters

return: external_function_parameters

get_calendar_events($events = array()   X-Ref
Get Calendar events

return: array Array of event details
param: array $events A list of events
param: array $options various options

get_calendar_events_returns()   X-Ref
Returns description of method result value

return: external_description

get_calendar_action_events_by_timesort_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_action_events_by_timesort($timesortfrom = 0, $timesortto = null,$aftereventid = 0, $limitnum = 20, $limittononsuspendedevents = false,$userid = null, ?string $searchvalue = null)   X-Ref
Get calendar action events based on the timesort value.

return: array
param: null|int $timesortfrom Events after this time (inclusive)
param: null|int $timesortto Events before this time (inclusive)
param: null|int $aftereventid Get events with ids greater than this one
param: int $limitnum Limit the number of results to this value
param: null|int $userid The user id
param: string|null $searchvalue The value a user wishes to search against

get_calendar_action_events_by_timesort_returns()   X-Ref
Returns description of method result value.

return: external_description

get_calendar_action_events_by_course_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_action_events_by_course($courseid, $timesortfrom = null, $timesortto = null, $aftereventid = 0, $limitnum = 20, ?string $searchvalue = null)   X-Ref
Get calendar action events for the given course.

return: array
param: int $courseid Only events in this course
param: null|int $timesortfrom Events after this time (inclusive)
param: null|int $timesortto Events before this time (inclusive)
param: null|int $aftereventid Get events with ids greater than this one
param: int $limitnum Limit the number of results to this value
param: string|null $searchvalue The value a user wishes to search against

get_calendar_action_events_by_course_returns()   X-Ref
Returns description of method result value.

return: external_description

get_calendar_action_events_by_courses_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_action_events_by_courses(array $courseids, $timesortfrom = null, $timesortto = null, $limitnum = 10, ?string $searchvalue = null)   X-Ref
Get calendar action events for a given list of courses.

return: array
param: array $courseids Only include events for these courses
param: null|int $timesortfrom Events after this time (inclusive)
param: null|int $timesortto Events before this time (inclusive)
param: int $limitnum Limit the number of results per course to this value
param: string|null $searchvalue The value a user wishes to search against

get_calendar_action_events_by_courses_returns()   X-Ref
Returns description of method result value.

return: external_description

create_calendar_events_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters.

create_calendar_events($events)   X-Ref
Create calendar events.

return: array array of events created.
param: array $events A list of events to create.

create_calendar_events_returns()   X-Ref
Returns description of method result value.

return: external_description.

get_calendar_event_by_id_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_event_by_id($eventid)   X-Ref
Get calendar event by id.

return: array Array of event details
param: int $eventid The calendar event id to be retrieved.

get_calendar_event_by_id_returns()   X-Ref
Returns description of method result value

return: external_description

submit_create_update_form_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters.

submit_create_update_form($formdata)   X-Ref
Handles the event form submission.

return: array The created or modified event
param: string $formdata The event form data in a URI encoded param string

submit_create_update_form_returns()   X-Ref
Returns description of method result value.

return: external_description.

get_calendar_monthly_view($year, $month, $courseid, $categoryid, $includenavigation, $mini, $day,?string $view = null)   X-Ref
Get data for the monthly calendar view.

return: array
param: int $year The year to be shown
param: int $month The month to be shown
param: int $courseid The course to be included
param: int $categoryid The category to be included
param: bool $includenavigation Whether to include navigation
param: bool $mini Whether to return the mini month view or not
param: int $day The day we want to keep as the current day
param: string|null $view The view mode for the calendar.

get_calendar_monthly_view_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_monthly_view_returns()   X-Ref
Returns description of method result value.

return: external_description

get_calendar_day_view($year, $month, $day, $courseid, $categoryid)   X-Ref
Get data for the daily calendar view.

return: array
param: int     $year The year to be shown
param: int     $month The month to be shown
param: int     $day The day to be shown
param: int     $courseid The course to be included

get_calendar_day_view_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_day_view_returns()   X-Ref
Returns description of method result value.

return: external_description

update_event_start_day_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

update_event_start_day($eventid, $daytimestamp)   X-Ref
Change the start day for the given calendar event to the day that
corresponds with the provided timestamp.

The timestamp only needs to be anytime within the desired day as only
the date data is extracted from it.

The event's original time of day is maintained, only the date is shifted.

return: array
param: int $eventid Id of event to be updated
param: int $daytimestamp Timestamp for the new start day

update_event_start_day_returns()   X-Ref
Returns description of method result value.

return: external_description

get_calendar_upcoming_view($courseid, $categoryid)   X-Ref
Get data for the monthly calendar view.

return: array
param: int     $courseid The course to be included
param: int     $categoryid The category to be included

get_calendar_upcoming_view_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters

get_calendar_upcoming_view_returns()   X-Ref
Returns description of method result value.

return: external_description

get_calendar_access_information_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters.

get_calendar_access_information($courseid = 0)   X-Ref
Convenience function to retrieve some permissions information for the given course calendar.

return: array The access information
param: int $courseid Course to check, empty for site.

get_calendar_access_information_returns()   X-Ref
Returns description of method result value.

return: external_description.

get_allowed_event_types_parameters()   X-Ref
Returns description of method parameters.

return: external_function_parameters.

get_allowed_event_types($courseid = 0)   X-Ref
Get the type of events a user can create in the given course.

return: array The types allowed
param: int $courseid Course to check, empty for site.

get_allowed_event_types_returns()   X-Ref
Returns description of method result value.

return: external_description.

get_timestamps($datetimes)   X-Ref
Convert the specified dates into unix timestamps.

return: array Provided array of dates converted to unix timestamps
param: array $datetimes Array of arrays containing date time details, each in the format:

get_timestamps_parameters()   X-Ref
Describes the parameters for get_timestamps.

return: external_function_parameters

get_timestamps_returns()   X-Ref
Describes the timestamps return format.

return: external_single_structure