fwrite ($bf,full_tag("HIDDEN",5,false,$grade_item->hidden));
fwrite ($bf,full_tag("LOCKED",5,false,$grade_item->locked));
fwrite ($bf,full_tag("LOCKTIME",5,false,$grade_item->locktime));
+ fwrite ($bf,full_tag("NEEDSUPDATE",5,false,$grade_item->needsupdate));
+ fwrite ($bf,full_tag("TIMECREATED",5,false,$grade_item->timecreated));
+ fwrite ($bf,full_tag("TIMEMODIFIED",5,false,$grade_item->timemodified));
// back up the other stuff here
// mod grades should only be backed up if selected
$restore_course_files = required_param('restore_course_files');
//restore_site_files
$restore_site_files = required_param('restore_site_files');
+ //restore_gradebook_history
+ $restore_gradebook_history = required_param('restore_gradebook_history');
//restore_messages
$restore_messages = required_param('restore_messages');
-
+
//Check we've selected a course to restore to
$course_id = optional_param('course_id', 0, PARAM_INT);
$restore->course_files=$restore_course_files;
$restore->site_files=$restore_site_files;
$restore->messages=$restore_messages;
+ $restore->restore_gradebook_history=$restore_gradebook_history;
$restore->course_id=$course_id;
//add new vars to restore object
$restore->course_startdateoffset = $coursestartdatedateoffset;
error( 'course_header object missing from session' );
}
+ $restore_gradebook_history = optional_param('restore_gradebook_history', 1, PARAM_INT);
+
//Check that we have all we need
//backup_unique_code
$backup_unique_code = required_param( 'backup_unique_code' );
echo "<input type=\"hidden\" name=\"restore_site_files\" value=\"0\" />";
}
echo "</td></tr>";
-
+
+ // do you want grade histories to be restored?
+ echo "<tr>";
+ echo "<td align=\"right\" colspan=\"2\"><b>";
+ echo get_string ('gradebookhistories', 'grades').":";
+ echo "</b></td><td colspan=\"2\">";
+ $gradebook_history_options[0] = get_string("no");
+ $gradebook_history_options[1] = get_string("yes");
+ choose_from_menu($gradebook_history_options, "restore_gradebook_history", $restore_gradebook_history, "");
+ echo "</td></tr>";
+
//Now print the Messages tr
echo "<tr>";
echo "<td align=\"right\" colspan=\"2\"><b>";
echo "<input type=\"hidden\" name=\"restore_messages\" value=\"0\" />";
}
echo "</td></tr>";
+
+
}
?>
</table>
$dbrec->grademin = backup_todb($info['GRADE_ITEM']['#']['GRADEMIN']['0']['#']);
/// needs to be restored first
- if ($info['GRADE_ITEM']['#']['SCALEID']['0']['#']) {
+ if (backup_todb($info['GRADE_ITEM']['#']['SCALEID']['0']['#'])) {
$scale = backup_getid($restore->backup_unique_code,"scale",backup_todb($info['GRADE_ITEM']['#']['SCALEID']['0']['#']));
$dbrec->scaleid = $scale->new_id;
}
$dbrec->hidden = backup_todb($info['GRADE_ITEM']['#']['HIDDEN']['0']['#']);
$dbrec->locked = backup_todb($info['GRADE_ITEM']['#']['LOCKED']['0']['#']);
$dbrec->locktime = backup_todb($info['GRADE_ITEM']['#']['LOCKTIME']['0']['#']);
+ $dbrec->needsupdate = backup_todb($info['GRADE_ITEM']['#']['NEEDSUPDATE']['0']['#']);
+ $dbrec->timecreated = backup_todb($info['GRADE_ITEM']['#']['TIMECREATED']['0']['#']);
+ $dbrec->timemodified = backup_todb($info['GRADE_ITEM']['#']['TIMEMODIFIED']['0']['#']);
// get the current sortorder, add 1 to it and use that
if ($lastitem = get_record_sql("SELECT sortorder, id FROM {$CFG->prefix}grade_items
$grade->rawgrademax = backup_todb($ite_info['#']['RAWGRADEMAX']['0']['#']);
$grade->rawgrademin = backup_todb($ite_info['#']['RAWGRADEMIN']['0']['#']);
// need to find scaleid
- if ($ite_info['#']['RAWSCALEID']['0']['#']) {
+ if (backup_todb($ite_info['#']['RAWSCALEID']['0']['#'])) {
$scale = backup_getid($restore->backup_unique_code,"scale",backup_todb($ite_info['#']['RAWSCALEID']['0']['#']));
$grade->rawscaleid = $scale->new_id;
}
}
// process histories
- if ($gchcount && $continue && !isset($SESSION->restore->importing)) {
+ if ($gchcount && $continue && !isset($SESSION->restore->importing) && $restore->restore_gradebook_history) {
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('gradecategoryhistory','grades').'</li>';
}
}
// process histories
- if ($gghcount && $continue && !isset($SESSION->restore->importing)) {
+ if ($gghcount && $continue && !isset($SESSION->restore->importing) && $restore->restore_gradebook_history) {
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('gradegradeshistory','grades').'</li>';
}
// process histories
- if ($ggthcount && $continue && !isset($SESSION->restore->importing)) {
+ if ($ggthcount && $continue && !isset($SESSION->restore->importing) && $restore->restore_gradebook_history) {
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('gradegradestexthistory','grades').'</li>';
}
}
// process histories
- if ($gihcount && $continue && !isset($SESSION->restore->importing)) {
+ if ($gihcount && $continue && !isset($SESSION->restore->importing) && $restore->restore_gradebook_history) {
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('gradeitemshistory','grades').'</li>';
}
}
// process histories
- if ($gohcount && $continue && !isset($SESSION->restore->importing)) {
+ if ($gohcount && $continue && !isset($SESSION->restore->importing) && $restore->restore_gradebook_history) {
if (!defined('RESTORE_SILENTLY')) {
echo '<li>'.get_string('gradeoutcomeshistory','grades').'</li>';
}