Fix question pool order BT#16660

pull/3140/head
Julio Montoya 6 years ago
parent d388731722
commit 6f436e5804
  1. 77
      main/exercise/question_pool.php

@ -680,7 +680,8 @@ function getQuestions(
$where $where
$currentExerciseCondition $currentExerciseCondition
{$efConditions['where']} {$efConditions['where']}
ORDER BY question_order"; ORDER BY BINARY qu.question ASC
";
} elseif ($exerciseId == -1) { } elseif ($exerciseId == -1) {
$efConditions = getExtraFieldConditions($formValues, 'join'); $efConditions = getExtraFieldConditions($formValues, 'join');
// If we have selected the option 'Orphan questions' in the list-box 'Filter' // If we have selected the option 'Orphan questions' in the list-box 'Filter'
@ -823,7 +824,7 @@ function getQuestions(
$currentExerciseCondition $currentExerciseCondition
{$efConditions['where']} {$efConditions['where']}
GROUP BY qu.iid GROUP BY qu.iid
ORDER BY session_id ASC ORDER BY BINARY qu.question ASC
"; ";
} }
@ -838,9 +839,7 @@ function getQuestions(
} }
$sql .= " LIMIT $start, $length"; $sql .= " LIMIT $start, $length";
$result = Database::query($sql); $result = Database::query($sql);
$mainQuestionList = []; $mainQuestionList = [];
while ($row = Database::fetch_array($result, 'ASSOC')) { while ($row = Database::fetch_array($result, 'ASSOC')) {
$mainQuestionList[] = $row; $mainQuestionList[] = $row;
@ -973,8 +972,6 @@ if (is_array($mainQuestionList)) {
continue; continue;
} }
$sessionId = isset($question['session_id']) ? $question['session_id'] : null; $sessionId = isset($question['session_id']) ? $question['session_id'] : null;
//$exerciseName = isset($question['exercise_name']) ? '<br />('.$question['exercise_id'].') ' : null;
if (!$objExercise->hasQuestion($question['id'])) { if (!$objExercise->hasQuestion($question['id'])) {
$row[] = Display::input( $row[] = Display::input(
'checkbox', 'checkbox',
@ -1031,49 +1028,13 @@ if (is_array($mainQuestionList)) {
} }
} }
// Display table $headers = [
$header = [
[
'',
false,
['style' => 'text-align:center'],
['style' => 'text-align:center'],
'', '',
],
[
get_lang('QuestionUpperCaseFirstLetter'), get_lang('QuestionUpperCaseFirstLetter'),
false,
['style' => 'text-align:center'],
'',
],
[
get_lang('Type'), get_lang('Type'),
false,
['style' => 'text-align:center'],
['style' => 'text-align:center'],
'',
],
[
get_lang('QuestionCategory'), get_lang('QuestionCategory'),
false,
['style' => 'text-align:center'],
['style' => 'text-align:center'],
'',
],
[
get_lang('Difficulty'), get_lang('Difficulty'),
false,
['style' => 'text-align:center'],
['style' => 'text-align:center'],
'',
],
[
$actionLabel, $actionLabel,
false,
['style' => 'text-align:center'],
['style' => 'text-align:center'],
'',
],
]; ];
echo $pagination; echo $pagination;
@ -1083,12 +1044,32 @@ echo '<input type="hidden" name="cidReq" value="'.$_course['code'].'">';
echo '<input type="hidden" name="selected_course" value="'.$selected_course.'">'; echo '<input type="hidden" name="selected_course" value="'.$selected_course.'">';
echo '<input type="hidden" name="course_id" value="'.$selected_course.'">'; echo '<input type="hidden" name="course_id" value="'.$selected_course.'">';
Display::display_sortable_table( $table = new HTML_Table(['class' => 'table table-bordered data_table'], false);
$header, $row = 0;
$data, $column = 0;
'', foreach ($headers as $header) {
['per_page_default' => 999, 'per_page' => 999, 'page_nr' => 1] $table->setHeaderContents($row,$column , $header);
$column++;
}
$row = 1;
foreach ($data as $rows) {
$column = 0;
foreach ($rows as $value) {
$table->setCellContents($row, $column, $value);
$table->updateCellAttributes(
$row,
$column,
$value
); );
$column++;
}
$row++;
}
$table->display();
echo '</form>'; echo '</form>';
$tableId = 'question_pool_id'; $tableId = 'question_pool_id';

Loading…
Cancel
Save