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 401 and 402] [Versions 401 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: 9 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.

param: array $stringparams
return: object|string

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

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

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()

param: array $strings strings to translate
return: array

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.

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

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().

param: string $component component name
return: array

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.

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.
return: array HTML and JavaScript fragments for insertion into stuff.

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