Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core_webservice_renderer Class Reference
Inheritance diagram for core_webservice_renderer:
plugin_renderer_base renderer_base

Public Member Functions

 __call ($method, $arguments)
 Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief. More...
 
 add_action_handler (component_action $action, $id=null)
 Adds a JS action for the element with the provided id. More...
 
 admin_authorised_user_list ($users, $serviceid)
 Display list of authorised users. More...
 
 admin_authorised_user_selector (&$options)
 Display the authorised user selector. More...
 
 admin_delete_token_confirmation ($token)
 Display a confirmation page to delete a token. More...
 
 admin_remove_service_confirmation ($service)
 Display a confirmation page to remove a service. More...
 
 admin_remove_service_function_confirmation ($function, $service)
 Display a confirmation page to remove a function from a service. More...
 
 admin_service_function_list ($functions, $service)
 Display a list of functions for a given service If the service is built-in, do not display remove/add operation (read-only) More...
 
 colored_box_with_pre_tag ($title, $content, $rgb='FEEBE5')
 Return the html of a coloured box with content. More...
 
 description_in_indented_xml_format ($returndescription, $indentation="")
 Return a description object in indented xml format (for REST response) It is indented to be output within. More...
 
 detailed_description_html ($params)
 Return documentation for a ws description object ws description object can be 'external_multiple_structure', 'external_single_structure' or 'external_value'. More...
 
 documentation_html ($functions, $printableformat, $activatedprotocol, $authparams, $parenturl='/webservice/wsdoc.php')
 Displays all the documentation. More...
 
 get_compact_logo_url ($maxwidth=300, $maxheight=300)
 Return the site's compact logo URL, if any. More...
 
 get_logo_url ($maxwidth=null, $maxheight=200)
 Return the site's logo URL, if any. More...
 
 has_started ()
 Returns true is output has already started, and false if not. More...
 
 image_url ($imagename, $component='moodle')
 Return the moodle_url for an image. More...
 
 pix_url ($imagename, $component='moodle')
 Return the direct URL for an image from the pix folder. More...
 
 render (renderable $widget)
 Renders the provided widget and returns the HTML to display it. More...
 
 render_from_template ($templatename, $context)
 Renders a template by name with the given context. More...
 
 rest_param_description_html ($paramdescription, $paramstring)
 Return indented REST param description. More...
 
 should_display_main_logo ($headinglevel=1)
 Whether we should display the main logo. More...
 
 should_display_navbar_logo ()
 Whether we should display the logo in the navbar. More...
 
 user_reset_token_confirmation ($token)
 Display Reset token confirmation box. More...
 
 user_webservice_tokens_box ($tokens, $userid, $documentation=false)
 Display user tokens with buttons to reset them. More...
 
 xmlrpc_param_description_html ($paramdescription, $indentation="")
 Create indented XML-RPC param description. More...
 

Static Public Member Functions

static prepare_classes ($classes)
 Given an array or space-separated list of classes, prepares and returns the HTML class attribute value. More...
 

Protected Member Functions

 get_mustache ()
 Return an instance of the mustache class. More...
 

Protected Attributes

xhtml_container_stack $opencontainers
 The xhtml_container_stack to use.
 
renderer_base core_renderer $output
 A reference to the current renderer. More...
 
moodle_page $page
 The Moodle page the renderer has been created to assist with.
 
string $target
 The requested rendering target.
 

Member Function Documentation

◆ __call()

plugin_renderer_base::__call (   $method,
  $arguments 
)
inherited

Magic method used to pass calls otherwise meant for the standard renderer to it to ensure we don't go causing unnecessary grief.

Parameters
string$method
array$arguments
Return values
mixed

◆ add_action_handler()

renderer_base::add_action_handler ( component_action  $action,
  $id = null 
)
inherited

Adds a JS action for the element with the provided id.

This method adds a JS event for the provided component action to the page and then returns the id that the event has been attached to. If no id has been provided then a new ID is generated by html_writer::random_id()

Parameters
component_action$action
string$id
Return values
stringid of element, either original submitted or random new if not supplied

◆ admin_authorised_user_list()

core_webservice_renderer::admin_authorised_user_list (   $users,
  $serviceid 
)

Display list of authorised users.

Parameters
array$usersauthorised users
int$serviceidservice id
Return values
string::$html

◆ admin_authorised_user_selector()

core_webservice_renderer::admin_authorised_user_selector ( $options)

Display the authorised user selector.

Parameters
stdClass$optionsIt contains alloweduserselector, potentialuserselector and serviceid
Return values
stringhtml

◆ admin_delete_token_confirmation()

core_webservice_renderer::admin_delete_token_confirmation (   $token)

Display a confirmation page to delete a token.

Parameters
stdClass$tokenRequired properties: id (token id), firstname (user firstname), lastname (user lastname), name (service name)
Return values
stringhtml

◆ admin_remove_service_confirmation()

core_webservice_renderer::admin_remove_service_confirmation (   $service)

Display a confirmation page to remove a service.

Parameters
stdClass$serviceIt needs service id + service name properties.
Return values
stringhtml

◆ admin_remove_service_function_confirmation()

core_webservice_renderer::admin_remove_service_function_confirmation (   $function,
  $service 
)

Display a confirmation page to remove a function from a service.

Parameters
stdClass$functionIt needs function id + function name properties.
stdClass$serviceIt needs service id + service name properties.
Return values
stringhtml

◆ admin_service_function_list()

core_webservice_renderer::admin_service_function_list (   $functions,
  $service 
)

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

Parameters
array$functionslist of functions
stdClass$servicethe given service
Return values
stringthe table html + add operation html

◆ colored_box_with_pre_tag()

core_webservice_renderer::colored_box_with_pre_tag (   $title,
  $content,
  $rgb = 'FEEBE5' 
)

Return the html of a coloured box with content.

Parameters
string$title- the title of the box
string$content- the content to displayed
string$rgb- the background color of the box
Return values
stringHTML code

◆ description_in_indented_xml_format()

core_webservice_renderer::description_in_indented_xml_format (   $returndescription,
  $indentation = "" 
)

Return a description object in indented xml format (for REST response) It is indented to be output within.

 tags
Parameters
external_description$returndescriptionthe description structure of the web service function returned value
string$indentationIndentation in the generated HTML code; should contain only spaces.
Return values
stringthe html to diplay

◆ detailed_description_html()

core_webservice_renderer::detailed_description_html (   $params)

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

Parameters
stdClass$paramsa part of parameter/return description
Return values
stringthe html to display

◆ documentation_html()

core_webservice_renderer::documentation_html (   $functions,
  $printableformat,
  $activatedprotocol,
  $authparams,
  $parenturl = '/webservice/wsdoc.php' 
)

Displays all the documentation.

Parameters
array$functionsexternal_description of all the web service functions
boolean$printableformattrue if we want to display the documentation in a printable format
array$activatedprotocolthe currently enabled protocol
array$authparamsurl parameters (it contains 'tokenid' and sometimes 'print')
string$parenturlurl of the calling page - needed for the print button url: '/admin/documentation.php' or '/webservice/wsdoc.php' (default)
Return values
stringthe html to diplay

◆ get_compact_logo_url()

renderer_base::get_compact_logo_url (   $maxwidth = 300,
  $maxheight = 300 
)
inherited

Return the site's compact logo URL, if any.

Parameters
int$maxwidthThe maximum width, or null when the maximum width does not matter.
int$maxheightThe maximum height, or null when the maximum height does not matter.
Return values
moodle_url|false

◆ get_logo_url()

renderer_base::get_logo_url (   $maxwidth = null,
  $maxheight = 200 
)
inherited

Return the site's logo URL, if any.

Parameters
int$maxwidthThe maximum width, or null when the maximum width does not matter.
int$maxheightThe maximum height, or null when the maximum height does not matter.
Return values
moodle_url|false

◆ get_mustache()

renderer_base::get_mustache ( )
protectedinherited

Return an instance of the mustache class.

Since
2.9
Return values
Mustache_Engine

◆ has_started()

renderer_base::has_started ( )
inherited

Returns true is output has already started, and false if not.

Return values
booleantrue if the header has been printed.

◆ image_url()

renderer_base::image_url (   $imagename,
  $component = 'moodle' 
)
inherited

Return the moodle_url for an image.

The exact image location and extension is determined automatically by searching for gif|png|jpg|jpeg, please note there can not be diferent images with the different extension. The imagename is for historical reasons a relative path name, it may be changed later for core images. It is recommended to not use subdirectories in plugin and theme pix directories.

There are three types of images: 1/ theme images - stored in theme/mytheme/pix/, use component 'theme' 2/ core images - stored in /pix/, overridden via theme/mytheme/pix_core/ 3/ plugin images - stored in mod/mymodule/pix, overridden via theme/mytheme/pix_plugins/mod/mymodule/, example: image_url('comment', 'mod_glossary')

Parameters
string$imagenamethe pathname of the image
string$componentfull plugin name (aka component) or 'theme'
Return values
moodle_url

◆ pix_url()

renderer_base::pix_url (   $imagename,
  $component = 'moodle' 
)
inherited

Return the direct URL for an image from the pix folder.

Use this function sparingly and never for icons. For icons use pix_icon or the pix helper in a mustache template.

Deprecated:
since Moodle 3.3
Parameters
string$imagenamethe name of the icon.
string$componentspecification of one plugin like in get_string()
Return values
moodle_url

◆ prepare_classes()

static renderer_base::prepare_classes (   $classes)
staticinherited

Given an array or space-separated list of classes, prepares and returns the HTML class attribute value.

Parameters
mixed$classesSpace-separated string or array of classes
Return values
stringHTML class attribute value

◆ render()

plugin_renderer_base::render ( renderable  $widget)
inherited

Renders the provided widget and returns the HTML to display it.

Parameters
renderable$widgetinstance with renderable interface
Return values
string

Reimplemented from renderer_base.

Reimplemented in tool_policy\output\renderer.

◆ render_from_template()

renderer_base::render_from_template (   $templatename,
  $context 
)
inherited

Renders a template by name with the given context.

The provided data needs to be array/stdClass made up of only simple types. Simple types are array,stdClass,bool,int,float,string

Since
2.9
Parameters
array | stdClass$contextContext containing data for the template.
Return values
string|boolean

◆ rest_param_description_html()

core_webservice_renderer::rest_param_description_html (   $paramdescription,
  $paramstring 
)

Return indented REST param description.

Parameters
external_description$paramdescriptionthe description structure of the web service function parameters
string$paramstringparameter
Return values
stringthe html to diplay

◆ should_display_main_logo()

renderer_base::should_display_main_logo (   $headinglevel = 1)
inherited

Whether we should display the main logo.

Parameters
int$headinglevelThe heading level we want to check against.
Return values
bool

◆ should_display_navbar_logo()

renderer_base::should_display_navbar_logo ( )
inherited

Whether we should display the logo in the navbar.

We will when there are no main logos, and we have compact logo.

Return values
bool

◆ user_reset_token_confirmation()

core_webservice_renderer::user_reset_token_confirmation (   $token)

Display Reset token confirmation box.

Parameters
stdClass$tokentoken to reset
Return values
stringhtml

◆ user_webservice_tokens_box()

core_webservice_renderer::user_webservice_tokens_box (   $tokens,
  $userid,
  $documentation = false 
)

Display user tokens with buttons to reset them.

Parameters
stdClass$tokensuser tokens
int$useriduser id
bool$documentationif true display a link to the API documentation
Return values
stringhtml code

◆ xmlrpc_param_description_html()

core_webservice_renderer::xmlrpc_param_description_html (   $paramdescription,
  $indentation = "" 
)

Create indented XML-RPC param description.

Parameters
external_description$paramdescriptionthe description structure of the web service function parameters
string$indentationIndentation in the generated HTML code; should contain only spaces.
Return values
stringthe html to diplay

Member Data Documentation

◆ $output

renderer_base core_renderer plugin_renderer_base::$output
protectedinherited

A reference to the current renderer.

The renderer provided here will be determined by the page but will in 90% of cases by the core_renderer


The documentation for this class was generated from the following file: