diff --git a/h5p/classes/framework.php b/h5p/classes/framework.php
index e5293cf2c3b..3c639665063 100644
--- a/h5p/classes/framework.php
+++ b/h5p/classes/framework.php
@@ -510,8 +510,8 @@ class framework implements \H5PFrameworkInterface {
global $DB;
$results = $DB->get_records('h5p_libraries', [], 'title ASC, majorversion ASC, minorversion ASC',
- 'machinename AS machine_name, majorversion AS major_version, minorversion AS minor_version,
- patchversion AS patch_version');
+ 'id, machinename AS machine_name, majorversion AS major_version, minorversion AS minor_version,
+ patchversion AS patch_version, runnable, title');
$libraries = array();
foreach ($results as $library) {
diff --git a/h5p/libraries.php b/h5p/libraries.php
index ad9c6e250e8..66b4e581fbe 100644
--- a/h5p/libraries.php
+++ b/h5p/libraries.php
@@ -43,6 +43,7 @@ echo $OUTPUT->heading($pagetitle);
echo $OUTPUT->box(get_string('librariesmanagerdescription', 'core_h5p'));
$form = new \core_h5p\form\uploadlibraries_form();
+$h5pfactory = new \core_h5p\factory();
if ($data = $form->get_data()) {
require_sesskey();
@@ -54,7 +55,6 @@ if ($data = $form->get_data()) {
$file = reset($files);
// Validate and save the H5P package.
- $h5pfactory = new \core_h5p\factory();
// Because we are passing skipcontent = true to save_h5p function, the returning value is false in an error
// is encountered, null when successfully saving the package without creating the content.
if (\core_h5p\helper::save_h5p($h5pfactory, $file, new stdClass(), false, true) === false) {
@@ -64,4 +64,19 @@ if ($data = $form->get_data()) {
}
}
$form->display();
+
+// Load installed Libraries.
+$framework = $h5pfactory->get_framework();
+$libraries = $framework->loadLibraries();
+$installed = [];
+foreach ($libraries as $libraryname => $versions) {
+ foreach ($versions as $version) {
+ $installed[] = $version;
+ }
+}
+
+if (count($installed)) {
+ echo $OUTPUT->render_from_template('core_h5p/h5plibraries', (object)['contenttypes' => $installed]);
+}
+
echo $OUTPUT->footer();
diff --git a/h5p/templates/h5pdiv.mustache b/h5p/templates/h5pdiv.mustache
index 2e914d4bf3f..0f95bfc7760 100644
--- a/h5p/templates/h5pdiv.mustache
+++ b/h5p/templates/h5pdiv.mustache
@@ -15,7 +15,7 @@
along with Moodle. If not, see .
}}
{{!
- @template core_message/h5pdiv
+ @template core_h5p/h5pdiv
This template will render an div for h5p content.
diff --git a/h5p/templates/h5pembed.mustache b/h5p/templates/h5pembed.mustache
index 7f364772706..9f261265bb2 100644
--- a/h5p/templates/h5pembed.mustache
+++ b/h5p/templates/h5pembed.mustache
@@ -15,7 +15,7 @@
along with Moodle. If not, see .
}}
{{!
- @template core_message/h5pembed
+ @template core_h5p/h5pembed
This template will render the embed code shown in the H5P content embed popup.
diff --git a/h5p/templates/h5perror.mustache b/h5p/templates/h5perror.mustache
index 76107c97b2a..d4559854e2a 100644
--- a/h5p/templates/h5perror.mustache
+++ b/h5p/templates/h5perror.mustache
@@ -15,7 +15,7 @@
along with Moodle. If not, see .
}}
{{!
- @template core_message/h5perror
+ @template core_h5p/h5perror
This template will render the embed code shown in the H5P content embed popup.
diff --git a/h5p/templates/h5plibraries.mustache b/h5p/templates/h5plibraries.mustache
new file mode 100644
index 00000000000..e9c974d12dd
--- /dev/null
+++ b/h5p/templates/h5plibraries.mustache
@@ -0,0 +1,111 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see .
+}}
+{{!
+ @template core_h5p/h5plibraries
+
+ Example context (json):
+ {
+ "contenttypes": [
+ {
+ "title": "Accordion",
+ "major_version": 1,
+ "minor_version:": 0,
+ "patch_version:": 0,
+ "runnable": 1
+ },
+ {
+ "title": "Collage",
+ "major_version": 0,
+ "minor_version:": 3,
+ "patch_version:": 1,
+ "runnable": 1
+ },
+ {
+ "title": "FontAwesome",
+ "major_version": 4,
+ "minor_version:": 5,
+ "patch_version:": 0,
+ "runnable": 0
+ }
+ ]
+ }
+
+}}
+
{{#str}} installedh5p, h5p {{/str}}
+
+
+
+
+
+
+
+
+ {{#str}}description, core{{/str}} |
+ {{#str}}version, core{{/str}} |
+
+
+
+ {{#contenttypes}}
+ {{#runnable}}
+
+
+ {{{ title }}}
+ |
+ {{{ major_version }}}.{{{ minor_version }}}.{{{ patch_version }}} |
+
+ {{/runnable}}
+ {{/contenttypes}}
+
+
+
+
+
+
+
+
+
+ {{#str}}description, core{{/str}} |
+ {{#str}}version, core{{/str}} |
+
+
+
+ {{#contenttypes}}
+ {{^runnable}}
+
+
+ {{{ title }}}
+ |
+ {{{ major_version }}}.{{{ minor_version }}}.{{{ patch_version }}} |
+
+ {{/runnable}}
+ {{/contenttypes}}
+
+
+
+
+
\ No newline at end of file
diff --git a/h5p/templates/h5presize.mustache b/h5p/templates/h5presize.mustache
index 4400b608c0b..fd5832448c6 100644
--- a/h5p/templates/h5presize.mustache
+++ b/h5p/templates/h5presize.mustache
@@ -15,7 +15,7 @@
along with Moodle. If not, see .
}}
{{!
- @template core_message/h5presize
+ @template core_h5p/h5presize
This template will render the resize JS code.
diff --git a/lang/en/h5p.php b/lang/en/h5p.php
index 221c3c42c6c..7f1decb42f5 100644
--- a/lang/en/h5p.php
+++ b/lang/en/h5p.php
@@ -86,6 +86,9 @@ $string['h5pmanage'] = 'Manage H5P content types';
$string['h5ppackage'] = 'H5P content type';
$string['h5ppackage_help'] = 'An H5P content type is a file with an H5P or ZIP extension containing all libraries required to display the content.';
$string['hideadvanced'] = 'Hide advanced';
+$string['installedcontentlibraries'] = 'Installed H5P libraries';
+$string['installedcontenttypes'] = 'Installed H5P content types';
+$string['installedh5p'] = 'Installed H5P';
$string['invalidcontextid'] = 'H5P file not found (invalid contextid)';
$string['invalidfile'] = 'File "{$a->%filename}" not allowed. Only files with the following extensions are allowed: {$a->%files-allowed}.';
$string['invalidlanguagefile'] = 'Invalid language file {$a->%file} in library {$a->%library}';