Permalink
Browse files

MDL-33322 Filepicker: fix filepicker for recent file with JS turned of

  • Loading branch information...
1 parent 4631e39 commit 4239150a606101318983a31e2dec548b6dee4a6e Rossiani Wijaya committed May 31, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 repository/filepicker.php
View
@@ -67,7 +67,7 @@
// 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 @@
$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'));

0 comments on commit 4239150

Please sign in to comment.