// (CL,pk->id,fk->category,files) |
// | question_dataset_items
// | (CL,pk->id,fk->definition)
- // | question_rqp_type
- // | (SL,pk->id)
- // | |
- // -------------------------------------------------------------------------------------------------------------- |
- // | | | | | | | question_rqp
- // | | | | | | |--(CL,pk->id,fk->question)
+ // |
+ // |
+ // |
+ // --------------------------------------------------------------------------------------------------------------
+ // | | | | | | |
+ // | | | | | | |
// | | | | question_calculated | |
// question_truefalse | question_multichoice | (CL,pl->id,fk->question) | |
// (CL,pk->id,fk->question) | (CL,pk->id,fk->question) | . | | question_randomsamatch
// .
// question_states
// (UL,pk->id,fk->attempt,question)
- // |
- // question_rqp_states
- // (UL,pk->id,fk->stateid)
//
// Meaning: pk->primary key field of the table
// fk->foreign key to link with parent
fwrite ($bf,full_tag("GRADE",$level + 2,false,$state->grade));
fwrite ($bf,full_tag("RAW_GRADE",$level + 2,false,$state->raw_grade));
fwrite ($bf,full_tag("PENALTY",$level + 2,false,$state->penalty));
- // now back up question type specific state information
- $status = backup_question_rqp_state ($bf,$preferences,$state->id, $level + 2);
//End state
$status = fwrite ($bf,end_tag("STATE",$level + 1,true));
}
return $status;
}
- //Backup question_rqp_state contents (executed from backup_question_states)
- function backup_question_rqp_state ($bf,$preferences,$state, $level = 8) {
-
- global $CFG;
-
- $status = true;
-
- $rqp_state = get_record("question_rqp_states","stateid",$state);
- //If there is a state
- if ($rqp_state) {
- //Write start tag
- $status = fwrite ($bf,start_tag("RQP_STATE",$level,true));
- //Print state contents
- fwrite ($bf,full_tag("RESPONSES",$level + 1,false,$rqp_state->responses));
- fwrite ($bf,full_tag("PERSISTENT_DATA",$level + 1,false,$rqp_state->persistent_data));
- fwrite ($bf,full_tag("TEMPLATE_VARS",$level + 1,false,$rqp_state->template_vars));
- //Write end tag
- $status = fwrite ($bf,end_tag("RQP_STATE",$level,true));
- }
- return $status;
- }
-
//Returns an array of categories id
function question_category_ids_by_backup ($backup_unique_code) {
// (CL,pk->id,fk->category,files) |
// | question_dataset_items
// | (CL,pk->id,fk->definition)
- // | question_rqp_type
- // | (SL,pk->id)
- // | |
- // -------------------------------------------------------------------------------------------------------------- |
- // | | | | | | | question_rqp
- // | | | | | | |--(CL,pk->id,fk->question)
+ // |
+ // |
+ // |
+ // --------------------------------------------------------------------------------------------------------------
+ // | | | | | | |
+ // | | | | | | |
// | | | | question_calculated | |
// question_truefalse | question_multichoice | (CL,pl->id,fk->question) | |
// (CL,pk->id,fk->question) | (CL,pk->id,fk->question) | . | | question_randomsamatch
// .
// question_states
// (UL,pk->id,fk->attempt,question)
- // |
- // question_rqp_states
- // (UL,pk->id,fk->stateid)
//
// Meaning: pk->primary key field of the table
// fk->foreign key to link with parent
if ($newid) {
//We have the newid, update backup_ids
- backup_putid($restore->backup_unique_code,"question_states",$oldid,
- $newid);
- //Now process question type specific state information
- $qtype = get_field('question', 'qtype', 'id', $state->question);
- $status = $QTYPES[$qtype]->restore_state($newid,$res_info,$restore);
+ backup_putid($restore->backup_unique_code, 'question_states', $oldid, $newid);
} else {
$status = false;
}