$queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
$queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
public $exerciseList; // array with the list of exercises which this question is in
public $category;
public $category_list;
private $isContent;
public $course;
static $typePicture = 'new_question.png';
@ -95,7 +95,7 @@ abstract class Question
$this->position=1;
$this->picture='';
$this->level = 1;
$this->category=0;
$this->category_list = array();
$this->extra=''; // This variable is used when loading an exercise like an scenario with an special hotspot: final_overlap, final_missing, final_excess
$sql = "SELECT count(*) AS nb FROM $TBL_QUESTION_REL_CATEGORY WHERE category_id = $category_id AND question_id = $question_id AND c_id=".api_get_course_int_id();
$res = Database::query($sql);
$row = Database::fetch_array($res);
if ($row['nb'] > 0) {
//DO nothing
//$sql = "UPDATE $TBL_QUESTION_REL_CATEGORY SET category_id = $category_id WHERE question_id=$question_id AND c_id=".api_get_course_int_id();
if (isset($courseCategoryId) && $courseCategoryId > 0) {
$from = ", $TBL_COURSE_REL_CATEGORY crc ";
$where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
$where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
}
if (isset($exerciseLevel) && $exerciseLevel != -1) {
$where .= ' AND level='.$exerciseLevel;
@ -431,9 +431,9 @@ if ($exerciseId > 0) {
$from
WHERE
qt.question_id=qu.id
AND qt.exercice_id=$exerciseId
AND qt.c_id=$selected_course
AND qu.c_id=$selected_course
AND qt.exercice_id=$exerciseId
AND qt.c_id=$selected_course
AND qu.c_id=$selected_course
$where
ORDER BY
question_order";
@ -449,7 +449,7 @@ if ($exerciseId > 0) {
$from = '';
if (isset($courseCategoryId) && $courseCategoryId > 0) {
$from = ", $TBL_COURSE_REL_CATEGORY crc ";
$level_where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
$level_where .= " AND crc.c_id=$selected_course AND crc.question_id=qu.id AND crc.category_id=$courseCategoryId";
}
if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
$level_where = ' AND level='.$exerciseLevel;
@ -458,19 +458,23 @@ if ($exerciseId > 0) {
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";
$sql = "SELECT DISTINCT * FROM $TBL_QUESTIONS qu $from