diff --git a/main/exercise/admin.php b/main/exercise/admin.php index 75af2a91717..1b4e349776c 100755 --- a/main/exercise/admin.php +++ b/main/exercise/admin.php @@ -56,6 +56,8 @@ $is_allowedToEdit = api_is_allowed_to_edit(null, true, false, false); $sessionId = api_get_session_id(); $studentViewActive = api_is_student_view_active(); +$showPagination = api_get_configuration_value('show_question_pagination'); + if (!$is_allowedToEdit) { api_not_allowed(true); } @@ -167,7 +169,6 @@ // creation of a new exercise if wrong or not specified exercise ID if ($exerciseId) { - $showPagination = api_get_configuration_value('show_question_pagination'); $objExercise->read($exerciseId, $showPagination > 0 ? false : true); } // saves the object into the session @@ -353,12 +354,14 @@ Display::return_icon('settings.png', get_lang('ModifyExercise'), '', ICON_SIZE_MEDIUM).''; $maxScoreAllQuestions = 0; - $questionList = $objExercise->selectQuestionList(true, true); - if (!empty($questionList)) { - foreach ($questionList as $questionItemId) { - $question = Question::read($questionItemId); - if ($question) { - $maxScoreAllQuestions += $question->selectWeighting(); + if ($showPagination === false) { + $questionList = $objExercise->selectQuestionList(true, true); + if (!empty($questionList)) { + foreach ($questionList as $questionItemId) { + $question = Question::read($questionItemId); + if ($question) { + $maxScoreAllQuestions += $question->selectWeighting(); + } } } } @@ -377,17 +380,18 @@ ); } - echo '
'; - echo sprintf( - get_lang('XQuestionsWithTotalScoreY'), - $nbrQuestions, - $maxScoreAllQuestions - ); - + $alert = ''; + if ($showPagination === false) { + $alert .= sprintf( + get_lang('XQuestionsWithTotalScoreY'), + $nbrQuestions, + $maxScoreAllQuestions + ); + } if ($objExercise->random > 0) { - echo '
'.sprintf(get_lang('OnlyXQuestionsPickedRandomly'), $objExercise->random); + $alert .= '
'.sprintf(get_lang('OnlyXQuestionsPickedRandomly'), $objExercise->random); } - echo '
'; + echo Display::return_message($alert); } elseif (isset($_GET['newQuestion'])) { // we are in create a new question from question pool not in a test echo '
';