Some work on question restore code, not complete

This commit is contained in:
gustav_delius 2006-03-13 00:18:38 +00:00
parent d348b6f2b0
commit 12fcd27da6
5 changed files with 154 additions and 3148 deletions

View file

@ -4822,8 +4822,6 @@
} }
} }
} }
// The following will be enabled once the quiz and question restore code are separated
//include_once("$CFG->dirroot/question/restorelib.php");
if (!defined('RESTORE_SILENTLY')) { if (!defined('RESTORE_SILENTLY')) {
//Start the main table //Start the main table
@ -5041,8 +5039,9 @@
} }
//Now create categories and questions as needed (STEP1) //Now create categories and questions as needed
if ($status and ($restore->mods['quiz']->restore)) { if ($status and ($restore->mods['quiz']->restore)) {
include_once("$CFG->dirroot/question/restorelib.php");
if (!defined('RESTORE_SILENTLY')) { if (!defined('RESTORE_SILENTLY')) {
echo "</li><li>".get_string("creatingcategoriesandquestions"); echo "</li><li>".get_string("creatingcategoriesandquestions");
echo "<ul>"; echo "<ul>";

File diff suppressed because it is too large Load diff

View file

@ -44,4 +44,30 @@
return $status; return $status;
} }
//This function restores the question_essay_states
function question_essay_states_restore($state_id,$info,$restore) {
global $CFG;
$status = true;
//Get the question_essay_state
$essay_state = $info['#']['ESSAY_STATE']['0'];
if ($essay_state) {
//Now, build the ESSAY_STATES record structure
$state->stateid = $state_id;
$state->graded = backup_todb($essay_state['#']['GRADED']['0']['#']);
$state->fraction = backup_todb($essay_state['#']['FRACTION']['0']['#']);
$state->response = backup_todb($essay_state['#']['RESPONSE']['0']['#']);
//The structure is equal to the db, so insert the question_states
$newid = insert_record ("question_essay_states",$state);
}
return $status;
}
?> ?>

View file

@ -44,4 +44,30 @@
return $status; return $status;
} }
//This function restores the question_rqp_states
function question_rqp_states_restore($state_id,$info,$restore) {
global $CFG;
$status = true;
//Get the question_rqp_state
$rqp_state = $info['#']['RQP_STATE']['0'];
if ($rqp_state) {
//Now, build the RQP_STATES record structure
$state->stateid = $state_id;
$state->responses = backup_todb($rqp_state['#']['RESPONSES']['0']['#']);
$state->persistent_data = backup_todb($rqp_state['#']['PERSISTENT_DATA']['0']['#']);
$state->template_vars = backup_todb($rqp_state['#']['TEMPLATE_VARS']['0']['#']);
//The structure is equal to the db, so insert the question_states
$newid = insert_record ("question_rqp_states",$state);
}
return $status;
}
?> ?>

File diff suppressed because it is too large Load diff