diff --git a/main/exercise/admin.php b/main/exercise/admin.php index 9ba5ca63a6..361b48f4ff 100755 --- a/main/exercise/admin.php +++ b/main/exercise/admin.php @@ -346,7 +346,7 @@ if ($inATest) { $maxScoreAllQuestions = 0; if ($showPagination === false) { - $questionList = $objExercise->selectQuestionList(true, true); + $questionList = $objExercise->selectQuestionList(true, $objExercise->random > 0 ? false : true); if (!empty($questionList)) { foreach ($questionList as $questionItemId) { $question = Question::read($questionItemId); @@ -371,16 +371,48 @@ if ($inATest) { } $alert = ''; + if ($showPagination === false) { + $originalSelectionType = $objExercise->questionSelectionType; + $objExercise->questionSelectionType = EX_Q_SELECTION_ORDERED; + + $fullQuestionsScore = array_reduce( + $objExercise->selectQuestionList(true, true), + function ($acc, $questionId) { + $objQuestionTmp = Question::read($questionId); + + return $acc + $objQuestionTmp->selectWeighting(); + }, + 0 + ); + + $objExercise->questionSelectionType = $originalSelectionType; + $alert .= sprintf( get_lang('XQuestionsWithTotalScoreY'), $nbrQuestions, - $maxScoreAllQuestions + $fullQuestionsScore ); } if ($objExercise->random > 0) { $alert .= '
'.sprintf(get_lang('OnlyXQuestionsPickedRandomly'), $objExercise->random); + $alert .= sprintf( + '
'.get_lang('XQuestionsSelectedWithTotalScoreY'), + $objExercise->random, + $maxScoreAllQuestions + ); + } + + if ($showPagination === false) { + if ($objExercise->questionSelectionType >= EX_Q_SELECTION_CATEGORIES_ORDERED_QUESTIONS_ORDERED) { + $alert .= sprintf( + '
'.get_lang('XQuestionsSelectedWithTotalScoreY'), + count($questionList), + $maxScoreAllQuestions + ); + } } + echo Display::return_message($alert, 'normal', false); } elseif (isset($_GET['newQuestion'])) { // we are in create a new question from question pool not in a test