$method = optional_param( 'method' );
$backup_unique_code = optional_param('backup_unique_code',0,PARAM_INT);
+ //Get and check course
+ if (! $course = get_record("course", "id", $id)) {
+ error("Course ID was incorrect (can't find it)");
+ }
+ // To some reasons, course_startdateoffset value was lost during restoring
+ // See MDL-17469
+ if (!empty($course->startdate) && !empty($SESSION->course_header->course_startdate)) {
+ $SESSION->restore->course_startdateoffset = $course->startdate - $SESSION->course_header->course_startdate;
+ } else {
+ $SESSION->restore->course_startdateoffset = 0;
+ }
+
//Check login
require_login();
//We are here, so me have a file.
- //Get and check course
- if (! $course = $DB->get_record("course", array("id"=>$id))) {
- print_error('invalidcourseid', '', '', $id);
- }
-
//Print header
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
$navlinks[] = array('name' => basename($file), 'link' => null, 'type' => 'misc');
$assignment->type = isset($info['MOD']['#']['TYPE']['0']['#'])?backup_todb($info['MOD']['#']['TYPE']['0']['#']):'';
$assignment->assignmenttype = backup_todb($info['MOD']['#']['ASSIGNMENTTYPE']['0']['#']);
$assignment->maxbytes = backup_todb($info['MOD']['#']['MAXBYTES']['0']['#']);
- $assignment->timedue = backup_todb($data->info['MOD']['#']['TIMEDUE']['0']['#']);
- $assignment->timeavailable = backup_todb($data->info['MOD']['#']['TIMEAVAILABLE']['0']['#']);
+ $assignment->timedue = backup_todb($info['MOD']['#']['TIMEDUE']['0']['#']);
+ $assignment->timeavailable = backup_todb($info['MOD']['#']['TIMEAVAILABLE']['0']['#']);
$assignment->grade = backup_todb($info['MOD']['#']['GRADE']['0']['#']);
$assignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);