mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
"MDL-23822, fixed return url of private files manager"
This commit is contained in:
parent
ea62bb3e37
commit
02d4460c42
@ -61,7 +61,7 @@ class block_private_files extends block_base {
|
||||
$renderer = $this->page->get_renderer('block_private_files');
|
||||
$this->content->text = $renderer->private_files_tree();
|
||||
if (has_capability('moodle/user:manageownfiles', $this->context)) {
|
||||
$this->content->text .= $OUTPUT->single_button(new moodle_url('/user/filesedit.php'), get_string('myfilesmanage'), 'get');
|
||||
$this->content->text .= $OUTPUT->single_button(new moodle_url('/user/filesedit.php', array('returnurl'=>$PAGE->url->out())), get_string('myfilesmanage'), 'get');
|
||||
}
|
||||
$this->content->footer = '';
|
||||
|
||||
|
@ -31,6 +31,17 @@ require_login();
|
||||
if (isguestuser()) {
|
||||
die();
|
||||
}
|
||||
|
||||
$returnurl = optional_param('returnurl', '', PARAM_URL);
|
||||
|
||||
if (empty($returnurl)) {
|
||||
if (!empty($_SERVER["HTTP_REFERER"])) {
|
||||
$returnurl = $_SERVER["HTTP_REFERER"];
|
||||
} else {
|
||||
$returnurl = new moodle_url('/user/files.php');
|
||||
}
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
require_capability('moodle/user:manageownfiles', $context);
|
||||
|
||||
@ -45,17 +56,17 @@ $PAGE->set_pagelayout('mydashboard');
|
||||
$PAGE->set_pagetype('user-files');
|
||||
|
||||
$data = new object();
|
||||
$data->returnurl = $returnurl;
|
||||
$options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
|
||||
file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);
|
||||
|
||||
$mform = new user_filesedit_form(null, array('data'=>$data, 'options'=>$options));
|
||||
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect(new moodle_url('/user/files.php'));
|
||||
|
||||
redirect($returnurl);
|
||||
} else if ($formdata = $mform->get_data()) {
|
||||
$formdata = file_postupdate_standard_filemanager($formdata, 'files', $options, $context, 'user', 'private', 0);
|
||||
redirect(new moodle_url('/user/files.php'));
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
|
@ -35,6 +35,7 @@ class user_filesedit_form extends moodleform {
|
||||
$options = $this->_customdata['options'];
|
||||
|
||||
$mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options);
|
||||
$mform->addElement('hidden', 'returnurl', $data->returnurl);
|
||||
|
||||
$this->add_action_buttons(true, get_string('savechanges'));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user