From 647153cd4f23a64b1b06d2dea107069c427bf620 Mon Sep 17 00:00:00 2001 From: Jason Fowler Date: Thu, 13 Oct 2011 11:50:23 +0800 Subject: [PATCH] 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 --- mod/resource/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/resource/lib.php b/mod/resource/lib.php index cc4e315245f..893bcbe823d 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -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(); }