mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 01:44:27 +02:00
Merge branch 'MDL-64346-master' of git://github.com/abgreeve/moodle
This commit is contained in:
commit
ce5ca79ba5
@ -66,9 +66,8 @@ function resource_display_embed($resource, $cm, $course, $file) {
|
||||
$clicktoopen = resource_get_clicktoopen($file, $resource->revision);
|
||||
|
||||
$context = context_module::instance($cm->id);
|
||||
$path = '/'.$context->id.'/mod_resource/content/'.$resource->revision.$file->get_filepath().$file->get_filename();
|
||||
$fullurl = file_encode_url($CFG->wwwroot.'/pluginfile.php', $path, false);
|
||||
$moodleurl = new moodle_url('/pluginfile.php' . $path);
|
||||
$moodleurl = moodle_url::make_pluginfile_url($context->id, 'mod_resource', 'content', $resource->revision,
|
||||
$file->get_filepath(), $file->get_filename());
|
||||
|
||||
$mimetype = $file->get_mimetype();
|
||||
$title = $resource->name;
|
||||
@ -82,11 +81,11 @@ function resource_display_embed($resource, $cm, $course, $file) {
|
||||
);
|
||||
|
||||
if (file_mimetype_in_typegroup($mimetype, 'web_image')) { // It's an image
|
||||
$code = resourcelib_embed_image($fullurl, $title);
|
||||
$code = resourcelib_embed_image($moodleurl->out(), $title);
|
||||
|
||||
} else if ($mimetype === 'application/pdf') {
|
||||
// PDF document
|
||||
$code = resourcelib_embed_pdf($fullurl, $title, $clicktoopen);
|
||||
$code = resourcelib_embed_pdf($moodleurl->out(), $title, $clicktoopen);
|
||||
|
||||
} else if ($mediamanager->can_embed_url($moodleurl, $embedoptions)) {
|
||||
// Media (audio/video) file.
|
||||
|
Loading…
x
Reference in New Issue
Block a user