Helper class for the H5P area.
More...
Helper class for the H5P area.
- 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
◆ can_deploy_package()
static core_h5p\helper::can_deploy_package |
( |
\stored_file |
$file | ) |
|
|
static |
Checks if the author of the .h5p file is "trustable".
If the file hasn't been uploaded by a user with the required capability, the content won't be deployed.
- Parameters
-
- Return values
-
bool | Returns true if the file can be deployed, false otherwise. |
◆ can_update_library()
static core_h5p\helper::can_update_library |
( |
\stored_file |
$file | ) |
|
|
static |
Checks if the content-type libraries can be upgraded.
The H5P content-type libraries can only be upgraded if the author of the .h5p file can manage content-types or if all the content-types exist, to avoid users without the required capability to upload malicious content.
- Parameters
-
- Return values
-
bool | Returns true if the content-type libraries can be created/updated, false otherwise. |
◆ create_fake_stored_file_from_path()
static core_h5p\helper::create_fake_stored_file_from_path |
( |
string |
$filepath, |
|
|
int |
$userid = 0 , |
|
|
context |
$context = null |
|
) |
| |
|
static |
Convenience to take a fixture test file and create a stored_file.
- Parameters
-
string | $filepath | The filepath of the file |
int | $userid | The author of the file |
context | $context | The context where the file will be created |
- Return values
-
◆ get_display_options()
static core_h5p\helper::get_display_options |
( |
core |
$core, |
|
|
stdClass |
$config |
|
) |
| |
|
static |
Get the representation of display options as int.
- Parameters
-
core | $core | The core_h5p\core object |
stdClass | $config | Button options config |
- Return values
-
int | The representation of display options as int |
◆ save_h5p()
static core_h5p\helper::save_h5p |
( |
factory |
$factory, |
|
|
stored_file |
$file, |
|
|
stdClass |
$config, |
|
|
bool |
$onlyupdatelibs = false , |
|
|
bool |
$skipcontent = false |
|
) |
| |
|
static |
Store an H5P file.
- Parameters
-
factory | $factory | The core_h5p\factory object |
stored_file | $file | Moodle file instance |
stdClass | $config | Button options config |
bool | $onlyupdatelibs | Whether new libraries can be installed or only the existing ones can be updated |
bool | $skipcontent | Should the content be skipped (so only the libraries will be saved)? |
- Return values
-
int|false|null | The H5P identifier or null if there is an error when saving or false if it's not a valid H5P package |
The documentation for this class was generated from the following file: