diff --git a/config/packages/validator.yaml b/config/packages/validator.yaml
index 3fcd3f82e1..a695e1a62a 100644
--- a/config/packages/validator.yaml
+++ b/config/packages/validator.yaml
@@ -1,4 +1,3 @@
framework:
validation:
email_validation_mode: html5
-
diff --git a/public/main/exercise/exercise.class.php b/public/main/exercise/exercise.class.php
index 259d086cf4..681b1d09e1 100644
--- a/public/main/exercise/exercise.class.php
+++ b/public/main/exercise/exercise.class.php
@@ -183,7 +183,7 @@ class Exercise
// if the exercise has been found
if ($object = Database::fetch_object($result)) {
- $this->id = $this->iId = $object->iid;
+ $this->id = $this->iId = (int) $object->iid;
$this->exercise = $object->title;
$this->name = $object->title;
$this->title = $object->title;
diff --git a/public/main/exercise/question_pool.php b/public/main/exercise/question_pool.php
index 7b29135884..4067b036c0 100644
--- a/public/main/exercise/question_pool.php
+++ b/public/main/exercise/question_pool.php
@@ -2,6 +2,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ExtraField as ExtraFieldEntity;
+use Chamilo\CoreBundle\Framework\Container;
use ChamiloSession as Session;
use Knp\Component\Pager\Paginator;
@@ -294,27 +295,6 @@ if (isset($_REQUEST['action'])) {
}
}
-Display::display_header($nameTools, 'Exercise');
-
-// Menu
-echo '
';
-
-if ('' != $displayMessage) {
- echo Display::return_message($displayMessage, 'confirm');
-}
-
// Form
$sessionList = SessionManager::get_sessions_by_user(api_get_user_id(), api_is_platform_admin());
$session_select_list = ['-1' => get_lang('Select')];
@@ -449,7 +429,6 @@ if (!empty($_course)) {
// Answer type list
$form = new FormValidator('question_pool', 'GET', $url);
-$form->addHeader($nameTools.' - '.$titleAdd);
$form->addHidden('fromExercise', $fromExercise);
$form
->addSelect(
@@ -514,14 +493,13 @@ $jsForExtraFields = $extraField->addElements($form, 0, [], true);
$form->addButtonFilter(get_lang('Filter'), 'name');
-echo $form->display();
+if (isset($fromExercise) && $fromExercise > 0) {
+ $titleAdd = get_lang('Add question to test');
+} else {
+ $titleAdd = get_lang('Manage all questions');
+}
-echo '';
-?>
-
-addHeader($nameTools.' - '.$titleAdd);
/**
* @return array
@@ -880,12 +858,28 @@ if (empty($length)) {
$start = ($page - 1) * $length;
-$paginator = new Paginator();
-$pagination = $paginator->paginate([]);
+$mainQuestionList = getQuestions(
+ false,
+ $start,
+ $length,
+ $exerciseId,
+ $courseCategoryId,
+ $selected_course,
+ $session_id,
+ $exerciseLevel,
+ $answerType,
+ $questionId,
+ $description,
+ $fromExercise,
+ $formValues
+);
+
+$paginator = new Paginator(Container::$container->get('event_dispatcher'));
+$pagination = $paginator->paginate($mainQuestionList, $page, $length);
+
$pagination->setTotalItemCount($nbrQuestions);
$pagination->setItemNumberPerPage($length);
$pagination->setCurrentPageNumber($page);
-
$pagination->renderer = function ($data) use ($url) {
$render = '';
if ($data['pageCount'] > 1) {
@@ -903,22 +897,6 @@ $pagination->renderer = function ($data) use ($url) {
return $render;
};
-$mainQuestionList = getQuestions(
- false,
- $start,
- $length,
- $exerciseId,
- $courseCategoryId,
- $selected_course,
- $session_id,
- $exerciseLevel,
- $answerType,
- $questionId,
- $description,
- $fromExercise,
- $formValues
-);
-
// build the line of the array to display questions
// Actions are different if you launch the question_pool page
// They are different too if you have displayed questions from your course
@@ -1045,8 +1023,35 @@ $headers = [
$actionLabel,
];
-echo $pagination;
+Display::display_header($nameTools, 'Exercise');
+
+// Menu
+echo '';
+
+if ('' != $displayMessage) {
+ echo Display::return_message($displayMessage, 'confirm');
+}
+
+echo $form->display();
+
+echo '';
+?>
+
+';
echo '';
@@ -1077,9 +1082,7 @@ foreach ($data as $rows) {
}
$row++;
}
-
$table->display();
-
echo '';
$html = '