MDL-33717 files: improved display_size() so that it displays something nice for -1

This commit is contained in:
Andrew Davis
2012-06-21 10:14:32 +07:00
parent 703ffaea05
commit 7db6bb7f61
2 changed files with 4 additions and 2 deletions
-2
View File
@@ -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 '<span>'. $maxsize. '</span>';
+4
View File
@@ -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');