added needsupdate flag into backup/restore, added a new switch for restore on/off for grade histories, fixed some NULL related warnings
This commit is contained in:
@@ -1513,6 +1513,9 @@
|
||||
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
|
||||
|
||||
@@ -92,9 +92,11 @@
|
||||
$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);
|
||||
|
||||
@@ -129,6 +131,7 @@
|
||||
$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;
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
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' );
|
||||
@@ -468,7 +470,17 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
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>";
|
||||
@@ -487,6 +499,8 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
|
||||
echo "<input type=\"hidden\" name=\"restore_messages\" value=\"0\" />";
|
||||
}
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
+10
-7
@@ -1564,7 +1564,7 @@
|
||||
$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;
|
||||
}
|
||||
@@ -1578,6 +1578,9 @@
|
||||
$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
|
||||
@@ -1622,7 +1625,7 @@
|
||||
$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;
|
||||
}
|
||||
@@ -1696,7 +1699,7 @@
|
||||
}
|
||||
|
||||
// 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>';
|
||||
}
|
||||
@@ -1789,7 +1792,7 @@
|
||||
}
|
||||
|
||||
// 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>';
|
||||
}
|
||||
@@ -1870,7 +1873,7 @@
|
||||
|
||||
// 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>';
|
||||
}
|
||||
@@ -1944,7 +1947,7 @@
|
||||
}
|
||||
|
||||
// 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>';
|
||||
}
|
||||
@@ -2083,7 +2086,7 @@
|
||||
}
|
||||
|
||||
// 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>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user