Skip to content

Commit

Permalink
MDL-26976 files: Display space usage message in private files
Browse files Browse the repository at this point in the history
  • Loading branch information
jleyva committed Jun 19, 2017
1 parent f74ac6e commit b5ef326
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lang/en/moodle.php
Expand Up @@ -1505,6 +1505,7 @@
$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';
Expand Down
14 changes: 14 additions & 0 deletions user/files.php
Expand Up @@ -82,6 +82,20 @@
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();
Expand Down

0 comments on commit b5ef326

Please sign in to comment.