H5P core class, containing functions and storage shared by the other H5P classes.  
 More...
|  | 
|  | __construct (H5PFrameworkInterface $framework, $path, string $url, string $language='en', bool $export=false) | 
|  | Constructor for core_h5p/core. 
 | 
|  | 
|  | fetch_content_type (array $library) | 
|  | Given an H5P content type machine name, fetch and install the required library from the official H5P repository. 
 | 
|  | 
|  | fetch_latest_content_types () | 
|  | Fetch and install the latest H5P content types libraries from the official H5P repository. 
 | 
|  | 
|  | get_api_endpoint (?string $library=null, string $endpoint='content') | 
|  | Get H5P endpoints. 
 | 
|  | 
|  | get_dependency_roots (int $id) | 
|  | Get the paths to the content dependencies. 
 | 
|  | 
|  | get_latest_content_types () | 
|  | Get the latest version of the H5P content types available in the official repository. 
 | 
|  | 
|  | get_site_uuid () | 
|  | Get the site UUID. 
 | 
|  | 
|  | getLibraryId ($library, $libString=null) | 
|  | Small helper for getting the library's ID. 
 | 
|  | 
|  | is_required_core_api ($coreapi) | 
|  | Checks that the required H5P core API version or higher is installed. 
 | 
|  | 
|  | 
| static | get_scripts () | 
|  | Get the list of JS scripts to include on the page. 
 | 
|  | 
| static | record_to_string (stdClass $record, bool $foldername=false) | 
|  | Get the library string from a DB library record. 
 | 
|  | 
|  | 
| array | $libraries | 
|  | The array containing all the present libraries. 
 | 
|  | 
H5P core class, containing functions and storage shared by the other H5P classes. 
- Copyright
- 2019 Sara Arjona sara@.nosp@m.mood.nosp@m.le.co.nosp@m.m 
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 
◆ __construct()
      
        
          | core_h5p\core::__construct | ( | H5PFrameworkInterface | $framework, | 
        
          |  |  |  | $path, | 
        
          |  |  | string | $url, | 
        
          |  |  | string | $language = 'en', | 
        
          |  |  | bool | $export = false ) | 
      
 
Constructor for core_h5p/core. 
- Parameters
- 
  
    | H5PFrameworkInterface | $framework | The frameworks implementation of the H5PFrameworkInterface |  | string | H5PFileStorage | $path | The H5P file storage directory or class |  | string | $url | The URL to the file storage directory |  | string | $language | The language code. Defaults to english |  | boolean | $export | Whether export is enabled |  
 
 
 
◆ fetch_content_type()
      
        
          | core_h5p\core::fetch_content_type | ( | array | $library | ) |  | 
      
 
Given an H5P content type machine name, fetch and install the required library from the official H5P repository. 
- Parameters
- 
  
    | array | $library | Library machineName, majorversion and minorversion. |  
 
- Return values
- 
  
    | int|null | Returns the id of the content type library installed, null otherwise. |  
 
 
 
◆ fetch_latest_content_types()
      
        
          | core_h5p\core::fetch_latest_content_types | ( |  | ) |  | 
      
 
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 values
- 
  
  
 
 
◆ find_library()
  
  | 
        
          | core_h5p\core::find_library | ( | array | $dependency | ) |  |  | protected | 
 
Get a particular dependency library. 
- Parameters
- 
  
    | array | $dependency | An array containing information of the dependency library |  
 
- Return values
- 
  
    | stdClass|null | The library object if the library dependency exists, null otherwise |  
 
 
 
◆ get_api_endpoint()
      
        
          | core_h5p\core::get_api_endpoint | ( | ?string | $library = null, | 
        
          |  |  | string | $endpoint = 'content' ) | 
      
 
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.
- Parameters
- 
  
    | string | null | $library | The machineName of the library whose endpoint is requested. |  | string | $endpoint | The endpoint required. Valid values: "site", "content". |  
 
- Return values
- 
  
  
 
 
◆ get_dependency_roots()
      
        
          | core_h5p\core::get_dependency_roots | ( | int | $id | ) |  | 
      
 
Get the paths to the content dependencies. 
- Parameters
- 
  
  
- Return values
- 
  
    | array | An array containing the path of each content dependency |  
 
 
 
◆ get_latest_content_types()
      
        
          | core_h5p\core::get_latest_content_types | ( |  | ) |  | 
      
 
Get the latest version of the H5P content types available in the official repository. 
- Return values
- 
  
    | stdClass | An object with 2 properties: 
string error: error message when there is any problem, empty otherwisearray contentTypes: an object for each H5P content type with its information  |  
 
 
 
◆ get_scripts()
  
  | 
        
          | static core_h5p\core::get_scripts | ( |  | ) |  |  | static | 
 
Get the list of JS scripts to include on the page. 
- Return values
- 
  
    | array | The array containg urls of the core JavaScript files |  
 
 
 
◆ get_site_uuid()
      
        
          | core_h5p\core::get_site_uuid | ( |  | ) |  | 
      
 
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. 
 
 
◆ getDependencyPath()
  
  | 
        
          | core_h5p\core::getDependencyPath | ( | array | $dependency | ) |  |  | protected | 
 
Get the path to the dependency. 
- Parameters
- 
  
    | array | $dependency | An array containing the information of the requested dependency library |  
 
- Return values
- 
  
    | string | The path to the dependency library |  
 
 
 
◆ getLibraryId()
      
        
          | core_h5p\core::getLibraryId | ( |  | $library, | 
        
          |  |  |  | $libString = null ) | 
      
 
Small helper for getting the library's ID. 
This method is rewritten to use MUC (instead of an static variable which causes some problems with PHPUnit).
- Parameters
- 
  
    | array | $library |  |  | string | $libString |  |  
 
- Return values
- 
  
    | int | Identifier, or FALSE if non-existent |  
 
 
 
◆ is_required_core_api()
      
        
          | core_h5p\core::is_required_core_api | ( |  | $coreapi | ) |  | 
      
 
Checks that the required H5P core API version or higher is installed. 
- Parameters
- 
  
    | stdClass | $coreapi | Object with properties major and minor for the core API version required. |  
 
- Return values
- 
  
    | bool | True if the required H5P core API version is installed. False if not. |  
 
 
 
◆ record_to_string()
  
  | 
        
          | static core_h5p\core::record_to_string | ( | stdClass | $record, |  
          |  |  | bool | $foldername = false ) |  | static | 
 
Get the library string from a DB library record. 
- Parameters
- 
  
    | stdClass | $record | The DB library record. |  | bool | $foldername | If true, use hyphen instead of space in returned string. |  
 
- Return values
- 
  
    | string | The string name on the form {machineName} {majorVersion}.{minorVersion}. |  
 
 
 
The documentation for this class was generated from the following file: