diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-07-14 15:50:06 -0400 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-07-14 15:50:06 -0400 |
commit | c7bd5fb64003c42f9299b7203af9a13bcd48948f (patch) | |
tree | d962c172af9395c734d345aa43d95561ea3ccf24 /views/default/photos/sidebar/quota.php | |
parent | 2d8b04169dda48a5dba8503d9943bdeee2c64685 (diff) | |
download | elgg-c7bd5fb64003c42f9299b7203af9a13bcd48948f.tar.gz elgg-c7bd5fb64003c42f9299b7203af9a13bcd48948f.tar.bz2 |
added quota back
Diffstat (limited to 'views/default/photos/sidebar/quota.php')
-rw-r--r-- | views/default/photos/sidebar/quota.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/views/default/photos/sidebar/quota.php b/views/default/photos/sidebar/quota.php new file mode 100644 index 000000000..16b7885c4 --- /dev/null +++ b/views/default/photos/sidebar/quota.php @@ -0,0 +1,27 @@ +<?php +/** + * User quota + */ + +$user = elgg_get_logged_in_user_entity(); + + +$quota = elgg_get_plugin_setting('quota', 'tidypics'); +if ($quota) { + $image_repo_size = (int)$user->image_repo_size; + $image_repo_size = $image_repo_size / 1024 / 1024; + $quote_percentage = round(100 * ($image_repo_size / $quota)); + // for small quotas, so one decimal place + if ($quota < 10) { + $image_repo_size = sprintf('%.1f', $image_repo_size); + } else { + $image_repo_size = round($image_repo_size); + } + if ($image_repo_size > $quota) { + $image_repo_size = $quota; + } + + $title = elgg_echo('tidypics:title:quota'); + $body = elgg_echo("tidypics:quota") . ' ' . $image_repo_size . '/' . $quota . " MB ({$quote_percentage}%)"; + echo elgg_view_module('aside', $title, $body); +} |