Commit 8435ce3b authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

file: refresh user's quotas on upload (bug #602197)



Also refresh quotas at the time of filebrowser pieform element creation.
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
Signed-off-by: default avatarAndrew Robert Nicols <andrew.nicols@luns.net.uk>
parent 09fdbf10
......@@ -57,6 +57,11 @@ function pieform_element_filebrowser(Pieform $form, $element) {
$userid = ($group || $institution) ? null : $USER->get('id');
// refresh quotas
if ($userid) {
$USER->quota_refresh();
}
$folder = $element['folder'];
$path = pieform_element_filebrowser_get_path($folder);
$smarty->assign('folder', $folder);
......
......@@ -836,6 +836,7 @@ class ArtefactTypeFile extends ArtefactTypeFileBase {
global $USER;
if ($data->owner == $USER->get('id')) {
$owner = $USER;
$owner->quota_refresh();
}
else {
$owner = new User;
......
......@@ -611,6 +611,12 @@ class User {
}
}
public function quota_refresh() {
$quotadata = get_record_sql('SELECT quota, quotaused FROM {usr} WHERE id = ?', array($this->get('id')));
$this->set('quota', $quotadata->quota);
$this->set("quotaused", $quotadata->quotaused);
}
public function join_institution($institution) {
if ($institution != 'mahara' && !$this->in_institution($institution)) {
require_once('institution.php');
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment