Moodle's implementation of the H5P Editor storage interface.
More...
|
| 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.
|
|
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.
- Copyright
- 2020 Victor Deniz victo.nosp@m.r@mo.nosp@m.odle..nosp@m.com, base on code by Joubel AS
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ 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 | $files | List of files as objects with path and version as properties. |
array | $libraries | List of libraries indexed by machineName with objects as values. The objects have majorVersion and minorVersion as properties. |
◆ 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 | $machinename | The machine readable name of the library(content type) |
int | $major | Major part of version number |
int | $minor | Minor part of version number |
- Return values
-
array | List of possible language codes |
◆ 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 | $name | The machine readable name of the library(content type) |
int | $major | Major part of version number |
int | $minor | Minor part of version number |
string | $lang | Language code |
- Return values
-
string|boolean | Translation in JSON format if available, false otherwise |
◆ getLibraries()
core_h5p\editor_framework::getLibraries |
( |
| $libraries = null | ) |
|
Return libraries details.
Two use cases:
- No input, will list all the available content types.
- 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 | $libraries | List of library names + version to load info for. |
- Return values
-
array | List of all libraries loaded. |
◆ 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
-
◆ 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 | $file | Id of file that should be cleaned up |
int | null | $contentid | Content id of file |
◆ removeTemporarilySavedFiles()
static core_h5p\editor_framework::removeTemporarilySavedFiles |
( |
| $filepath | ) |
|
|
static |
Clean up temporary files.
- Parameters
-
string | $filepath | Path to file or directory |
◆ 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 | $data | Uri of data that should be saved as a temporary file. |
bool | $movefile | Can be set to TRUE to move the data instead of saving it. |
- Return values
-
bool|object | Returns false if saving failed or an object with path of the directory and file that is temporarily saved. |
The documentation for this class was generated from the following file: