Ejemplo n.º 1
0
function xmldb_hvp_install()
{
    // Try to install all the default content types
    require_once __DIR__ . '/../autoloader.php';
    // Override permission check for the install process, since caps hasn't
    // been set yet.
    $interface = \mod_hvp\framework::instance('interface');
    $interface->mayUpdateLibraries(true);
    // Fetch info about library updates
    $core = \mod_hvp\framework::instance('core');
    $core->fetchLibrariesMetadata();
    // Download default libraries and try to install
    $error = \mod_hvp\framework::downloadH5pLibraries();
    if ($error !== null) {
        \mod_hvp\framework::messages('error', $error);
    }
    // Print any messages
    echo '<h3>' . get_string('welcomeheader', 'hvp') . '</h3>' . '<p>' . get_string('welcomegettingstarted', 'hvp', array('moodle_tutorial' => 'href="https://h5p.org/moodle" target="_blank"', 'example_content' => 'href="https://h5p.org/content-types-and-applications" target="_blank"')) . '</p>' . '<p>' . get_string('welcomecommunity', 'hvp', array('forums' => 'href="https://h5p.org/forum" target="_blank"', 'gitter' => 'href="https://gitter.im/h5p/CommunityChat" target="_blank"')) . '</p>' . '<p>' . get_string('welcomecontactus', 'hvp', 'href="https://h5p.org/contact" target="_blank"') . '</p>';
    \mod_hvp\framework::printMessages('info', \mod_hvp\framework::messages('info'));
    \mod_hvp\framework::printMessages('error', \mod_hvp\framework::messages('error'));
}
Ejemplo n.º 2
0
        $PAGE->requires->css(new moodle_url($CFG->httpswwwroot . $url));
    }
} else {
    // JavaScripts and stylesheets will be loaded through h5p.js.
    $settings['contents'][$cid]['scripts'] = $core->getAssetsUrls($files['scripts']);
    $settings['contents'][$cid]['styles'] = $core->getAssetsUrls($files['styles']);
}
// Print JavaScript settings to page.
$PAGE->requires->data_for_js('H5PIntegration', $settings, true);
// Print page HTML.
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($content['title']));
echo '<div class="clearer"></div>';
// Print any messages.
\mod_hvp\framework::printMessages('info', \mod_hvp\framework::messages('info'));
\mod_hvp\framework::printMessages('error', \mod_hvp\framework::messages('error'));
// Print intro.
if (trim(strip_tags($content['intro']))) {
    echo $OUTPUT->box_start('mod_introbox', 'hvpintro');
    echo format_module_intro('hvp', (object) array('intro' => $content['intro'], 'introformat' => $content['introformat']), $cm->id);
    echo $OUTPUT->box_end();
}
// Print H5P Content
if ($embedtype === 'div') {
    echo '<div class="h5p-content" data-content-id="' . $content['id'] . '"></div>';
} else {
    echo '<div class="h5p-iframe-wrapper"><iframe id="h5p-iframe-' . $content['id'] . '" class="h5p-iframe" data-content-id="' . $content['id'] . '" style="height:1px" src="about:blank" frameBorder="0" scrolling="no"></iframe></div>';
}
// Find cm context
$context = \context_module::instance($cm->id);
// Trigger module viewed event.