Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
core_h5p\editor_framework Class Reference

Moodle's implementation of the H5P Editor storage interface. More...

Inheritance diagram for core_h5p\editor_framework:
Moodle\H5peditorStorage

Public Member Functions

 alterLibraryFiles (&$files, $libraries)
 Allow for other plugins to decide which styles and scripts are attached.
 
 getAvailableLanguages ($machinename, $major, $minor)
 Load a list of available language codes.
 
 getLanguage ($name, $major, $minor, $lang)
 Load language file(JSON).
 
 getLibraries ($libraries=null)
 Return libraries details.
 
 keepFile ($fileid)
 "Callback" for mark the given file as a permanent file.
 

Static Public Member Functions

static markFileForCleanup ($file, $contentid=null)
 Marks a file for later cleanup.
 
static removeTemporarilySavedFiles ($filepath)
 Clean up temporary files.
 
static saveFileTemporarily ($data, $movefile=false)
 Saves a file or moves it temporarily.
 

Detailed Description

Moodle's implementation of the H5P Editor storage interface.

Makes it possible for the editor's core library to communicate with the database used by Moodle.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ alterLibraryFiles()

core_h5p\editor_framework::alterLibraryFiles ( & $files,
$libraries )

Allow for other plugins to decide which styles and scripts are attached.

This is useful for adding and/or modifying the functionality and look of the content types.

Parameters
array$filesList of files as objects with path and version as properties.
array$librariesList of libraries indexed by machineName with objects as values. The objects have majorVersion and minorVersion as properties.

Implements Moodle\H5peditorStorage.

◆ getAvailableLanguages()

core_h5p\editor_framework::getAvailableLanguages ( $machinename,
$major,
$minor )

Load a list of available language codes.

Until translations is implemented, only returns the "en" language.

Parameters
string$machinenameThe machine readable name of the library(content type)
int$majorMajor part of version number
int$minorMinor part of version number
Return values
arrayList of possible language codes

Implements Moodle\H5peditorStorage.

◆ getLanguage()

core_h5p\editor_framework::getLanguage ( $name,
$major,
$minor,
$lang )

Load language file(JSON).

Used to translate the editor fields(title, description etc.)

Parameters
string$nameThe machine readable name of the library(content type)
int$majorMajor part of version number
int$minorMinor part of version number
string$langLanguage code
Return values
string|booleanTranslation in JSON format if available, false otherwise

Implements Moodle\H5peditorStorage.

◆ getLibraries()

core_h5p\editor_framework::getLibraries ( $libraries = null)

Return libraries details.

Two use cases:

  1. No input, will list all the available content types.
  2. Libraries supported are specified, load additional data and verify that the content types are available. Used by e.g. the Presentation Tool Editor that already knows which content types are supported in its slides.
Parameters
array$librariesList of library names + version to load info for.
Return values
arrayList of all libraries loaded.

Implements Moodle\H5peditorStorage.

◆ keepFile()

core_h5p\editor_framework::keepFile ( $fileid)

"Callback" for mark the given file as a permanent file.

Used when saving content that has new uploaded files.

Parameters
int$fileid

Implements Moodle\H5peditorStorage.

◆ markFileForCleanup()

static core_h5p\editor_framework::markFileForCleanup ( $file,
$contentid = null )
static

Marks a file for later cleanup.

Useful when files are not instantly cleaned up. E.g. for files that are uploaded through the editor.

Parameters
int$fileId of file that should be cleaned up
int | null$contentidContent id of file

Implements Moodle\H5peditorStorage.

◆ removeTemporarilySavedFiles()

static core_h5p\editor_framework::removeTemporarilySavedFiles ( $filepath)
static

Clean up temporary files.

Parameters
string$filepathPath to file or directory

Implements Moodle\H5peditorStorage.

◆ saveFileTemporarily()

static core_h5p\editor_framework::saveFileTemporarily ( $data,
$movefile = false )
static

Saves a file or moves it temporarily.

This is often necessary in order to validate and store uploaded or fetched H5Ps.

Parameters
string$dataUri of data that should be saved as a temporary file.
bool$movefileCan be set to TRUE to move the data instead of saving it.
Return values
bool|objectReturns false if saving failed or an object with path of the directory and file that is temporarily saved.

Implements Moodle\H5peditorStorage.


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