"MDL-17469, fix assignment date when restore course, merged from 1.9"

This commit is contained in:
dongsheng
2008-12-11 04:39:33 +00:00
parent 26b266625b
commit 0dfd9e97ea
2 changed files with 14 additions and 7 deletions
+12 -5
View File
@@ -23,6 +23,18 @@
$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();
@@ -116,11 +128,6 @@
//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');
+2 -2
View File
@@ -57,8 +57,8 @@
$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']['#']);