Skip to content
Snippets Groups Projects
Commit 8492c28d authored by Frode Petterson's avatar Frode Petterson
Browse files

Remove download button when no permission

parent 877db30b
Branches
Tags
No related merge requests found
......@@ -82,11 +82,16 @@ $export = '';
if (!isset($CFG->mod_hvp_export) || $CFG->mod_hvp_export === true) {
// Find course context.
$context = \context_course::instance($course->id);
if (has_capability('mod/hvp:getexport', $context)) {
$hvppath = "{$CFG->httpswwwroot}/pluginfile.php/{$context->id}/mod_hvp";
$exportfilename = ($content['slug'] ? $content['slug'] . '-' : '') . $content['id'] . '.h5p';
$export = "{$hvppath}/exports/{$exportfilename}";
}
}
if (empty($export)) {
// Remove Download button when there's no export URL
$content['disable'] |= \H5PCore::DISABLE_DOWNLOAD;
}
// Add JavaScript settings for this content.
$cid = 'cid-' . $content['id'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment