Base class for external api methods.
More...
Inherited by auth_email_external, block_accessreview\external\get_module_data, block_accessreview\external\get_section_data, block_recentlyaccesseditems\external, core\external\dynamic_tabs_get_content, core\external\editmode, core\external\output\icon_system\load_fontawesome_map, core\external\record_userfeedback_action, core\output\external, core\session\external, core_auth_external, core_backup_external, core_badges_external, core_block\external\fetch_addable_blocks, core_block_external, core_blog\external, core_calendar\external\export\token, core_calendar\external\subscription\delete, core_calendar_external, core_comment_external, core_competency\external, core_completion_external, core_contentbank\external\delete_content, core_contentbank\external\rename_content, core_contentbank\external\set_content_visibility, core_course\external\get_enrolled_courses_with_action_events_by_timeline_classification, core_course_external, core_courseformat\external\get_state, core_courseformat\external\update_course, core_customfield_external, core_enrol_external, core_external, core_files\external\delete\draft, core_files\external\get\unused_draft, core_files_external, core_filters\external, core_form\external, core_form\external\dynamic_form, core_grades\external\create_gradecategories, core_grades\external\get_enrolled_users_for_search_widget, core_grades\external\get_gradable_users, core_grades\external\get_groups_for_search_widget, core_grades\grades\grader\gradingpanel\point\external\fetch, core_grades\grades\grader\gradingpanel\point\external\store, core_grades\grades\grader\gradingpanel\scale\external\fetch, core_grades\grades\grader\gradingpanel\scale\external\store, core_grades_external, core_grading_external, core_group_external, core_h5p\external, core_message\external\get_unread_notification_count, core_message_external, core_payment\external\get_available_gateways, core_question_external, core_rating_external, core_reportbuilder\external\audiences\delete, core_reportbuilder\external\columns\add, core_reportbuilder\external\columns\delete, core_reportbuilder\external\columns\reorder, core_reportbuilder\external\columns\sort\get, core_reportbuilder\external\columns\sort\reorder, core_reportbuilder\external\columns\sort\toggle, core_reportbuilder\external\conditions\add, core_reportbuilder\external\conditions\delete, core_reportbuilder\external\conditions\reorder, core_reportbuilder\external\conditions\reset, core_reportbuilder\external\filters\add, core_reportbuilder\external\filters\delete, core_reportbuilder\external\filters\reorder, core_reportbuilder\external\filters\reset, core_reportbuilder\external\filters\set, core_reportbuilder\external\reports\delete, core_reportbuilder\external\reports\get, core_reportbuilder\external\reports\listing, core_reportbuilder\external\reports\retrieve, core_reportbuilder\external\reports\view, core_reportbuilder\external\schedules\delete, core_reportbuilder\external\schedules\send, core_reportbuilder\external\schedules\toggle, core_role_external, core_search\external, core_table\external\dynamic\get, core_tag_external, core_user\external\search_identity, core_user\external\update_user_device_public_key, core_user_external, core_webservice_external, core_xapi\external\post_statement, enrol_guest_external, enrol_manual_external, enrol_meta\external\add_instances, enrol_meta\external\delete_instances, enrol_self_external, gradereport_overview_external, gradereport_user\external\user, gradingform_guide\grades\grader\gradingpanel\external\fetch, gradingform_guide\grades\grader\gradingpanel\external\store, gradingform_rubric\grades\grader\gradingpanel\external\fetch, gradingform_rubric\grades\grader\gradingpanel\external\store, media_videojs\external\get_language, message_airnotifier_external, message_popup_external, mod_bigbluebuttonbn\external\can_join, mod_bigbluebuttonbn\external\completion_validate, mod_bigbluebuttonbn\external\end_meeting, mod_bigbluebuttonbn\external\get_bigbluebuttonbns_by_courses, mod_bigbluebuttonbn\external\get_join_url, mod_bigbluebuttonbn\external\get_recordings, mod_bigbluebuttonbn\external\get_recordings_to_import, mod_bigbluebuttonbn\external\meeting_info, mod_bigbluebuttonbn\external\update_recording, mod_bigbluebuttonbn\external\view_bigbluebuttonbn, mod_book_external, mod_chat_external, mod_choice_external, mod_data\external\delete_saved_preset, mod_data\external\get_mapping_information, mod_data_external, mod_feedback_external, mod_folder_external, mod_forum_external, mod_glossary\external\delete_entry, mod_glossary\external\prepare_entry, mod_glossary\external\update_entry, mod_h5pactivity\external\get_attempts, mod_h5pactivity\external\get_h5pactivities_by_courses, mod_h5pactivity\external\get_h5pactivity_access_information, mod_h5pactivity\external\get_results, mod_h5pactivity\external\get_user_attempts, mod_h5pactivity\external\log_report_viewed, mod_h5pactivity\external\view_h5pactivity, mod_imscp_external, mod_label_external, mod_lesson_external, mod_lti\external\get_tool_types_and_proxies, mod_lti\external\get_tool_types_and_proxies_count, mod_lti_external, mod_page_external, mod_quiz\external\submit_question_version, mod_quiz_external, mod_resource_external, mod_scorm_external, mod_survey_external, mod_url_external, mod_wiki_external, mod_workshop_external, paygw_paypal\external\get_config_for_js, paygw_paypal\external\transaction_complete, qbank_columnsortorder\external\set_columnbank_order, qbank_editquestion\external\update_question_version_status, qbank_tagquestion\external\submit_tags, quizaccess_seb\external\validate_quiz_keys, report_competency\external, report_insights\external, tiny_autosave\external\reset_autosave_session, tiny_autosave\external\resume_autosave_session, tiny_autosave\external\update_autosave_session_content, tiny_equation\external\filter, tool_analytics\external, tool_behat\external\get_entity_generator, tool_dataprivacy\external, tool_lp\external, tool_mobile\external, tool_moodlenet\external, tool_policy\external, tool_templatelibrary\external, tool_usertours\external\tour, and tool_xmldb_external.
Base class for external api methods.
- Copyright
- 2009 Petr Skodak
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- Since
- Moodle 2.0
◆ call_external_function()
static external_api::call_external_function |
( |
|
$function, |
|
|
|
$args, |
|
|
|
$ajaxonly = false |
|
) |
| |
|
static |
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 | $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. |
- Return values
-
array | containing keys for error (bool), exception and data. |
◆ clean_returnvalue()
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
-
- Return values
-
- Author
- 2010 Jerome Mouneyrac
- Since
- Moodle 2.0
◆ external_function_info()
static external_api::external_function_info |
( |
|
$function, |
|
|
|
$strictness = MUST_EXIST |
|
) |
| |
|
static |
Returns detailed function information.
- Parameters
-
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 |
- Return values
-
stdClass | description or false if not found or exception thrown |
- Exceptions
-
- Since
- Moodle 2.0
◆ get_context_from_params()
static external_api::get_context_from_params |
( |
|
$param | ) |
|
|
staticprotected |
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
-
- Since
- Moodle 2.6
- Exceptions
-
- Return values
-
◆ get_context_parameters()
static external_api::get_context_parameters |
( |
| ) |
|
|
staticprotected |
◆ set_context_restriction()
static external_api::set_context_restriction |
( |
|
$context | ) |
|
|
static |
Set context restriction for all following subsequent function calls.
- Parameters
-
stdClass | $context | the context restriction |
- Since
- Moodle 2.0
◆ set_timeout()
static external_api::set_timeout |
( |
|
$seconds = 360 | ) |
|
|
static |
This method has to be called before every operation that takes a longer time to finish!
- Parameters
-
int | $seconds | max expected time the next operation needs |
- Since
- Moodle 2.0
◆ validate_context()
static external_api::validate_context |
( |
|
$context | ) |
|
|
static |
Makes sure user may execute functions in this context.
- Parameters
-
- Since
- Moodle 2.0
◆ validate_parameters()
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
-
- Return values
-
mixed | params 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: