|
|
|
@ -880,10 +880,18 @@ class CourseRestorer |
|
|
|
|
$sql = "INSERT INTO ".$table_que." SET question = '".addslashes($question->question)."', description = '".addslashes($question->description)."', ponderation = '".addslashes($question->ponderation)."', position = '".addslashes($question->position)."', type='".addslashes($question->quiz_type)."', picture='".addslashes($question->picture)."', level='".addslashes($question->level)."'"; |
|
|
|
|
Database::query($sql, __FILE__, __LINE__); |
|
|
|
|
$new_id = Database::insert_id(); |
|
|
|
|
foreach ($question->answers as $index => $answer) |
|
|
|
|
{ |
|
|
|
|
$sql = "INSERT INTO ".$table_ans." SET id= '". ($index +1)."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($question->quiz_type == 4) { // for answer type matching |
|
|
|
|
foreach ($question->answers as $index => $answer) { |
|
|
|
|
$sql = "INSERT INTO ".$table_ans." SET id= '".$answer['id']."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'"; |
|
|
|
|
Database::query($sql, __FILE__, __LINE__); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
foreach ($question->answers as $index => $answer) { |
|
|
|
|
$sql = "INSERT INTO ".$table_ans." SET id= '". ($index +1)."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'"; |
|
|
|
|
Database::query($sql, __FILE__, __LINE__); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$this->course->resources[RESOURCE_QUIZQUESTION][$id]->destination_id = $new_id; |
|
|
|
|
} |
|
|
|
|