Merge branch 'MDL-33322' of git://github.com/rwijaya/moodle
This commit is contained in:
@@ -333,7 +333,8 @@ default:
|
||||
|
||||
$home_url->param('action', 'browse');
|
||||
$home_url->param('draftpath', $file->filepath);
|
||||
$foldername = trim(array_pop(explode('/', trim($file->filepath, '/'))), '/');
|
||||
$filepathchunks = explode('/', trim($file->filepath, '/'));
|
||||
$foldername = trim(array_pop($filepathchunks), '/');
|
||||
echo html_writer::link($home_url, $foldername);
|
||||
|
||||
$home_url->param('draftpath', $file->filepath);
|
||||
|
||||
@@ -67,7 +67,7 @@ $draftpath = optional_param('draftpath', '/', PARAM_PATH);
|
||||
|
||||
|
||||
// user context
|
||||
$user_context = get_context_instance(CONTEXT_USER, $USER->id);
|
||||
$user_context = context_user::instance($USER->id);
|
||||
|
||||
$PAGE->set_context($user_context);
|
||||
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
|
||||
@@ -298,7 +298,14 @@ case 'download':
|
||||
$record->itemid = $itemid;
|
||||
$record->license = '';
|
||||
$record->author = '';
|
||||
$record->source = $thefile['url'];
|
||||
|
||||
$now = time();
|
||||
$record->timecreated = $now;
|
||||
$record->timemodified = $now;
|
||||
$record->userid = $USER->id;
|
||||
$record->contextid = $user_context->id;
|
||||
|
||||
$record->source = serialize((object)array('source' => $thefile['url']));
|
||||
try {
|
||||
$info = repository::move_to_filepool($thefile['path'], $record);
|
||||
redirect($home_url, get_string('downloadsucc', 'repository'));
|
||||
|
||||
Reference in New Issue
Block a user