Skip to content

Commit

Permalink
Fix question list order see #7912
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Oct 22, 2015
1 parent e1608e4 commit a7001ca
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions main/inc/lib/exercise.lib.php
Expand Up @@ -110,11 +110,10 @@ public static function showQuestion(
<div class="clearfix">
<ul class="exercise-draggable-answer ui-helper-reset ui-helper-clearfix">';
} else {
$s .= <<<HTML
<div id="drag{$questionId}_question" class="drag_question">
<table class="data_table">
HTML;
$s .= '<div id="drag{'.$questionId.'}_question" class="drag_question">
<table class="data_table">';
}

// Iterate through answers
$x = 1;
//mark letters for each answer
Expand Down Expand Up @@ -155,7 +154,6 @@ public static function showQuestion(
}
}
$num_suggestions = ($nbrAnswers - $x) + 1;

} elseif ($answerType == FREE_ANSWER) {
$fck_content = isset($user_choice[0]) && !empty($user_choice[0]['answer']) ? $user_choice[0]['answer'] : null;

Expand All @@ -165,7 +163,7 @@ public static function showQuestion(
);
$form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
$s .= $form->returnForm();
$s .= $form->returnForm();
} elseif ($answerType == ORAL_EXPRESSION) {
// Add nanog
if (api_get_setting('enable_nanogong') == 'true') {
Expand Down Expand Up @@ -195,7 +193,7 @@ public static function showQuestion(
);
$form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
//$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
$s .= $form->return_form();
$s .= $form->returnForm();
}

// Now navigate through the possible answers, using the max number of
Expand Down Expand Up @@ -545,7 +543,6 @@ public static function showQuestion(
$s .= '</td>';
}
$s .= '</tr>';

} elseif ($answerType == FILL_IN_BLANKS) {
// display the question, with field empty, for student to fill it,
// or filled to display the answer in the Question preview of the exercice/admin.php page
Expand Down Expand Up @@ -629,9 +626,9 @@ public static function showQuestion(
$trackAttempts = Database::get_main_table(
TABLE_STATISTIC_TRACK_E_ATTEMPT
);
$sqlTrackAttempt = 'SELECT answer FROM ' . $trackAttempts . '
WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId;
$rsLastAttempt = Database::query($sqlTrackAttempt);
$sql = 'SELECT answer FROM ' . $trackAttempts . '
WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId;
$rsLastAttempt = Database::query($sql);
$rowLastAttempt = Database::fetch_array($rsLastAttempt);
$answer = $rowLastAttempt['answer'];
if (empty($answer)) {
Expand Down Expand Up @@ -1016,7 +1013,6 @@ public static function showQuestion(
$lines_count++;
}
}

$matching_correct_answer++;
}
}
Expand All @@ -1036,11 +1032,12 @@ public static function showQuestion(
]
)
) {
$s .= '</table>';
$s .= '</table>';
}

if ($answerType == DRAGGABLE) {
$s .= "</ul></div>";
$s .= "</ul>";
$s .= "</div>"; //clearfix

$counterAnswer = 1;

Expand All @@ -1063,14 +1060,16 @@ public static function showQuestion(
}
}

$s .= '</div></div>';
$s .= '</div>'; // row
$s .= '</div>'; // col-md-12
$s .= '</div>'; // col-md-12 ui-widget ui-helper-clearfix
}

if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
$s .= '</div>';
$s .= '</div>'; //drag_question
}

$s .= '</div>';
$s .= '</div>'; //question_options row

// destruction of the Answer object
unset($objAnswerTmp);
Expand Down

0 comments on commit a7001ca

Please sign in to comment.