mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Some work on question restore code, not complete
This commit is contained in:
parent
d348b6f2b0
commit
12fcd27da6
5 changed files with 154 additions and 3148 deletions
|
@ -44,4 +44,30 @@
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -44,4 +44,30 @@
|
|||
|
||||
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
Loading…
Add table
Add a link
Reference in a new issue