/** * Validate incoming data * * @param array $data array of ("fieldname"=>value) of submitted data * @param array $files array of uploaded files "element_name"=>tmp_file_path * @return array of "element_name"=>"error_description" if there are errors, * or an empty array if everything is OK (true allowed for backwards compatibility too). */ function validation($data, $files) { global $CFG; require_once $CFG->libdir . '/filelib.php'; $errors = array(); $error = \mod_hvp\framework::downloadH5pLibraries(true); if ($error !== null) { $errors['h5pintromsg'] = $error; } return $errors; }
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')); }