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.

Class: core_webservice_renderer  - X-Ref

Web service documentation renderer.

admin_authorised_user_selector(&$options)   X-Ref
Display the authorised user selector

param: stdClass $options It contains alloweduserselector, potentialuserselector and serviceid
return: string html

admin_authorised_user_list($users, $serviceid)   X-Ref
Display list of authorised users for the given external service.

param: array $users authorised users
param: int $serviceid service id
return: string $html

admin_remove_service_function_confirmation($function, $service)   X-Ref
Display a confirmation page to remove a function from a service

param: stdClass $function It needs function id + function name properties.
param: stdClass $service It needs service id + service name properties.
return: string html

admin_remove_service_confirmation($service)   X-Ref
Display a confirmation page to remove a service

param: stdClass $service It needs service id + service name properties.
return: string html

admin_service_function_list($functions, $service)   X-Ref
Display a list of functions for a given service
If the service is built-in, do not display remove/add operation (read-only)

param: array $functions list of functions
param: stdClass $service the given service
return: string the table html + add operation html

user_reset_token_confirmation($token)   X-Ref
Display Reset token confirmation box

param: stdClass $token token to reset
return: string html

user_webservice_tokens_box($tokens, $userid, $documentation = false)   X-Ref
Display user tokens with buttons to reset them

param: stdClass $tokens user tokens
param: int $userid user id
param: bool $documentation if true display a link to the API documentation
return: string html code

detailed_description_html($params)   X-Ref
Return documentation for a ws description object
ws description object can be 'external_multiple_structure', 'external_single_structure'
or 'external_value'

Example of documentation for core_group_create_groups function:
list of (
object {
courseid int //id of course
name string //multilang compatible name, course unique
description string //group description text
enrolmentkey string //group enrol secret phrase
}
)

param: stdClass $params a part of parameter/return description
return: string the html to display

description_in_indented_xml_format($returndescription, $indentation = "")   X-Ref
Return a description object in indented xml format (for REST response)
It is indented to be output within <pre> tags

param: external_description $returndescription the description structure of the web service function returned value
param: string $indentation Indentation in the generated HTML code; should contain only spaces.
return: string the html to diplay

xmlrpc_param_description_html($paramdescription, $indentation = "")   X-Ref
Create indented XML-RPC  param description

param: external_description $paramdescription the description structure of the web service function parameters
param: string $indentation Indentation in the generated HTML code; should contain only spaces.
return: string the html to diplay

colored_box_with_pre_tag($title, $content, $rgb = 'FEEBE5')   X-Ref
Return the html of a coloured box with content

param: string $title - the title of the box
param: string $content - the content to displayed
param: string $rgb - the background color of the box
return: string HTML code

rest_param_description_html($paramdescription, $paramstring)   X-Ref
Return indented REST param description

param: external_description $paramdescription the description structure of the web service function parameters
param: string $paramstring parameter
return: string the html to diplay

documentation_html($functions, $printableformat, $activatedprotocol,$authparams, $parenturl = '/webservice/wsdoc.php')   X-Ref
Displays all the documentation

param: array $functions external_description of all the web service functions
param: boolean $printableformat true if we want to display the documentation in a printable format
param: array $activatedprotocol the currently enabled protocol
param: array $authparams url parameters (it contains 'tokenid' and sometimes 'print')
param: string $parenturl url of the calling page - needed for the print button url:
return: string the html to diplay