if (isset($exerciseLevel) && $exerciseLevel != -1) {
$where .= ' AND level='.$exerciseLevel;
}
if (isset($answerType) && $answerType != -1) {
if (isset($answerType) && $answerType > 0) {
$where .= ' AND type='.$answerType;
}
$sql = "SELECT DISTINCT id,question,type,level FROM $TBL_EXERCICE_QUESTION qt,$TBL_QUESTIONS qu $from WHERE qt.question_id=qu.id AND qt.exercice_id=$exerciseId AND qt.c_id=$selected_course AND qu.c_id=$selected_course $where ORDER BY question_order";
if (isset($courseCategoryId) && $courseCategoryId > 0) {
@ -451,7 +466,7 @@ if ($exerciseId > 0) {
$level_where = ' AND level='.$exerciseLevel;
}
$answer_where = '';
if (isset($answerType) && $answerType != -1 ) {
if (isset($answerType) && $answerType >0 -1 ) {
$answer_where = ' AND type='.$answerType;
}
$sql = "SELECT DISTINCT * FROM $TBL_QUESTIONS qu $from WHERE qu.c_id=$selected_course AND qu.id NOT IN (SELECT question_id FROM $TBL_EXERCICE_QUESTION WHERE c_id=$selected_course ) $level_where $answer_where";
@ -461,9 +476,9 @@ if ($exerciseId > 0) {
}
}
else {
// ---------------------------------
//
// All tests for selected course
// ---------------------------------
//
// if we have not selected any option in the list-box 'Filter'
$filter = '';
$from = '';
@ -474,7 +489,7 @@ else {
if (isset($exerciseLevel) && $exerciseLevel != -1) {
$filter .= ' AND level='.$exerciseLevel.' ';
}
if (isset($answerType) && $answerType != -1) {
if (isset($answerType) && $answerType > 0) {
$filter .= ' AND qu.type='.$answerType.' ';
}
// // why these lines ?
@ -482,9 +497,9 @@ else {
// $filter .= ' AND qu.type <> '.HOT_SPOT_DELINEATION.' ';
// }
// // fwhy
// --------------------
//
// if in session
// --------------------
//
if (!empty($session_id) && $session_id != '-1') {
$main_question_list = array();
if (!empty($course_list))
@ -507,11 +522,11 @@ else {
if ($exerciseLevel != $question_obj->level) {
continue;
}
if ($answerType != '-1')
if ($answerType > 0)
if ($answerType != $question_obj->type) {
continue;
}
// hub 23-10-2011
if ($courseCategoryId > 0 && Testcategory::getCategoryForQuestion($question_obj->id, $selected_course)) {
$sql = "SELECT DISTINCT qu.id, question, qu.type, level, q.session_id FROM $TBL_QUESTIONS as qu, $TBL_EXERCICE_QUESTION as qt, $TBL_EXERCICES as q $from WHERE qu.c_id=$selected_course AND qt.c_id=$selected_course AND q.c_id=$selected_course AND qu.id = qt.question_id AND q.id = qt.exercice_id $filter ORDER BY session_id ASC";