diff --git a/files/renderer.php b/files/renderer.php index b9158c7651a..8fb90ed858a 100644 --- a/files/renderer.php +++ b/files/renderer.php @@ -45,43 +45,41 @@ class core_files_renderer extends plugin_renderer_base { } public function render_files_tree_viewer(files_tree_viewer $tree) { - $html = $this->output->heading_with_help(get_string('coursefiles'), 'courselegacyfiles', 'moodle'); - $html .= '
'; + + $html .= $this->output->container_start('coursefilesbreadcrumb'); foreach($tree->path as $path) { $html .= $path; $html .= ' / '; } - $html .= '
'; + $html .= $this->output->container_end(); - $html .= '
'; - if (empty($tree->tree)) { - $html .= get_string('nofilesavailable', 'repository'); - } else { - $this->page->requires->js_init_call('M.core_filetree.init'); - $html .= ''; } - $html .= '
'; + + $html .= html_writer::table($table); $html .= $this->output->single_button(new moodle_url('/files/coursefilesedit.php', array('contextid'=>$tree->context->id)), get_string('coursefilesedit'), 'get'); + $html .= $this->output->box_end(); return $html; } } @@ -111,39 +109,42 @@ class files_tree_viewer implements renderable { $this->options = (array)$options; $this->context = $options['context']; - if (isset($this->options['visible_areas'])) { - $visible_areas = (array)$this->options['visible_areas']; - } else { - $visible_areas = false; - } - $this->tree = array(); $children = $file_info->get_children(); + $current_file_params = $file_info->get_params(); $parent_info = $file_info->get_parent(); $level = $parent_info; $this->path = array(); while ($level) { $params = $level->get_params(); $context = get_context_instance_by_id($params['contextid']); - if ($context->id != $this->context->id) { + // $this->context is current context + if ($context->id != $this->context->id or empty($params['filearea'])) { break; } // unset unused parameters unset($params['component']); unset($params['filearea']); + unset($params['filename']); unset($params['itemid']); $url = new moodle_url('/files/index.php', $params); $this->path[] = html_writer::link($url, $level->get_visible_name()); $level = $level->get_parent(); } $this->path = array_reverse($this->path); - $this->path[] = $file_info->get_visible_name(); + if ($current_file_params['filepath'] != '/') { + $this->path[] = $file_info->get_visible_name(); + } foreach ($children as $child) { $filedate = $child->get_timemodified(); $filesize = $child->get_filesize(); $mimetype = $child->get_mimetype(); $params = $child->get_params(); + unset($params['component']); + unset($params['filearea']); + unset($params['filename']); + unset($params['itemid']); $fileitem = array( 'params' => $params, 'filename' => $child->get_visible_name(), @@ -154,11 +155,6 @@ class files_tree_viewer implements renderable { if ($child->is_directory()) { $fileitem['isdir'] = true; $fileitem['url'] = $url->out(false); - if ($visible_areas !== false) { - if (!isset($visible_areas[$params['component']][$params['filearea']])) { - continue; - } - } } else { $fileitem['url'] = $child->get_url(); } diff --git a/theme/standard/style/core.css b/theme/standard/style/core.css index 4c581306863..9d863fe575a 100644 --- a/theme/standard/style/core.css +++ b/theme/standard/style/core.css @@ -65,6 +65,7 @@ h2.headingblock {font-size:1.1em;} .files .file, .files .folder {font-size: 0.9em;} .files .folder .size {font-weight: bold;} +.coursefilesbreadcrumb {margin: .5em 0; padding: .5em 0;} a.useredit, a:hover.useredit,