Merge branch 'MDL-26976-master' of git://github.com/jleyva/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 19 Jun 2017 13:55:55 +0000 (14:55 +0100)
committerDan Poltawski <dan@moodle.com>
Mon, 19 Jun 2017 13:55:55 +0000 (14:55 +0100)
lang/en/moodle.php
user/files.php

index 3387da5..845118e 100644 (file)
@@ -1505,6 +1505,7 @@ $string['publicsitefileswarning3'] = 'Note: Files placed here can be accessed by
 $string['publish'] = 'Publish';
 $string['question'] = 'Question';
 $string['questionsinthequestionbank'] = 'Questions in the question bank';
+$string['quotausage'] = 'You have currently used {$a->used} of your {$a->total} limit.';
 $string['readinginfofrombackup'] = 'Reading info from backup';
 $string['readme'] = 'README';
 $string['recentactivity'] = 'Recent activity';
index 32c99f4..dadaf61 100644 (file)
@@ -82,6 +82,20 @@ if ($mform->is_cancelled()) {
 echo $OUTPUT->header();
 echo $OUTPUT->box_start('generalbox');
 
+// Show file area space usage.
+if ($maxareabytes != FILE_AREA_MAX_BYTES_UNLIMITED) {
+    $fileareainfo = file_get_file_area_info($context->id, 'user', 'private');
+    // Display message only if we have files.
+    if ($fileareainfo['filecount']) {
+        $a = (object) [
+            'used' => display_size($fileareainfo['filesize_without_references']),
+            'total' => display_size($maxareabytes)
+        ];
+        $quotamsg = get_string('quotausage', 'moodle', $a);
+        $notification = new \core\output\notification($quotamsg, \core\output\notification::NOTIFY_INFO);
+        echo $OUTPUT->render($notification);
+    }
+}
 
 $mform->display();
 echo $OUTPUT->box_end();