MDL-23308, added mimetype icons to course files tree
[moodle.git] / files / renderer.php
index 1616a92..b9158c7 100644 (file)
@@ -46,7 +46,7 @@ class core_files_renderer extends plugin_renderer_base {
 
     public function render_files_tree_viewer(files_tree_viewer $tree) {
 
-        $html = $this->output->notification(get_string('coursefileswarning'), 'notifyproblem');
+        $html = $this->output->heading_with_help(get_string('coursefiles'), 'courselegacyfiles', 'moodle');
         $html .= '<div class="file-tree-breadcrumb">';
         foreach($tree->path as $path) {
             $html .= $path;
@@ -64,12 +64,18 @@ class core_files_renderer extends plugin_renderer_base {
                 $link_attributes = array();
                 if (!empty($node['isdir'])) {
                     $class = ' class="file-tree-folder"';
+                    $icon = $this->output->pix_icon('f/folder', 'icon');
                 } else {
                     $class = ' class="file-tree-file"';
+                    $icon = $this->output->pix_icon('f/'.mimeinfo('icon', $node['filename']), get_string('icon'));
                     $link_attributes['target'] = '_blank';
                 }
-                $html .= '<li '.$class.'>';
+                $html .= '<li '.$class.' yuiConfig="{\'type\':\'HTMLNode\'}">';
+                $html .= '<div>';
+                $html .= $icon;
+                $html .= '&nbsp;';
                 $html .= html_writer::link($node['url'], $node['filename'], $link_attributes);
+                $html .= '</div>';
                 $html .= '</li>';
             }
             $html .= '</ul>';