Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
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... | |
|
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.
string | $function | A webservice function name. |
array | $args | Params array (named params) |
boolean | $ajaxonly | If true, an extra check will be peformed to see if ajax is required. |
array | containing keys for error (bool), exception and data. |
|
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.
external_description | $description | description of the return values |
mixed | $response | the actual response |
mixed | response with added defaults for optional items, invalid_response_exception thrown if any problem found |
|
static |
Create calendar events.
array | $events | A list of events to create. |
array | array of events created. |
moodle_exception | if user doesnt have the permission to create events. |
|
static |
Returns description of method parameters.
external_function_parameters. |
|
static |
Returns description of method result value.
external_description. |
|
static |
Delete Calendar events.
array | $eventids | A list of event ids with repeat flag to delete |
null |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
staticinherited |
Returns detailed function information.
string | object | $function | name of external function or record from external_function |
int | $strictness | IGNORE_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 |
stdClass | description or false if not found or exception thrown |
|
static |
Get the type of events a user can create in the given course.
int | $courseid | Course to check, empty for site. |
array | The types allowed |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters. |
|
static |
Returns description of method result value.
external_description. |
|
static |
Convenience function to retrieve some permissions information for the given course calendar.
int | $courseid | Course to check, empty for site. |
array | The access information |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters. |
|
static |
Returns description of method result value.
external_description. |
|
static |
Get calendar action events for the given course.
int | $courseid | Only events in this course |
null | int | $timesortfrom | Events after this time (inclusive) |
null | int | $timesortto | Events before this time (inclusive) |
null | int | $aftereventid | Get events with ids greater than this one |
int | $limitnum | Limit the number of results to this value |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Get calendar action events for a given list of courses.
array | $courseids | Only include events for these courses |
null | int | $timesortfrom | Events after this time (inclusive) |
null | int | $timesortto | Events before this time (inclusive) |
int | $limitnum | Limit the number of results per course to this value |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Get calendar action events based on the timesort value.
null | int | $timesortfrom | Events after this time (inclusive) |
null | int | $timesortto | Events before this time (inclusive) |
null | int | $aftereventid | Get events with ids greater than this one |
int | $limitnum | Limit the number of results to this value |
null | int | $userid | The user id |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Get data for the daily calendar view.
int | $year | The year to be shown |
int | $month | The month to be shown |
int | $day | The day to be shown |
int | $courseid | The course to be included |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Get calendar event by id.
int | $eventid | The calendar event id to be retrieved. |
array | Array of event details |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Get Calendar events.
array | $events | A list of events |
array | $options | various options |
array | Array of event details |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
|
static |
Get data for the monthly calendar view.
int | $year | The year to be shown |
int | $month | The month to be shown |
int | $courseid | The course to be included |
int | $categoryid | The category to be included |
bool | $includenavigation | Whether to include navigation |
bool | $mini | Whether to return the mini month view or not |
int | $day | The day we want to keep as the current day |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
static |
Get data for the monthly calendar view.
int | $courseid | The course to be included |
int | $categoryid | The category to be included |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
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.
array | $param |
invalid_parameter_exception |
context |
|
staticprotectedinherited |
Returns a prepared structure to use a context parameters.
external_single_structure |
Reimplemented in tool_lp\external, and core_competency\external.
|
static |
Convert the specified dates into unix timestamps.
array | $datetimes | Array 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)] |
array | Provided array of dates converted to unix timestamps |
moodle_exception | If one or more of the dates provided does not convert to a valid timestamp. |
|
static |
Describes the parameters for get_timestamps.
external_function_parameters |
|
static |
Describes the timestamps return format.
external_single_structure |
|
staticinherited |
Set context restriction for all following subsequent function calls.
stdClass | $context | the context restriction |
|
staticinherited |
This method has to be called before every operation that takes a longer time to finish!
int | $seconds | max expected time the next operation needs |
|
static |
Handles the event form submission.
string | $formdata | The event form data in a URI encoded param string |
array | The created or modified event |
moodle_exception |
|
static |
Returns description of method parameters.
external_function_parameters. |
|
static |
Returns description of method result value.
external_description. |
|
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.
int | $eventid | Id of event to be updated |
int | $daytimestamp | Timestamp for the new start day |
array |
|
static |
Returns description of method parameters.
external_function_parameters |
|
static |
Returns description of method result value.
external_description |
|
staticinherited |
Makes sure user may execute functions in this context.
stdClass | $context |
|
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.
external_description | $description | description of parameters |
mixed | $params | the actual parameters |
mixed | params with added defaults for optional items, invalid_parameters_exception thrown if any problem found |