1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00

MDL-27156 repositories: switched the file manager and the file picker over to using get_user_max_upload_file_size()

This commit is contained in:
Andrew Davis 2012-06-11 17:21:46 +07:00
parent 1812ea3e06
commit 845c2ae110
2 changed files with 5 additions and 5 deletions

@ -69,7 +69,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
}
}
if (!empty($options['maxbytes'])) {
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
$this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $options['maxbytes']);
}
if (empty($options['return_types'])) {
$this->_options['return_types'] = (FILE_INTERNAL | FILE_REFERENCE);
@ -129,8 +129,8 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
* @param int $maxbytes file size
*/
function setMaxbytes($maxbytes) {
global $CFG;
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $maxbytes);
global $CFG, $PAGE;
$this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $maxbytes);
}
/**
@ -354,7 +354,7 @@ class form_filemanager implements renderable {
if (!empty($this->options->maxbytes) && $this->options->maxbytes > 0) {
$maxbytes = $this->options->maxbytes;
}
$this->options->maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $maxbytes);
$this->options->maxbytes = get_user_max_upload_file_size($context, $CFG->maxbytes, $coursebytes, $maxbytes);
// building file picker options
$params = new stdClass();

@ -79,7 +79,7 @@ class MoodleQuickForm_filepicker extends HTML_QuickForm_input {
if (!empty($PAGE->course)) {
$coursemaxbytes = $PAGE->course->maxbytes;
}
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $coursemaxbytes, $fpmaxbytes);
$this->_options['maxbytes'] = get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $coursemaxbytes, $fpmaxbytes);
$this->_type = 'filepicker';
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
}