Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 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: 16 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

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

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

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

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.

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
return: array

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.

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
return: array

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.

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
return: array

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.

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

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.

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

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.

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

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.

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.
return: array

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.

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
return: array

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.

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

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.

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

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.

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

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.

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

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.

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

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