|
@@ -2866,7 +2866,8 @@ class Exercise
|
|
|
$saved_results = true,
|
|
|
$from_database = false,
|
|
|
$show_result = true,
|
|
|
- $hotspot_delineation_result = array()
|
|
|
+ $hotspot_delineation_result = array(),
|
|
|
+ $updateResults = false
|
|
|
) {
|
|
|
global $feedback_type, $debug;
|
|
|
global $learnpath_id, $learnpath_item_id; //needed in order to use in the exercise_attempt() for the time
|
|
@@ -3014,7 +3015,6 @@ class Exercise
|
|
|
$answerComment = $objAnswerTmp->selectComment($answerId);
|
|
|
$answerCorrect = $objAnswerTmp->isCorrect($answerId);
|
|
|
|
|
|
- //$answerIdFromList = $objAnswerTmp->getAnswerIdFromList($answerId);
|
|
|
$answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId);
|
|
|
|
|
|
//$numAnswer = $objAnswerTmp->selectAutoId($answerId);
|
|
@@ -4288,24 +4288,24 @@ class Exercise
|
|
|
if ($final_answer == 0) {
|
|
|
$questionScore = 0;
|
|
|
}
|
|
|
- saveQuestionAttempt($questionScore, 1, $quesId, $exeId, 0); // we always insert the answer_id 1 = delineation
|
|
|
+ saveQuestionAttempt($questionScore, 1, $quesId, $exeId, 0, null, $updateResults); // we always insert the answer_id 1 = delineation
|
|
|
//in delineation mode, get the answer from $hotspot_delineation_result[1]
|
|
|
- saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList(1), $hotspot_delineation_result[1], $exerciseResultCoordinates[$quesId]);
|
|
|
+ saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList(1), $hotspot_delineation_result[1], $exerciseResultCoordinates[$quesId], null, $updateResults);
|
|
|
} else {
|
|
|
if ($final_answer == 0) {
|
|
|
$questionScore = 0;
|
|
|
$answer = 0;
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, null, $updateResults);
|
|
|
if (is_array($exerciseResultCoordinates[$quesId])) {
|
|
|
foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
|
|
|
- saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), 0, $val);
|
|
|
+ saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), 0, $val, $updateResults);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, null, $updateResults);
|
|
|
if (is_array($exerciseResultCoordinates[$quesId])) {
|
|
|
foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
|
|
|
- saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), $choice[$idx], $val);
|
|
|
+ saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), $choice[$idx], $val, $updateResults);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4365,13 +4365,13 @@ class Exercise
|
|
|
$reply = array_keys($choice);
|
|
|
for ($i = 0; $i < sizeof($reply); $i++) {
|
|
|
$ans = $reply[$i];
|
|
|
- saveQuestionAttempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $ans.':'.$choice[$ans], $quesId, $exeId, $i, $this->id, $updateResults);
|
|
|
if ($debug) {
|
|
|
error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
}
|
|
|
} elseif ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
|
|
|
if ($choice != 0) {
|
|
@@ -4382,46 +4382,46 @@ class Exercise
|
|
|
}
|
|
|
for ($i = 0; $i < sizeof($reply); $i++) {
|
|
|
$ans = $reply[$i];
|
|
|
- saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id, $updateResults);
|
|
|
}
|
|
|
} else {
|
|
|
- saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
}
|
|
|
} elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
|
|
|
if ($choice != 0) {
|
|
|
$reply = array_keys($choice);
|
|
|
for ($i = 0; $i < sizeof($reply); $i++) {
|
|
|
$ans = $reply[$i];
|
|
|
- saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $ans, $quesId, $exeId, $i, $this->id, $updateResults);
|
|
|
}
|
|
|
} else {
|
|
|
- saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, 0, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
}
|
|
|
} elseif ($answerType == MATCHING || $answerType == DRAGGABLE) {
|
|
|
if (isset($matching)) {
|
|
|
foreach ($matching as $j => $val) {
|
|
|
- saveQuestionAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $val, $quesId, $exeId, $j, $this->id, $updateResults);
|
|
|
}
|
|
|
}
|
|
|
} elseif ($answerType == FREE_ANSWER) {
|
|
|
$answer = $choice;
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
} elseif ($answerType == ORAL_EXPRESSION) {
|
|
|
$answer = $choice;
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $nano);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $updateResults, $nano);
|
|
|
} elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_IMAGE || $answerType == UNIQUE_ANSWER_NO_OPTION) {
|
|
|
$answer = $choice;
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
// } elseif ($answerType == HOT_SPOT || $answerType == HOT_SPOT_DELINEATION) {
|
|
|
} elseif ($answerType == HOT_SPOT) {
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
if (isset($exerciseResultCoordinates[$questionId]) && !empty($exerciseResultCoordinates[$questionId])) {
|
|
|
foreach ($exerciseResultCoordinates[$questionId] as $idx => $val) {
|
|
|
- saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), $choice[$idx], $val, $this->id);
|
|
|
+ saveExerciseAttemptHotspot($exeId, $quesId, $objAnswerTmp->getRealAnswerIdFromList($idx), $choice[$idx], $val, $updateResults, $this->id);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
|
|
|
+ saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id, $updateResults);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -5506,7 +5506,9 @@ class Exercise
|
|
|
$html = Display::url(get_lang('ReturnToExerciseList'), api_get_path(WEB_CODE_PATH).'exercice/exercice.php?'.api_get_cidreq(), array('class' => 'btn btn-large'));
|
|
|
break;
|
|
|
case '2':
|
|
|
- $html = Display::url(get_lang('Logout'), api_get_path(WEB_PUBLIC_PATH).'logout', array('class' => 'btn btn-large'));
|
|
|
+ global $app;
|
|
|
+ $url = $app['url_generator']->generate('admin_logout');
|
|
|
+ $html = Display::url(get_lang('Logout'), $url, array('class' => 'btn btn-large'));
|
|
|
break;
|
|
|
}
|
|
|
return $html;
|