From 7db6bb7f61d9735fb51b1d4678dc9b68905f5dc7 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Thu, 21 Jun 2012 10:14:32 +0700 Subject: [PATCH] MDL-33717 files: improved display_size() so that it displays something nice for -1 --- files/renderer.php | 2 -- lib/moodlelib.php | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/files/renderer.php b/files/renderer.php index 2f5f5d41221..b809c287c79 100644 --- a/files/renderer.php +++ b/files/renderer.php @@ -455,11 +455,9 @@ class core_files_renderer extends plugin_renderer_base { $maxbytes = display_size($fm->options->maxbytes); if (empty($options->maxfiles) || $options->maxfiles == -1) { $maxsize = get_string('maxfilesize', 'moodle', $maxbytes); - //$string['maxfilesize'] = 'Maximum size for new files: {$a}'; } else { $strparam = (object)array('size' => $maxbytes, 'attachments' => $options->maxfiles); $maxsize = get_string('maxsizeandattachments', 'moodle', $strparam); - //$string['maxsizeandattachments'] = 'Maximum size for new files: {$a->size}, maximum attachments: {$a->attachments}'; } // TODO MDL-32020 also should say about 'File types accepted' return ''. $maxsize. ''; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index a2f63098cd8..2dd1f58addf 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6049,6 +6049,10 @@ function display_size($size) { static $gb, $mb, $kb, $b; + if ($size === USER_CAN_IGNORE_FILE_SIZE_LIMITS) { + return get_string('unlimited'); + } + if (empty($gb)) { $gb = get_string('sizegb'); $mb = get_string('sizemb');