MDL-29231 - Course, Resource - Fix so that the correct icon is displayed for courses that have had two or more files uploaded to them - Thanks Michael D for the patch

This commit is contained in:
Jason Fowler
2011-10-24 14:26:25 +08:00
parent 22df4905ca
commit 647153cd4f
+1 -1
View File
@@ -249,7 +249,7 @@ function resource_get_coursemodule_info($coursemodule) {
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false); // TODO: this is not very efficient!!
if (count($files) >= 1) {
$mainfile = array_pop($files);
$mainfile = reset($files);
$info->icon = file_extension_icon($mainfile->get_filename());
$resource->mainfile = $mainfile->get_filename();
}