Differences Between: [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]
H5P editor class.
Copyright: | 2020 Victor Deniz <victor@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 487 lines (17 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
editor:: (10 methods):
__construct()
set_content()
set_library()
set_filearea()
add_editor_to_form()
save_content()
update_h5p_file()
add_assets_to_page()
get_editor_translations()
data_preprocessing()
__construct() X-Ref |
Inits the H5P editor. |
set_content(int $id) X-Ref |
Loads an existing content for edition. If the H5P content or its file can't be retrieved, it is not possible to edit the content. return: void param: int $id Id of the H5P content from the h5p table. |
set_library(string $library, int $contextid, string $component, string $filearea,?int $itemid = 0, string $filepath = '/', ?string $filename = null, ?int $userid = null) X-Ref |
Sets the content type library and the file area to create a new H5P content. Note: this method must be used to create new content, to edit an existing H5P content use only set_content with the ID from the H5P table. return: void param: string $library Library of the H5P content type to create. param: int $contextid Context where the file of the H5P content will be stored. param: string $component Component where the file of the H5P content will be stored. param: string $filearea File area where the file of the H5P content will be stored. param: int $itemid Item id file of the H5P content. param: string $filepath File path where the file of the H5P content will be stored. param: null|string $filename H5P content file name. param: null|int $userid H5P content file owner userid (default will use $USER->id). |
set_filearea(int $contextid, string $component, string $filearea,int $itemid, string $filepath = '/', ?string $filename = null, ?int $userid = null) X-Ref |
Sets the Moodle file area where the file of a new H5P content will be stored. return: void param: int $contextid Context where the file of the H5P content will be stored. param: string $component Component where the file of the H5P content will be stored. param: string $filearea File area where the file of the H5P content will be stored. param: int $itemid Item id file of the H5P content. param: string $filepath File path where the file of the H5P content will be stored. param: null|string $filename H5P content file name. param: null|int $userid H5P content file owner userid (default will use $USER->id). |
add_editor_to_form(MoodleQuickForm $mform) X-Ref |
Adds an H5P editor to a form. return: void param: MoodleQuickForm $mform Moodle Quick Form |
save_content(stdClass $content) X-Ref |
Creates or updates an H5P content. return: int Content id param: stdClass $content Object containing all the necessary data. |
update_h5p_file(stdClass $content) X-Ref |
Creates or updates the H5P file and the related database data. return: void param: stdClass $content Object containing all the necessary data. |
add_assets_to_page() X-Ref |
Add required assets for displaying the editor. return: void |
get_editor_translations(string $language) X-Ref |
Get editor translations for the defined language. Check if the editor strings have been translated in Moodle. If the strings exist, they will override the existing ones in the JS file. return: array The editor string translations. param: string $language The language for the translations to be returned. |
data_preprocessing() X-Ref |
Preprocess the data sent through the form to the H5P JS Editor Library. return: stdClass |