//This query might be improved later on by ordering by the new "tms" field rather than by exe_id
//Don't remove this marker: note-query-exe-results
$qry = "SELECT * FROM $TBL_TRACK_EXERCICES
WHERE exe_exo_id = ".$row['id']." AND exe_user_id = " . api_get_user_id() . " AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "'
WHERE exe_exo_id = ".$row['id']." AND
exe_user_id = ".api_get_user_id()." AND
exe_cours_id = '".api_get_course_id()."' AND
status <> 'incomplete' AND
orig_lp_id = 0 AND
orig_lp_item_id = 0 AND
session_id = '" . api_get_session_id() . "'
ORDER BY exe_id DESC";
$qryres = Database::query($qry);
$num = Database :: num_rows($qryres);
@ -894,29 +909,23 @@ if ($show == 'test') {
//Time limits are on
if ($time_limits) {
// Examn is ready to be taken
if ($is_actived_time) {
if ($my_result_disabled == 0) {
if ($is_actived_time) {
//Show results
if ($my_result_disabled == 0 || $my_result_disabled == 2) {
// quits the loop if there are no more blanks (detect '[')
@ -2087,7 +2087,7 @@ class Exercise {
break;
}
if ($from_database) {
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".Database::escape_string($exeId)."' AND question_id= '".Database::escape_string($questionId)."'";
$queryfill = "SELECT answer FROM ".$TBL_TRACK_ATTEMPT." WHERE exe_id = '".$exeId."' AND question_id= '".Database::escape_string($questionId)."'";
$resfill = Database::query($queryfill);
$str = Database::result($resfill,0,'answer');
@ -2095,9 +2095,9 @@ class Exercise {
$str = str_replace('\r\n', '', $str);
$choice = $arr[1];
$tmp=strrpos($choice[$j],' / ');
$choice[$j]=api_substr($choice[$j],0,$tmp);
$choice[$j]=trim($choice[$j]);
$tmp= api_strrpos($choice[$j],' / ');
$choice[$j]=api_substr($choice[$j],0,$tmp);
$choice[$j]=trim($choice[$j]);
//Needed to let characters ' and " to work as part of an answer
$choice[$j] = stripslashes($choice[$j]);
@ -2105,12 +2105,11 @@ class Exercise {
$choice[$j] = trim($choice[$j]);
}
$user_tags[] = api_strtolower($choice[$j]);
$user_tags[] = api_strtolower($choice[$j]);
//put the contents of the [] answer tag into correct_tags[]
// Session test not necessary if we want to show base course learning paths inside the session (see http://support.chamilo.org/projects/chamilo-18/wiki/Tools_and_sessions).