Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
core_calendar_external Class Reference
Inheritance diagram for core_calendar_external:
external_api

Static Public Member Functions

static call_external_function ($function, $args, $ajaxonly=false)
 Call an external function validating all params/returns correctly. More...
 
static clean_returnvalue (external_description $description, $response)
 Clean response If a response attribute is unknown from the description, we just ignore the attribute. More...
 
static create_calendar_events ($events)
 Create calendar events. More...
 
static create_calendar_events_parameters ()
 Returns description of method parameters. More...
 
static create_calendar_events_returns ()
 Returns description of method result value. More...
 
static delete_calendar_events ($events)
 Delete Calendar events. More...
 
static delete_calendar_events_parameters ()
 Returns description of method parameters. More...
 
static delete_calendar_events_returns ()
 Returns description of method result value. More...
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information. More...
 
static get_allowed_event_types ($courseid=0)
 Get the type of events a user can create in the given course. More...
 
static get_allowed_event_types_parameters ()
 Returns description of method parameters. More...
 
static get_allowed_event_types_returns ()
 Returns description of method result value. More...
 
static get_calendar_access_information ($courseid=0)
 Convenience function to retrieve some permissions information for the given course calendar. More...
 
static get_calendar_access_information_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_access_information_returns ()
 Returns description of method result value. More...
 
static get_calendar_action_events_by_course ( $courseid, $timesortfrom=null, $timesortto=null, $aftereventid=0, $limitnum=20)
 Get calendar action events for the given course. More...
 
static get_calendar_action_events_by_course_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_action_events_by_course_returns ()
 Returns description of method result value. More...
 
static get_calendar_action_events_by_courses (array $courseids, $timesortfrom=null, $timesortto=null, $limitnum=10)
 Get calendar action events for a given list of courses. More...
 
static get_calendar_action_events_by_courses_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_action_events_by_courses_returns ()
 Returns description of method result value. More...
 
static get_calendar_action_events_by_timesort ($timesortfrom=0, $timesortto=null, $aftereventid=0, $limitnum=20, $limittononsuspendedevents=false, $userid=null)
 Get calendar action events based on the timesort value. More...
 
static get_calendar_action_events_by_timesort_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_action_events_by_timesort_returns ()
 Returns description of method result value. More...
 
static get_calendar_day_view ($year, $month, $day, $courseid, $categoryid)
 Get data for the daily calendar view. More...
 
static get_calendar_day_view_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_day_view_returns ()
 Returns description of method result value. More...
 
static get_calendar_event_by_id ($eventid)
 Get calendar event by id. More...
 
static get_calendar_event_by_id_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_event_by_id_returns ()
 Returns description of method result value. More...
 
static get_calendar_events ($events=array(), $options=array())
 Get Calendar events. More...
 
static get_calendar_events_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_events_returns ()
 Returns description of method result value. More...
 
static get_calendar_monthly_view ($year, $month, $courseid, $categoryid, $includenavigation, $mini, $day)
 Get data for the monthly calendar view. More...
 
static get_calendar_monthly_view_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_monthly_view_returns ()
 Returns description of method result value. More...
 
static get_calendar_upcoming_view ($courseid, $categoryid)
 Get data for the monthly calendar view. More...
 
static get_calendar_upcoming_view_parameters ()
 Returns description of method parameters. More...
 
static get_calendar_upcoming_view_returns ()
 Returns description of method result value. More...
 
static get_timestamps ($datetimes)
 Convert the specified dates into unix timestamps. More...
 
static get_timestamps_parameters ()
 Describes the parameters for get_timestamps. More...
 
static get_timestamps_returns ()
 Describes the timestamps return format. More...
 
static set_context_restriction ($context)
 Set context restriction for all following subsequent function calls. More...
 
static set_timeout ($seconds=360)
 This method has to be called before every operation that takes a longer time to finish! More...
 
static submit_create_update_form ($formdata)
 Handles the event form submission. More...
 
static submit_create_update_form_parameters ()
 Returns description of method parameters. More...
 
static submit_create_update_form_returns ()
 Returns description of method result value. More...
 
static update_event_start_day ($eventid, $daytimestamp)
 Change the start day for the given calendar event to the day that corresponds with the provided timestamp. More...
 
static update_event_start_day_parameters ()
 Returns description of method parameters. More...
 
static update_event_start_day_returns ()
 Returns description of method result value. More...
 
static validate_context ($context)
 Makes sure user may execute functions in this context. More...
 
static validate_parameters (external_description $description, $params)
 Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. More...
 

Static Protected Member Functions

static get_context_from_params ($param)
 Get context from passed parameters. More...
 
static get_context_parameters ()
 Returns a prepared structure to use a context parameters. More...
 

Member Function Documentation

◆ call_external_function()

static external_api::call_external_function (   $function,
  $args,
  $ajaxonly = false 
)
staticinherited

Call an external function validating all params/returns correctly.

Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.

Parameters
string$functionA webservice function name.
array$argsParams array (named params)
boolean$ajaxonlyIf true, an extra check will be peformed to see if ajax is required.
Return values
arraycontaining keys for error (bool), exception and data.

◆ clean_returnvalue()

static external_api::clean_returnvalue ( external_description  $description,
  $response 
)
staticinherited

Clean response If a response attribute is unknown from the description, we just ignore the attribute.

If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.

Parameters
external_description$descriptiondescription of the return values
mixed$responsethe actual response
Return values
mixedresponse with added defaults for optional items, invalid_response_exception thrown if any problem found
Author
2010 Jerome Mouneyrac
Since
Moodle 2.0

◆ create_calendar_events()

static core_calendar_external::create_calendar_events (   $events)
static

Create calendar events.

Parameters
array$eventsA list of events to create.
Return values
arrayarray of events created.
Since
Moodle 2.5
Exceptions
moodle_exceptionif user doesnt have the permission to create events.

◆ create_calendar_events_parameters()

static core_calendar_external::create_calendar_events_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters.
Since
Moodle 2.5

◆ create_calendar_events_returns()

static core_calendar_external::create_calendar_events_returns ( )
static

Returns description of method result value.

Return values
external_description.
Since
Moodle 2.5

◆ delete_calendar_events()

static core_calendar_external::delete_calendar_events (   $events)
static

Delete Calendar events.

Parameters
array$eventidsA list of event ids with repeat flag to delete
Return values
null
Since
Moodle 2.5

◆ delete_calendar_events_parameters()

static core_calendar_external::delete_calendar_events_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.5

◆ delete_calendar_events_returns()

static core_calendar_external::delete_calendar_events_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.5

◆ external_function_info()

static external_api::external_function_info (   $function,
  $strictness = MUST_EXIST 
)
staticinherited

Returns detailed function information.

Parameters
string | object$functionname of external function or record from external_function
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClassdescription or false if not found or exception thrown
Since
Moodle 2.0

◆ get_allowed_event_types()

static core_calendar_external::get_allowed_event_types (   $courseid = 0)
static

Get the type of events a user can create in the given course.

Parameters
int$courseidCourse to check, empty for site.
Return values
arrayThe types allowed
Exceptions
moodle_exception
Since
Moodle 3.7

◆ get_allowed_event_types_parameters()

static core_calendar_external::get_allowed_event_types_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters.
Since
Moodle 3.7

◆ get_allowed_event_types_returns()

static core_calendar_external::get_allowed_event_types_returns ( )
static

Returns description of method result value.

Return values
external_description.
Since
Moodle 3.7

◆ get_calendar_access_information()

static core_calendar_external::get_calendar_access_information (   $courseid = 0)
static

Convenience function to retrieve some permissions information for the given course calendar.

Parameters
int$courseidCourse to check, empty for site.
Return values
arrayThe access information
Exceptions
moodle_exception
Since
Moodle 3.7

◆ get_calendar_access_information_parameters()

static core_calendar_external::get_calendar_access_information_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters.
Since
Moodle 3.7

◆ get_calendar_access_information_returns()

static core_calendar_external::get_calendar_access_information_returns ( )
static

Returns description of method result value.

Return values
external_description.
Since
Moodle 3.7

◆ get_calendar_action_events_by_course()

static core_calendar_external::get_calendar_action_events_by_course (   $courseid,
  $timesortfrom = null,
  $timesortto = null,
  $aftereventid = 0,
  $limitnum = 20 
)
static

Get calendar action events for the given course.

