MDL-38261 Display workshop submission attachments in a preview mode

This commit is contained in:
David Mudrák
2013-02-28 18:53:37 +01:00
parent 8f5cbbd6c8
commit 57c1c7edfc
2 changed files with 9 additions and 1 deletions
+2 -1
View File
@@ -799,6 +799,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
$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'));
$type = $file->get_mimetype();
$image = $this->output->pix_icon(file_file_icon($file), get_mimetype_description($file), 'moodle', array('class' => 'icon'));
@@ -807,7 +808,7 @@ class mod_workshop_renderer extends plugin_renderer_base {
if ($format == 'html') {
if (file_mimetype_in_typegroup($type, 'web_image')) {
$preview = html_writer::empty_tag('img', array('src' => $fileurl, 'alt' => '', 'class' => 'preview'));
$preview = html_writer::empty_tag('img', array('src' => $embedurl, 'alt' => '', 'class' => 'preview'));
$preview = html_writer::tag('a', $preview, array('href' => $fileurl));
$outputimgs .= $this->output->container($preview);
+7
View File
@@ -137,6 +137,13 @@
margin-right: 5px;
}
.path-mod-workshop .submission-full .attachments .images div {
display: inline-block;
margin: 5px;
padding: 5px;
border: 1px solid #ddd;
}
/**
* Example submission - summary display
*/