$status = fwrite ($bf,start_tag("MATCH",7,true));
//Print match contents
fwrite ($bf,full_tag("ID",8,false,$match->id));
+ fwrite ($bf,full_tag("CODE",8,false,$match->code));
fwrite ($bf,full_tag("QUESTIONTEXT",8,false,$match->questiontext));
fwrite ($bf,full_tag("ANSWERTEXT",8,false,$match->answertext));
- fwrite ($bf,full_tag("SHUFFLEANSWERS",8,false,$randomsamatch->shuffleanswers));
$status = fwrite ($bf,end_tag("MATCH",7,true));
}
$status = fwrite ($bf,end_tag("MATCHS",6,true));
//Now, build the question_match_SUB record structure
$match_sub->question = $new_question_id;
+ $match_sub->code = backup_todb($mat_info['#']['CODE']['0']['#']);
+ if (!$match_sub->code) {
+ $match_sub->code = $oldid;
+ }
$match_sub->questiontext = backup_todb($mat_info['#']['QUESTIONTEXT']['0']['#']);
$match_sub->answertext = backup_todb($mat_info['#']['ANSWERTEXT']['0']['#']);
//Extract the match_sub for the question and the answer
$exploded = explode("-",$tok);
$match_question_id = $exploded[0];
- $match_answer_id = $exploded[1];
+ $match_answer_code = $exploded[1];
//Get the match_sub from backup_ids (for the question)
if (!$match_que = backup_getid($restore->backup_unique_code,"question_match_sub",$match_question_id)) {
echo 'Could not recode question_match_sub '.$match_question_id.'<br />';
}
- //Get the match_sub from backup_ids (for the answer)
- if (!$match_ans = backup_getid($restore->backup_unique_code,"question_match_sub",$match_answer_id)) {
- echo 'Could not recode question_match_sub '.$match_answer_id.'<br />';
- }
- if ($match_que) {
- //It the question hasn't response, it must be 0
- if (!$match_ans and $match_answer_id == 0) {
- $match_ans->new_id = 0;
- }
- if ($in_first) {
- $answer_field .= $match_que->new_id."-".$match_ans->new_id;
- $in_first = false;
- } else {
- $answer_field .= ",".$match_que->new_id."-".$match_ans->new_id;
- }
+ if ($in_first) {
+ $answer_field .= $match_que->new_id."-".$match_answer_code;
+ $in_first = false;
+ } else {
+ $answer_field .= ",".$match_que->new_id."-".$match_answer_code;
}
//check for next
$tok = strtok(",");