|
|
|
@ -2283,7 +2283,8 @@ class Exercise |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
|
|
|
case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
|
|
|
if ($from_database) { |
|
|
|
if ($from_database) { |
|
|
|
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." where exe_id = ".$exeId." AND question_id= ".$questionId; |
|
|
|
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." |
|
|
|
|
|
|
|
WHERE exe_id = ".$exeId." AND question_id= ".$questionId; |
|
|
|
$resultans = Database::query($queryans); |
|
|
|
$resultans = Database::query($queryans); |
|
|
|
while ($row = Database::fetch_array($resultans)) { |
|
|
|
while ($row = Database::fetch_array($resultans)) { |
|
|
|
$ind = $row['answer']; |
|
|
|
$ind = $row['answer']; |
|
|
|
@ -2315,7 +2316,8 @@ class Exercise |
|
|
|
break; |
|
|
|
break; |
|
|
|
case MULTIPLE_ANSWER_COMBINATION: |
|
|
|
case MULTIPLE_ANSWER_COMBINATION: |
|
|
|
if ($from_database) { |
|
|
|
if ($from_database) { |
|
|
|
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." where exe_id = '".$exeId."' and question_id= '".$questionId."'"; |
|
|
|
$queryans = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." |
|
|
|
|
|
|
|
WHERE exe_id = '".$exeId."' and question_id= '".$questionId."'"; |
|
|
|
$resultans = Database::query($queryans); |
|
|
|
$resultans = Database::query($queryans); |
|
|
|
while ($row = Database::fetch_array($resultans)) { |
|
|
|
while ($row = Database::fetch_array($resultans)) { |
|
|
|
$ind = $row['answer']; |
|
|
|
$ind = $row['answer']; |
|
|
|
@ -3798,23 +3800,29 @@ class Exercise |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Checking visibility in the item_property table |
|
|
|
// Checking visibility in the item_property table. |
|
|
|
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_QUIZ, $this->id, api_get_session_id()); |
|
|
|
$visibility = api_get_item_visibility(api_get_course_info(), TOOL_QUIZ, $this->id, api_get_session_id()); |
|
|
|
|
|
|
|
|
|
|
|
if ($visibility == 0) { |
|
|
|
if ($visibility == 0) { |
|
|
|
$this->active = 0; |
|
|
|
$this->active = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//2. If the exercise is not active |
|
|
|
// 2. If the exercise is not active. |
|
|
|
if (empty($lp_id)) { |
|
|
|
if (empty($lp_id)) { |
|
|
|
//2.1 LP is OFF |
|
|
|
//2.1 LP is OFF |
|
|
|
if ($this->active == 0) { |
|
|
|
if ($this->active == 0) { |
|
|
|
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false)); |
|
|
|
return array( |
|
|
|
|
|
|
|
'value' => false, |
|
|
|
|
|
|
|
'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false) |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//2.1 LP is loaded |
|
|
|
//2.1 LP is loaded |
|
|
|
if ($this->active == 0 AND !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) { |
|
|
|
if ($this->active == 0 AND !learnpath::is_lp_visible_for_student($lp_id, api_get_user_id())) { |
|
|
|
return array('value' => false, 'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false)); |
|
|
|
return array( |
|
|
|
|
|
|
|
'value' => false, |
|
|
|
|
|
|
|
'message' => Display::return_message(get_lang('ExerciseNotFound'), 'warning', false) |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -3851,6 +3859,7 @@ class Exercise |
|
|
|
|
|
|
|
|
|
|
|
// 4. We check if the student have attempts |
|
|
|
// 4. We check if the student have attempts |
|
|
|
$exerciseAttempts = $this->selectAttempts(); |
|
|
|
$exerciseAttempts = $this->selectAttempts(); |
|
|
|
|
|
|
|
|
|
|
|
if ($is_visible) { |
|
|
|
if ($is_visible) { |
|
|
|
if ($exerciseAttempts > 0) { |
|
|
|
if ($exerciseAttempts > 0) { |
|
|
|
|
|
|
|
|
|
|
|
|