Contains API class for the H5P area.
More...
|
static | create_content_from_pluginfile_url (string $url, stdClass $config, factory $factory, stdClass &$messages, bool $preventredirect=true) |
| Create, if it doesn't exist, the H5P DB instance id for a H5P pluginfile URL. More...
|
|
static | delete_content (\stdClass $content, factory $factory) |
| Delete an H5P package. More...
|
|
static | delete_content_from_pluginfile_url (string $url, factory $factory) |
| Delete an H5P package deployed from the defined $url. More...
|
|
static | delete_library (factory $factory, stdClass $library) |
| Delete a library and also all the libraries depending on it and the H5P contents using it. More...
|
|
static | get_content_from_pathnamehash (string $pathnamehash) |
| Returns the H5P content object corresponding to an H5P content file. More...
|
|
static | get_content_from_pluginfile_url (string $url, bool $preventredirect=true) |
| Get the H5P DB instance id for a H5P pluginfile URL. More...
|
|
static | get_contenttype_libraries (?string $fields='') |
| Get all the H5P content type libraries versions. More...
|
|
static | get_dependent_libraries (int $libraryid) |
| Get all the libraries using a defined library. More...
|
|
static | get_export_info_from_context_id (int $contextid, factory $factory, string $component, string $filearea) |
| Return the H5P export information file when the file has been deployed. More...
|
|
static | get_library (int $libraryid) |
| Get a library from an identifier. More...
|
|
static | get_library_details (array $params, bool $configurable, string $fields='') |
| Returns a library as an object with properties that correspond to the fetched row's field names. More...
|
|
Contains API class for the H5P area.
- Copyright
- 2020 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_access_pluginfile_hash()
static core_h5p\api::can_access_pluginfile_hash |
( |
string |
$url, |
|
|
bool |
$preventredirect = true |
|
) |
| |
|
staticprotected |
If user can access pathnamehash from an H5P internal URL.
- Parameters
-
string | $url | H5P pluginfile URL poiting to an H5P file. |
bool | $preventredirect | Set to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions |
- Return values
-
bool | if user can access pluginfile hash. |
- Exceptions
-
◆ create_content_from_pluginfile_url()
static core_h5p\api::create_content_from_pluginfile_url |
( |
string |
$url, |
|
|
stdClass |
$config, |
|
|
factory |
$factory, |
|
|
stdClass & |
$messages, |
|
|
bool |
$preventredirect = true |
|
) |
| |
|
static |
Create, if it doesn't exist, the H5P DB instance id for a H5P pluginfile URL.
If it exists:
- If the content is not the same, remove the existing content and re-deploy the H5P content again.
- If the content is the same, returns the H5P identifier.
- Parameters
-
string | $url | H5P pluginfile URL. |
stdClass | $config | Configuration for H5P buttons. |
factory | $factory | The core_h5p::factory object |
stdClass | $messages | The error, exception and info messages, raised while preparing and running an H5P content. |
bool | $preventredirect | Set to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions |
- Return values
-
array | of [file, h5pid]:
- file local file for this $url.
- h5pid is the H5P identifier or false if there isn't any H5P with this URL.
|
◆ delete_content()
static core_h5p\api::delete_content |
( |
\stdClass |
$content, |
|
|
factory |
$factory |
|
) |
| |
|
static |
Delete an H5P package.
- Parameters
-
stdClass | $content | The H5P package to delete with, at least content['id]. |
factory | $factory | The core_h5p::factory object |
◆ delete_content_from_pluginfile_url()
static core_h5p\api::delete_content_from_pluginfile_url |
( |
string |
$url, |
|
|
factory |
$factory |
|
) |
| |
|
static |
Delete an H5P package deployed from the defined $url.
- Parameters
-
string | $url | pluginfile URL of the H5P package to delete. |
factory | $factory | The core_h5p::factory object |
◆ delete_library()
static core_h5p\api::delete_library |
( |
factory |
$factory, |
|
|
stdClass |
$library |
|
) |
| |
|
static |
Delete a library and also all the libraries depending on it and the H5P contents using it.
For the H5P content, only the database entries in {h5p} are removed (the .h5p files are not removed in order to let users to deploy them again).
- Parameters
-
factory | $factory | The H5P factory. |
stdClass | $library | The library to delete. |
◆ get_content_from_pathnamehash()
static core_h5p\api::get_content_from_pathnamehash |
( |
string |
$pathnamehash | ) |
|
|
static |
Returns the H5P content object corresponding to an H5P content file.
- Parameters
-
string | $pathnamehash | The pathnamehash of the file associated to an H5P content. |
- Return values
-
null|stdClass | H5P content object or null if not found. |
◆ get_content_from_pluginfile_url()
static core_h5p\api::get_content_from_pluginfile_url |
( |
string |
$url, |
|
|
bool |
$preventredirect = true |
|
) |
| |
|
static |
Get the H5P DB instance id for a H5P pluginfile URL.
If it doesn't exist, it's not created.
- Parameters
-
string | $url | H5P pluginfile URL. |
bool | $preventredirect | Set to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions |
- Return values
-
array | of [file, stdClass|false]:
- file local file for this $url.
- stdClass is an H5P object or false if there isn't any H5P with this URL.
|
◆ get_contenttype_libraries()
static core_h5p\api::get_contenttype_libraries |
( |
?string |
$fields = '' | ) |
|
|
static |
Get all the H5P content type libraries versions.
- Parameters
-
string | null | $fields | Library fields to return. |
- Return values
-
array | An array with an object for each content type library installed. |
◆ get_dependent_libraries()
static core_h5p\api::get_dependent_libraries |
( |
int |
$libraryid | ) |
|
|
static |
Get all the libraries using a defined library.
- Parameters
-
int | $libraryid | The library to get its dependencies. |
- Return values
-
array | List of libraryid with all the libraries required by a defined library. |
◆ get_export_info_from_context_id()
static core_h5p\api::get_export_info_from_context_id |
( |
int |
$contextid, |
|
|
factory |
$factory, |
|
|
string |
$component, |
|
|
string |
$filearea |
|
) |
| |
|
static |
Return the H5P export information file when the file has been deployed.
Otherwise, return null if H5P file: i) has not been deployed. ii) has changed the content.
The information returned will be:
- filename, filepath, mimetype, filesize, timemodified and fileurl.
- Parameters
-
int | $contextid | ContextId of the H5P activity. |
factory | $factory | The core_h5p::factory object. |
string | $component | component |
string | $filearea | file area |
- Return values
-
array|null | Return file info otherwise null. |
◆ get_library()
static core_h5p\api::get_library |
( |
int |
$libraryid | ) |
|
|
static |
Get a library from an identifier.
- Parameters
-
int | $libraryid | The library identifier. |
- Return values
-
stdClass | The library object having the library identifier defined. |
- Exceptions
-
dml_exception | A DML specific exception is thrown if the libraryid doesn't exist. |
◆ get_library_details()
static core_h5p\api::get_library_details |
( |
array |
$params, |
|
|
bool |
$configurable, |
|
|
string |
$fields = '' |
|
) |
| |
|
static |
Returns a library as an object with properties that correspond to the fetched row's field names.
- Parameters
-
array | $params | An associative array with the values of the machinename, majorversion and minorversion fields. |
bool | $configurable | A library that has semantics so it can be configured in the editor. |
string | $fields | Library attributes to retrieve. |
- Return values
-
stdClass|null | An object with one attribute for each field name in $fields param. |
◆ get_pluginfile_hash()
static core_h5p\api::get_pluginfile_hash |
( |
string |
$url | ) |
|
|
staticprotected |
Get the pathnamehash from an H5P internal URL.
- Parameters
-
string | $url | H5P pluginfile URL poiting to an H5P file. |
- Return values
-
string|false | pathnamehash for the file in the internal URL. |
- Exceptions
-
The documentation for this class was generated from the following file: