From be9608feaa82846bcb6b2e044c6080d41c9f09c8 Mon Sep 17 00:00:00 2001 From: aparup Date: Mon, 19 Jul 2010 03:32:24 +0000 Subject: [PATCH] Assignment MDL-23261 submission and response files display tree rendering fixed broken url and filearea is now passed down to sub dirs being rendered (fixes links) --- mod/assignment/renderer.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mod/assignment/renderer.php b/mod/assignment/renderer.php index 63e74dc3393..2156d4db3a9 100644 --- a/mod/assignment/renderer.php +++ b/mod/assignment/renderer.php @@ -67,7 +67,7 @@ class mod_assignment_renderer extends plugin_renderer_base { $filename = $file->get_filename(); $icon = substr(mimeinfo("icon", $filename), 0, -4); $image = $this->output->pix_icon("/f/$icon", $filename, 'moodle', array('class'=>'icon')); - $result .= '
  • '.$image.' '.html_writer::link($file->fileurl, $filename).' '.$file->portfoliobutton.'
  • '; + $result .= '
  • '.$image.' '.$file->fileurl.' '.$file->portfoliobutton.'
  • '; } $result .= ''; @@ -89,19 +89,19 @@ class assignment_files implements renderable { $this->course = $course; $fs = get_file_storage(); $this->dir = $fs->get_area_tree($this->context->id, 'mod_assignment', $filearea, $itemid); - $files = $fs->get_area_files($this->context->id, 'mod_assignment', 'submission', $itemid, "timemodified", false); + $files = $fs->get_area_files($this->context->id, 'mod_assignment', $filearea, $itemid, "timemodified", false); if (count($files) >= 1 && has_capability('mod/assignment:exportownsubmission', $this->context)) { $button = new portfolio_add_button(); $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id), '/mod/assignment/locallib.php'); $button->reset_formats(); $this->portfolioform = $button->to_html(); } - $this->preprocess($this->dir); + $this->preprocess($this->dir, $filearea); } - public function preprocess($dir) { + public function preprocess($dir, $filearea) { global $CFG; foreach ($dir['subdirs'] as $subdir) { - $this->preprocess($subdir); + $this->preprocess($subdir, $filearea); } foreach ($dir['files'] as $file) { $button = new portfolio_add_button(); @@ -112,7 +112,7 @@ class assignment_files implements renderable { } else { $file->portfoliobutton = ''; } - $url = file_encode_url("$CFG->wwwroot/pluginfile.php", '/'.$this->context->id.'/mod_assignment/submission/'.$file->get_itemid().'/'.$file->get_filepath().$file->get_filename(), true); + $url = file_encode_url("$CFG->wwwroot/pluginfile.php", '/'.$this->context->id.'/mod_assignment/'.$filearea.'/'.$file->get_itemid(). '/' . $file->get_filepath().$file->get_filename(), true); $filename = $file->get_filename(); $file->fileurl = html_writer::link($url, $filename); }