Example #1
0
 function MoodleQuickForm_filemanager($elementName = null, $elementLabel = null, $attributes = null, $options = null)
 {
     global $CFG;
     require_once "{$CFG->dirroot}/repository/lib.php";
     $options = (array) $options;
     foreach ($options as $name => $value) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     if (!empty($options['maxbytes'])) {
         $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
     }
     parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     repository_head_setup();
 }
Example #2
0
 function MoodleQuickForm_editor($elementName = null, $elementLabel = null, $attributes = null, $options = null)
 {
     global $CFG;
     $options = (array) $options;
     foreach ($options as $name => $value) {
         if (array_key_exists($name, $this->_options)) {
             $this->_options[$name] = $value;
         }
     }
     if (!empty($options['maxbytes'])) {
         $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
     }
     if (!$this->_options['context']) {
         $this->_options['context'] = get_context_instance(CONTEXT_SYSTEM);
     }
     $this->_options['trusted'] = trusttext_trusted($this->_options['context']);
     parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
     repository_head_setup();
     editors_head_setup();
 }