|
|
|
@ -937,6 +937,66 @@ switch ($action) { |
|
|
|
} |
|
|
|
} |
|
|
|
echo json_encode(['ok' => true, 'savedAnswerMessage' => $savedQuestionsMessage]); |
|
|
|
echo json_encode(['ok' => true, 'savedAnswerMessage' => $savedQuestionsMessage]); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'show_question_attempt': |
|
|
|
|
|
|
|
$isAllowedToEdit = api_is_allowed_to_edit(null, true, false, false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$isAllowedToEdit) { |
|
|
|
|
|
|
|
api_not_allowed(true); |
|
|
|
|
|
|
|
exit; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$questionId = isset($_GET['question']) ? (int) $_GET['question'] : 0; |
|
|
|
|
|
|
|
$exerciseId = isset($_REQUEST['exercise']) ? (int) $_REQUEST['exercise'] : 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$questionId || !$exerciseId) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objExercise = new Exercise(); |
|
|
|
|
|
|
|
$objExercise->read($exerciseId); |
|
|
|
|
|
|
|
$objQuestion = Question::read($questionId); |
|
|
|
|
|
|
|
$id = ''; |
|
|
|
|
|
|
|
if (api_get_configuration_value('show_question_id')) { |
|
|
|
|
|
|
|
$id = '<h4>#'.$objQuestion->course['code'].'-'.$objQuestion->iid.'</h4>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
echo $id; |
|
|
|
|
|
|
|
echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>'; |
|
|
|
|
|
|
|
if (in_array($objQuestion->type, [FILL_IN_BLANKS, FILL_IN_BLANKS_GLOBAL])) { |
|
|
|
|
|
|
|
echo '<script> |
|
|
|
|
|
|
|
$(function() { |
|
|
|
|
|
|
|
$(".selectpicker").selectpicker({}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Allows render MathJax elements in a ajax call |
|
|
|
|
|
|
|
if (api_get_setting('include_asciimathml_script') === 'true') { |
|
|
|
|
|
|
|
echo '<script> MathJax.Hub.Queue(["Typeset",MathJax.Hub]);</script>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (in_array($objQuestion->type, [HOT_SPOT, HOT_SPOT_GLOBAL])) { |
|
|
|
|
|
|
|
echo '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'hotspot/js/hotspot.js"></script>'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$attemptList = []; |
|
|
|
|
|
|
|
if (!empty($exeId)) { |
|
|
|
|
|
|
|
$attemptList = Event::getAllExerciseEventByExeId($exeId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$userChoice = isset($attemptList[$questionId]) ? $attemptList[$questionId] : null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ExerciseLib::showQuestion( |
|
|
|
|
|
|
|
$objExercise, |
|
|
|
|
|
|
|
$questionId, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
false, |
|
|
|
|
|
|
|
true, |
|
|
|
|
|
|
|
$userChoice, |
|
|
|
|
|
|
|
true |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
break; |
|
|
|
case 'show_question': |
|
|
|
case 'show_question': |
|
|
|
$isAllowedToEdit = api_is_allowed_to_edit(null, true, false, false); |
|
|
|
$isAllowedToEdit = api_is_allowed_to_edit(null, true, false, false); |
|
|
|
|
|
|
|
|
|
|
|
|