diff --git a/main/exercice/question_pool.php b/main/exercice/question_pool.php
index c6533ccadd..0cc47d5e89 100755
--- a/main/exercice/question_pool.php
+++ b/main/exercice/question_pool.php
@@ -65,6 +65,9 @@ if(isset($_GET['exerciseId'])){
if(isset($_GET['exerciseLevel'])){
$exerciseLevel = intval($_GET['exerciseLevel']);
}
+if(isset($_GET['answerType'])){
+ $answerType = intval($_GET['answerType']);
+}
if(!empty($_GET['page'])){
$page = intval($_GET['page']);
}
@@ -205,8 +208,8 @@ if($is_allowedToEdit)
:
';
+
+ //
+ echo get_lang('AnswerType');
+ echo ' : ';
?>
+
@@ -258,13 +287,20 @@ if($is_allowedToEdit)
if (isset($exerciseLevel) && $exerciseLevel != -1) {
$where .= ' level='.$exerciseLevel.' AND ';
- }
-
+ }
+
+ if (isset($answerType) && $answerType != -1) {
+ $where .= ' type='.$answerType.' AND ';
+ }
+
$sql="SELECT id,question,type,level
FROM $TBL_EXERCICE_QUESTION,$TBL_QUESTIONS
WHERE $where question_id=id AND exercice_id='".Database::escape_string($exerciseId)."'
ORDER BY question_order";
+
+
} elseif($exerciseId == -1) {
+
// if we have selected the option 'Orphan questions' in the list-box 'Filter'
// 1. Old logic: When a test is deleted, the correspondent records in 'quiz' and 'quiz_rel_question' tables are deleted.
@@ -299,11 +335,17 @@ if($is_allowedToEdit)
if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
$level_where = ' level='.$exerciseLevel.' AND ';
}
+
+ $answer_where = '';
+ if (isset($answerType) && $answerType!= -1 ) {
+ $answer_where = ' questions.type='.$answerType.' AND ';
+ }
+
$sql='SELECT questions.id, questions.question, questions.type, quizz_questions.exercice_id , level
FROM '.$TBL_QUESTIONS.' as questions LEFT JOIN '.$TBL_EXERCICE_QUESTION.' as quizz_questions
ON questions.id=quizz_questions.question_id LEFT JOIN '.$TBL_EXERCICES.' as exercices
ON exercice_id=exercices.id
- WHERE '.$level_where.' (quizz_questions.exercice_id IS NULL OR exercices.active = -1 ) '.$type_where.'
+ WHERE '.$answer_where.' '.$level_where.' (quizz_questions.exercice_id IS NULL OR exercices.active = -1 ) '.$type_where.'
LIMIT '.$from.', '.($limitQuestPage + 1);
} else {
@@ -316,12 +358,21 @@ if($is_allowedToEdit)
$where = ' WHERE type = 1 ';
}
+
if (isset($exerciseLevel) && $exerciseLevel != -1) {
if (strlen($where)>0)
$where .= ' AND level='.$exerciseLevel.' ';
else
$where = ' WHERE level='.$exerciseLevel.' ';
}
+
+ if (isset($answerType) && $answerType != -1) {
+ if (strlen($where)>0)
+ $where .= ' AND type='.$answerType.' ';
+ else
+ $where = ' WHERE type='.$answerType.' ';
+ }
+
$sql="SELECT id,question,type,level FROM $TBL_QUESTIONS $where ";
// forces the value to 0
diff --git a/main/inc/ajax/course_home.ajax.php b/main/inc/ajax/course_home.ajax.php
old mode 100755
new mode 100644