|
@@ -1,4 +1,4 @@
|
|
|
-<?php // $Id: question_pool.php 17300 2008-12-15 20:05:50Z ivantcholakov $
|
|
|
+<?php // $Id: question_pool.php 17302 2008-12-15 21:13:36Z ivantcholakov $
|
|
|
|
|
|
/*
|
|
|
==============================================================================
|
|
@@ -30,7 +30,7 @@
|
|
|
* One question can be in several exercises
|
|
|
* @package dokeos.exercise
|
|
|
* @author Olivier Brouckaert
|
|
|
-* @version $Id: question_pool.php 17300 2008-12-15 20:05:50Z ivantcholakov $
|
|
|
+* @version $Id: question_pool.php 17302 2008-12-15 21:13:36Z ivantcholakov $
|
|
|
*/
|
|
|
|
|
|
// name of the language file that needs to be included
|
|
@@ -189,28 +189,28 @@ if($is_allowedToEdit)
|
|
|
// if we have selected an exercise in the list-box 'Filter'
|
|
|
if($exerciseId > 0)
|
|
|
{
|
|
|
- $sql="SELECT id,question,type FROM $TBL_EXERCICE_QUESTION,$TBL_QUESTIONS WHERE question_id=id AND exercice_id='".Database::escape_string($exerciseId)."' ORDER BY question_order";
|
|
|
+ $sql="SELECT id,question,type FROM $TBL_EXERCICE_QUESTION,$TBL_QUESTIONS WHERE question_id=id AND exercice_id='".Database::escape_string($exerciseId)."' ORDER BY question_order LIMIT $from, ".($limitQuestPage + 1);
|
|
|
}
|
|
|
// if we have selected the option 'Orphan questions' in the list-box 'Filter'
|
|
|
elseif($exerciseId == -1)
|
|
|
{
|
|
|
// Old logic: When a test is deleted, the correspondent records in 'quiz' and 'quiz_rel_question' tables are deleted.
|
|
|
- //$sql='SELECT id, question, type, exercice_id FROM '.$TBL_QUESTIONS.' as questions LEFT JOIN '.$TBL_EXERCICE_QUESTION.' as quizz_questions ON questions.id=quizz_questions.question_id WHERE exercice_id IS NULL';
|
|
|
+ //$sql='SELECT id, question, type, exercice_id FROM '.$TBL_QUESTIONS.' as questions LEFT JOIN '.$TBL_EXERCICE_QUESTION.' as quizz_questions ON questions.id=quizz_questions.question_id WHERE exercice_id IS NULL LIMIT $from, '.($limitQuestPage + 1);
|
|
|
|
|
|
// New logic: When a test is deleted, the field 'active' takes value -1 (it is in the correspondent record in 'quiz' table).
|
|
|
//$sql='SELECT questions.id, questions.question, questions.type, quizz_questions.exercice_id 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 exercices.active = -1';
|
|
|
+ // ' as exercices ON exercice_id=exercices.id WHERE exercices.active = -1 LIMIT $from, '.($limitQuestPage + 1);
|
|
|
|
|
|
// This is more safe to changes, it is a mix between old and new logic.
|
|
|
$sql='SELECT questions.id, questions.question, questions.type, quizz_questions.exercice_id 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 quizz_questions.exercice_id IS NULL OR exercices.active = -1';
|
|
|
+ ' as exercices ON exercice_id=exercices.id WHERE quizz_questions.exercice_id IS NULL OR exercices.active = -1 LIMIT '.$from.', '.($limitQuestPage + 1);
|
|
|
}
|
|
|
// if we have not selected any option in the list-box 'Filter'
|
|
|
else
|
|
|
{
|
|
|
- $sql="SELECT id,question,type FROM $TBL_QUESTIONS";
|
|
|
+ $sql="SELECT id,question,type FROM $TBL_QUESTIONS LIMIT $from, ".($limitQuestPage + 1);
|
|
|
// forces the value to 0
|
|
|
$exerciseId=0;
|
|
|
}
|