MDL-38261 Replace deprecated file_encode_url() in workshop renderer
authorDavid Mudrák <david@moodle.com>
Thu, 28 Feb 2013 13:24:45 +0000 (14:24 +0100)
committerDavid Mudrák <david@moodle.com>
Thu, 28 Feb 2013 17:53:37 +0000 (18:53 +0100)
mod/workshop/renderer.php

index 50ca90e..fd67d95 100644 (file)
@@ -797,9 +797,11 @@ class mod_workshop_renderer extends plugin_renderer_base {
 
             $filepath   = $file->get_filepath();
             $filename   = $file->get_filename();
-            $fileurl    = file_encode_url($CFG->wwwroot . '/pluginfile.php',
-                                '/' . $ctx->id . '/mod_workshop/submission_attachment/' . $submissionid . $filepath . $filename, true);
-            $embedurl   = new moodle_url($fileurl, array('preview' => 'bigthumb'));
+            $fileurl    = moodle_url::make_pluginfile_url($ctx->id, 'mod_workshop', 'submission_attachment',
+                            $submissionid, $filepath, $filename, true);
+            $embedurl   = moodle_url::make_pluginfile_url($ctx->id, 'mod_workshop', 'submission_attachment',
+                            $submissionid, $filepath, $filename, false);
+            $embedurl   = new moodle_url($embedurl, array('preview' => 'bigthumb'));
             $type       = $file->get_mimetype();
             $image      = $this->output->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));