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 402] [Versions 400 and 403]

external API for core library

Copyright: 2012 Jerome Mouneyrac <jerome@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 566 lines (23 kb)
Included or required:0 times
Referenced: 4 times
Includes or requires: 0 files

Defines 1 class


Class: core_external  - X-Ref

Web service related functions

format_string_parameters($stringparams)   X-Ref
Format the received string parameters to be sent to the core get_string() function.

return: object|string
param: array $stringparams

get_string_parameters()   X-Ref
Returns description of get_string parameters

return: external_function_parameters

get_string($stringid, $component = 'moodle', $lang = null, $stringparams = array()   X-Ref
Return a core get_string() call

return: string
param: string $identifier string identifier
param: string $component string component
param: array $stringparams the string params

get_string_returns()   X-Ref
Returns description of get_string() result value

return: external_description

get_strings_parameters()   X-Ref
Returns description of get_string parameters

return: external_function_parameters

get_strings($strings)   X-Ref
Return multiple call to core get_string()

return: array
param: array $strings strings to translate

get_strings_returns()   X-Ref
Returns description of get_string() result value

return: external_description

get_user_dates_parameters()   X-Ref
Returns description of get_user_dates parameters

return: external_function_parameters

get_user_dates($contextid, $contextlevel, $instanceid, $timestamps)   X-Ref
Format an array of timestamps.

return: array
param: int|null $contextid The contenxt id
param: string|null $contextlevel The context level
param: int|null $instanceid The instnace id for the context level
param: array $timestamps Timestamps to format

get_user_dates_returns()   X-Ref
Returns description of get_user_dates() result value

return: external_description

get_component_strings_parameters()   X-Ref
Returns description of get_component_strings parameters

return: external_function_parameters

get_component_strings($component, $lang = null)   X-Ref
Return all lang strings of a component - call to core get_component_strings().

return: array
param: string $component component name

get_component_strings_returns()   X-Ref
Returns description of get_component_strings() result value

return: external_description

get_fragment_parameters()   X-Ref
Returns description of get_fragment parameters

return: external_function_parameters

get_fragment($component, $callback, $contextid, $args = null)   X-Ref
Get a HTML fragment for inserting into something. Initial use is for inserting mforms into
a page using AJAX.
This web service is designed to be called only via AJAX and not directly.
Callbacks that are called by this web service are responsible for doing the appropriate security checks
to access the information returned. This only does minimal validation on the context.

return: array HTML and JavaScript fragments for insertion into stuff.
param: string $component Name of the component.
param: string $callback Function callback name.
param: int $contextid Context ID this fragment is in.
param: array $args optional arguments for the callback.

get_fragment_returns()   X-Ref
Returns description of get_fragment() result value

return: external_description

update_inplace_editable_parameters()   X-Ref
Parameters for function update_inplace_editable()

return: external_function_parameters

update_inplace_editable($component, $itemtype, $itemid, $value)   X-Ref
Update any component's editable value assuming that component implements necessary callback

param: string $component
param: string $itemtype
param: string $itemid
param: string $value

update_inplace_editable_returns()   X-Ref
Return structure for update_inplace_editable()

return: external_description

fetch_notifications_parameters()   X-Ref
Returns description of fetch_notifications() parameters.

return: external_function_parameters

fetch_notifications_returns()   X-Ref
Returns description of fetch_notifications() result value.

return: external_description

fetch_notifications($contextid)   X-Ref
Returns the list of notifications against the current session.

return: array