See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 310] [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
H5P core class.
Copyright: | 2019 Sara Arjona <sara@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 374 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
core:: (13 methods):
__construct()
getDependencyPath()
get_dependency_roots()
find_library()
get_scripts()
fetch_latest_content_types()
fetch_content_type()
get_api_endpoint()
get_latest_content_types()
get_site_uuid()
register_site()
is_required_core_api()
record_to_string()
__construct(H5PFrameworkInterface $framework, $path, string $url, string $language = 'en',bool $export = false) X-Ref |
Constructor for core_h5p/core. param: H5PFrameworkInterface $framework The frameworks implementation of the H5PFrameworkInterface param: string|\H5PFileStorage $path The H5P file storage directory or class param: string $url The URL to the file storage directory param: string $language The language code. Defaults to english param: boolean $export Whether export is enabled |
getDependencyPath(array $dependency) X-Ref |
Get the path to the dependency. param: array $dependency An array containing the information of the requested dependency library return: string The path to the dependency library |
get_dependency_roots(int $id) X-Ref |
Get the paths to the content dependencies. param: int $id The H5P content ID return: array An array containing the path of each content dependency |
find_library(array $dependency) X-Ref |
Get a particular dependency library. param: array $dependency An array containing information of the dependency library return: stdClass|null The library object if the library dependency exists, null otherwise |
get_scripts() X-Ref |
Get the list of JS scripts to include on the page. return: array The array containg urls of the core JavaScript files |
fetch_latest_content_types() X-Ref |
Fetch and install the latest H5P content types libraries from the official H5P repository. If the latest version of a content type library is present in the system, nothing is done for that content type. return: stdClass |
fetch_content_type(array $library) X-Ref |
Given an H5P content type machine name, fetch and install the required library from the official H5P repository. param: array $library Library machineName, majorversion and minorversion. return: int|null Returns the id of the content type library installed, null otherwise. |
get_api_endpoint(?string $library = null, string $endpoint = 'content') X-Ref |
Get H5P endpoints. If $endpoint = 'content' and $library is null, moodle_url is the endpoint of the latest version of the H5P content types; however, if $library is the machine name of a content type, moodle_url is the endpoint to download the content type. The SITES endpoint ($endpoint = 'site') may be use to get a site UUID or send site data. param: string|null $library The machineName of the library whose endpoint is requested. param: string $endpoint The endpoint required. Valid values: "site", "content". return: moodle_url The endpoint moodle_url object. |
get_latest_content_types() X-Ref |
Get the latest version of the H5P content types available in the official repository. return: stdClass An object with 2 properties: |
get_site_uuid() X-Ref |
Get the site UUID. If site UUID is not defined, try to register the site. return $string The site UUID, null if it is not set. |
register_site() X-Ref |
Get H5P generated site UUID. return ?string Returns H5P generated site UUID, null if can't get it. |
is_required_core_api($coreapi) X-Ref |
Checks that the required H5P core API version or higher is installed. param: stdClass $coreapi Object with properties major and minor for the core API version required. return: bool True if the required H5P core API version is installed. False if not. |
record_to_string(stdClass $record, bool $foldername = false) X-Ref |
Get the library string from a DB library record. param: stdClass $record The DB library record. param: bool $foldername If true, use hyphen instead of space in returned string. return: string The string name on the form {machineName} {majorVersion}.{minorVersion}. |