MDL-27156 repositories: switched the file manager and the file picker over to using...
authorAndrew Davis <andrew@moodle.com>
Mon, 11 Jun 2012 10:21:46 +0000 (17:21 +0700)
committerAndrew Davis <andrew@moodle.com>
Thu, 14 Jun 2012 02:19:26 +0000 (09:19 +0700)
lib/form/filemanager.php
lib/form/filepicker.php

index 1f2ce25..f6d968d 100644 (file)
@@ -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();
index c3fad28..bcee75d 100644 (file)
@@ -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);
     }