mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-73568 admin: show accepted types for stored file config settings.
Re-factor existing code to make use of file manager class that renders these details for us by default. Co-authored-by: Simey Lameze <simey@moodle.com>
This commit is contained in:
parent
ceb41588d2
commit
52992d993c
3 changed files with 7 additions and 14 deletions
|
@ -303,7 +303,7 @@ class core_files_renderer extends plugin_renderer_base {
|
|||
} else {
|
||||
$maxsize = get_string('maxfilesize', 'moodle', $maxbytes);
|
||||
}
|
||||
// TODO MDL-32020 also should say about 'File types accepted'
|
||||
|
||||
return '<span>'. $maxsize . '</span>';
|
||||
}
|
||||
|
||||
|
|
|
@ -784,9 +784,9 @@ $string['loginpageautofocus'] = 'Autofocus login page form';
|
|||
$string['loginpageautofocus_help'] = 'Enabling this option improves usability of the login page, but automatically focusing fields may be considered an accessibility issue.';
|
||||
$string['loglifetime'] = 'Keep logs for';
|
||||
$string['logo'] = 'Logo';
|
||||
$string['logo_desc'] = 'A full logo to be used as decoration by some themes (such as core themes). This image can be quite high resolution because it will be scaled down for use (and cached for performance). Logos that are wider than they are high usually give better results. Formats accepted: PNG and JPG.';
|
||||
$string['logo_desc'] = 'A full logo to be used as decoration by some themes (such as core themes). This image can be quite high resolution because it will be scaled down for use (and cached for performance). Logos that are wider than they are high usually give better results.';
|
||||
$string['logocompact'] = 'Compact logo';
|
||||
$string['logocompact_desc'] = 'A compact version of the same logo as above, such as an emblem, shield or icon. The image should be clear even at small sizes. Formats accepted: PNG and JPG.';
|
||||
$string['logocompact_desc'] = 'A compact version of the same logo as above, such as an emblem, shield or icon. The image should be clear even at small sizes.';
|
||||
$string['logossettings'] = 'Logos';
|
||||
$string['logstorenotrequired'] = 'Log store not required';
|
||||
$string['logstoressupported'] = 'Log stores that support this report';
|
||||
|
|
|
@ -10764,7 +10764,7 @@ class admin_setting_configstoredfile extends admin_setting {
|
|||
}
|
||||
|
||||
public function output_html($data, $query = '') {
|
||||
global $PAGE, $CFG;
|
||||
global $CFG;
|
||||
|
||||
$options = $this->get_options();
|
||||
$id = $this->get_id();
|
||||
|
@ -10780,24 +10780,17 @@ class admin_setting_configstoredfile extends admin_setting {
|
|||
$fmoptions->mainfile = $options['mainfile'];
|
||||
$fmoptions->maxbytes = $options['maxbytes'];
|
||||
$fmoptions->maxfiles = $options['maxfiles'];
|
||||
$fmoptions->client_id = uniqid();
|
||||
$fmoptions->itemid = $draftitemid;
|
||||
$fmoptions->subdirs = $options['subdirs'];
|
||||
$fmoptions->target = $id;
|
||||
$fmoptions->accepted_types = $options['accepted_types'];
|
||||
$fmoptions->return_types = $options['return_types'];
|
||||
$fmoptions->context = $options['context'];
|
||||
$fmoptions->areamaxbytes = $options['areamaxbytes'];
|
||||
|
||||
$fm = new form_filemanager($fmoptions);
|
||||
$output = $PAGE->get_renderer('core', 'files');
|
||||
$html = $output->render($fm);
|
||||
|
||||
$html .= '<input value="'.$draftitemid.'" name="'.$elname.'" type="hidden" />';
|
||||
$html .= '<input value="" id="'.$id.'" type="hidden" />';
|
||||
$fm = new MoodleQuickForm_filemanager($elname, $this->visiblename, ['id' => $id], $fmoptions);
|
||||
$fm->setValue($draftitemid);
|
||||
|
||||
return format_admin_setting($this, $this->visiblename,
|
||||
'<div class="form-filemanager" data-fieldtype="filemanager">'.$html.'</div>',
|
||||
'<div class="form-filemanager" data-fieldtype="filemanager">' . $fm->toHtml() . '</div>',
|
||||
$this->description, true, '', '', $query);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue