Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

(no description)

File Size: 143 lines (5 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

helper:: (5 methods):
  build_node_path()
  explode_node_path()
  get_browser()
  get_node()
  request()


Class: helper  - X-Ref

Helper class for the googledocs repository.

build_node_path(string $id, string $name = '', string $root = '')   X-Ref
Generates a safe path to a node.

Typically, a node will be id|name of the node.

param: string $id The ID of the node
param: string $name The name of the node, will be URL encoded
param: string $root The path to append the node on (must be a result of this function)
return: string The path to the node

explode_node_path(string $node)   X-Ref
Returns information about a node in a path.

param: string $node The node string to extract information from
return: array The array containing the information about the node

get_browser(rest $service, string $path)   X-Ref
Returns the relevant googledocs content browser class based on the given path.

param: rest $service The rest API object
param: string $path The current path
return: googledocs_content The googledocs repository content browser

get_node(\stdClass $gdcontent, string $path)   X-Ref
Returns the relevant repository content node class based on the Google Drive file's mimetype.

param: \stdClass $gdcontent The Google Drive content (file/folder) object
param: string $path The current path
return: node The content node object

request(rest $service, string $api, array $params)   X-Ref
Wrapper function to perform an API call and also catch and handle potential exceptions.

param: rest $service The rest API object
param: string $api The name of the API call
param: array $params The parameters required by the API call
return: \stdClass The response object