Since
Moodle 3.3
Parameters
int$courseidOnly events in this course
null | int$timesortfromEvents after this time (inclusive)
null | int$timesorttoEvents before this time (inclusive)
null | int$aftereventidGet events with ids greater than this one
int$limitnumLimit the number of results to this value
Return values
array

◆ get_calendar_action_events_by_course_parameters()

static core_calendar_external::get_calendar_action_events_by_course_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_calendar_action_events_by_course_returns()

static core_calendar_external::get_calendar_action_events_by_course_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_calendar_action_events_by_courses()

static core_calendar_external::get_calendar_action_events_by_courses ( array  $courseids,
  $timesortfrom = null,
  $timesortto = null,
  $limitnum = 10 
)
static

Get calendar action events for a given list of courses.

Since
Moodle 3.3
Parameters
array$courseidsOnly include events for these courses
null | int$timesortfromEvents after this time (inclusive)
null | int$timesorttoEvents before this time (inclusive)
int$limitnumLimit the number of results per course to this value
Return values
array

◆ get_calendar_action_events_by_courses_parameters()

static core_calendar_external::get_calendar_action_events_by_courses_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_calendar_action_events_by_courses_returns()

static core_calendar_external::get_calendar_action_events_by_courses_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_calendar_action_events_by_timesort()

static core_calendar_external::get_calendar_action_events_by_timesort (   $timesortfrom = 0,
  $timesortto = null,
  $aftereventid = 0,
  $limitnum = 20,
  $limittononsuspendedevents = false,
  $userid = null 
)
static

Get calendar action events based on the timesort value.

Since
Moodle 3.3
Parameters
null | int$timesortfromEvents after this time (inclusive)
null | int$timesorttoEvents before this time (inclusive)
null | int$aftereventidGet events with ids greater than this one
int$limitnumLimit the number of results to this value
null | int$useridThe user id
Return values
array

◆ get_calendar_action_events_by_timesort_parameters()

static core_calendar_external::get_calendar_action_events_by_timesort_parameters ( )
static

Returns description of method parameters.

Since
Moodle 3.3
Return values
external_function_parameters

◆ get_calendar_action_events_by_timesort_returns()

static core_calendar_external::get_calendar_action_events_by_timesort_returns ( )
static

Returns description of method result value.

Since
Moodle 3.3
Return values
external_description

◆ get_calendar_day_view()

static core_calendar_external::get_calendar_day_view (   $year,
  $month,
  $day,
  $courseid,
  $categoryid 
)
static

Get data for the daily calendar view.

Parameters
int$yearThe year to be shown
int$monthThe month to be shown
int$dayThe day to be shown
int$courseidThe course to be included
Return values
array

◆ get_calendar_day_view_parameters()

static core_calendar_external::get_calendar_day_view_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_calendar_day_view_returns()

static core_calendar_external::get_calendar_day_view_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_calendar_event_by_id()

static core_calendar_external::get_calendar_event_by_id (   $eventid)
static

Get calendar event by id.

Parameters
int$eventidThe calendar event id to be retrieved.
Return values
arrayArray of event details

◆ get_calendar_event_by_id_parameters()

static core_calendar_external::get_calendar_event_by_id_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_calendar_event_by_id_returns()

static core_calendar_external::get_calendar_event_by_id_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_calendar_events()

static core_calendar_external::get_calendar_events (   $events = array(),
  $options = array() 
)
static

Get Calendar events.

Parameters
array$eventsA list of events
array$optionsvarious options
Return values
arrayArray of event details
Since
Moodle 2.5

◆ get_calendar_events_parameters()

static core_calendar_external::get_calendar_events_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters
Since
Moodle 2.5

◆ get_calendar_events_returns()

static core_calendar_external::get_calendar_events_returns ( )
static

Returns description of method result value.

Return values
external_description
Since
Moodle 2.5

◆ get_calendar_monthly_view()

static core_calendar_external::get_calendar_monthly_view (   $year,
  $month,
  $courseid,
  $categoryid,
  $includenavigation,
  $mini,
  $day 
)
static

Get data for the monthly calendar view.

Parameters
int$yearThe year to be shown
int$monthThe month to be shown
int$courseidThe course to be included
int$categoryidThe category to be included
bool$includenavigationWhether to include navigation
bool$miniWhether to return the mini month view or not
int$dayThe day we want to keep as the current day
Return values
array

◆ get_calendar_monthly_view_parameters()

static core_calendar_external::get_calendar_monthly_view_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_calendar_monthly_view_returns()

static core_calendar_external::get_calendar_monthly_view_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_calendar_upcoming_view()

static core_calendar_external::get_calendar_upcoming_view (   $courseid,
  $categoryid 
)
static

Get data for the monthly calendar view.

Parameters
int$courseidThe course to be included
int$categoryidThe category to be included
Return values
array

◆ get_calendar_upcoming_view_parameters()

static core_calendar_external::get_calendar_upcoming_view_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ get_calendar_upcoming_view_returns()

static core_calendar_external::get_calendar_upcoming_view_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ get_context_from_params()

static external_api::get_context_from_params (   $param)
staticprotectedinherited

Get context from passed parameters.

The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.

See context_helper::get_all_levels() for a list of valid context levels.

Parameters
array$param
Since
Moodle 2.6
Exceptions
invalid_parameter_exception
Return values
context

◆ get_context_parameters()

static external_api::get_context_parameters ( )
staticprotectedinherited

Returns a prepared structure to use a context parameters.

Return values
external_single_structure

Reimplemented in tool_lp\external, and core_competency\external.

◆ get_timestamps()

static core_calendar_external::get_timestamps (   $datetimes)
static

Convert the specified dates into unix timestamps.

Parameters
array$datetimesArray of arrays containing date time details, each in the format: ['year' => a, 'month' => b, 'day' => c, 'hour' => d (optional), 'minute' => e (optional), 'key' => 'x' (optional)]
Return values
arrayProvided array of dates converted to unix timestamps
Exceptions
moodle_exceptionIf one or more of the dates provided does not convert to a valid timestamp.

◆ get_timestamps_parameters()

static core_calendar_external::get_timestamps_parameters ( )
static

Describes the parameters for get_timestamps.

Return values
external_function_parameters

◆ get_timestamps_returns()

static core_calendar_external::get_timestamps_returns ( )
static

Describes the timestamps return format.

Return values
external_single_structure

◆ set_context_restriction()

static external_api::set_context_restriction (   $context)
staticinherited

Set context restriction for all following subsequent function calls.

Parameters
stdClass$contextthe context restriction
Since
Moodle 2.0

◆ set_timeout()

static external_api::set_timeout (   $seconds = 360)
staticinherited

This method has to be called before every operation that takes a longer time to finish!

Parameters
int$secondsmax expected time the next operation needs
Since
Moodle 2.0

◆ submit_create_update_form()

static core_calendar_external::submit_create_update_form (   $formdata)
static

Handles the event form submission.

Parameters
string$formdataThe event form data in a URI encoded param string
Return values
arrayThe created or modified event
Exceptions
moodle_exception

◆ submit_create_update_form_parameters()

static core_calendar_external::submit_create_update_form_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters.

◆ submit_create_update_form_returns()

static core_calendar_external::submit_create_update_form_returns ( )
static

Returns description of method result value.

Return values
external_description.

◆ update_event_start_day()

static core_calendar_external::update_event_start_day (   $eventid,
  $daytimestamp 
)
static

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.

Parameters
int$eventidId of event to be updated
int$daytimestampTimestamp for the new start day
Return values
array

◆ update_event_start_day_parameters()

static core_calendar_external::update_event_start_day_parameters ( )
static

Returns description of method parameters.

Return values
external_function_parameters

◆ update_event_start_day_returns()

static core_calendar_external::update_event_start_day_returns ( )
static

Returns description of method result value.

Return values
external_description

◆ validate_context()

static external_api::validate_context (   $context)
staticinherited

Makes sure user may execute functions in this context.

Parameters
stdClass$context
Since
Moodle 2.0

◆ validate_parameters()

static external_api::validate_parameters ( external_description  $description,
  $params 
)
staticinherited

Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.

This is a simple recursive method which is intended to be called from each implementation method of external API.

Parameters
external_description$descriptiondescription of parameters
mixed$paramsthe actual parameters
Return values
mixedparams with added defaults for optional items, invalid_parameters_exception thrown if any problem found
Since
Moodle 2.0

The documentation for this class was generated from the following file: