Exercises: Add new "show score" option see BT#15154

Do not show the score (only when user finishes all attempts)
but show feedback for each attempt.
pull/2798/head
Julio Montoya 7 years ago
parent d26af53ecc
commit 2ecfa748ef
  1. 29
      main/exercise/exercise.class.php
  2. 97
      main/exercise/exercise_show.php
  3. 2
      main/exercise/exercise_submit.php
  4. 29
      main/exercise/fill_blanks.class.php
  5. 2
      main/exercise/freeanswer.class.php
  6. 23
      main/exercise/hotspot_answers.as.php
  7. 38
      main/exercise/overview.php
  8. 1
      main/inc/lib/api.lib.php
  9. 45
      main/inc/lib/exercise.lib.php
  10. 99
      main/inc/lib/exercise_show_functions.lib.php
  11. 1
      main/lang/english/trad4all.inc.php

@ -1500,18 +1500,18 @@ class Exercise
$propagate_neg = (int) $this->propagate_neg;
$saveCorrectAnswers = isset($this->saveCorrectAnswers) && $this->saveCorrectAnswers ? 1 : 0;
$review_answers = isset($this->review_answers) && $this->review_answers ? 1 : 0;
$randomByCat = intval($this->randomByCat);
$randomByCat = (int) $this->randomByCat;
$text_when_finished = $this->text_when_finished;
$display_category_name = intval($this->display_category_name);
$pass_percentage = intval($this->pass_percentage);
$display_category_name = (int) $this->display_category_name;
$pass_percentage = (int) $this->pass_percentage;
$session_id = $this->sessionId;
// If direct we do not show results
$results_disabled = intval($this->results_disabled);
$results_disabled = (int) $this->results_disabled;
if ($feedback_type == EXERCISE_FEEDBACK_TYPE_DIRECT) {
$results_disabled = 0;
}
$expired_time = intval($this->expired_time);
$expired_time = (int) $this->expired_time;
// Exercise already exists
if ($id) {
@ -1947,7 +1947,6 @@ class Exercise
'2',
['id' => 'result_disabled_2']
);
$radios_results_disabled[] = $form->createElement(
'radio',
'results_disabled',
@ -1956,6 +1955,14 @@ class Exercise
'4',
['id' => 'result_disabled_4']
);
$radios_results_disabled[] = $form->createElement(
'radio',
'results_disabled',
null,
get_lang('DontShowScoreOnlyWhenUserFinishesAllAttemptsButShowFeedbackEachAttempt'),
'5',
['id' => 'result_disabled_5', 'onclick' => 'check_results_disabled()']
);
$form->addGroup(
$radios_results_disabled,
@ -2026,6 +2033,7 @@ class Exercise
null,
[get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')]
);
$radios_results_disabled = [];
$radios_results_disabled[] = $form->createElement(
'radio',
@ -2051,6 +2059,7 @@ class Exercise
'2',
['id' => 'result_disabled_2', 'onclick' => 'check_results_disabled()']
);
$form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
// Type of questions disposition on page
@ -2090,6 +2099,9 @@ class Exercise
'2',
['id' => 'result_disabled_2', 'onclick' => 'check_results_disabled()']
);
$form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
$result_disable_group = $form->addGroup(
$radios_results_disabled,
null,
@ -3494,7 +3506,6 @@ class Exercise
if ($debug) {
error_log('Start answer loop ');
}
for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
$answer = $objAnswerTmp->selectAnswer($answerId);
$answerComment = $objAnswerTmp->selectComment($answerId);
@ -4630,7 +4641,7 @@ class Exercise
if ($debug) {
error_log('Showing questions $from '.$from);
}
if ($from == 'exercise_result') {
if ($from === 'exercise_result') {
//display answers (if not matching type, or if the answer is correct)
if (!in_array($answerType, [MATCHING, DRAGGABLE, MATCHING_DRAGGABLE]) ||
$answerCorrect
@ -4761,7 +4772,6 @@ class Exercise
// force to show whether the choice is correct or not
$showTotalScoreAndUserChoicesInLastAttempt = true;
ExerciseShowFunctions::display_hotspot_answer(
$feedback_type,
++$correctAnswerId,
@ -4961,7 +4971,6 @@ class Exercise
if ($debug) {
error_log('Showing questions $from '.$from);
}
switch ($answerType) {
case UNIQUE_ANSWER:
case UNIQUE_ANSWER_IMAGE:

@ -88,22 +88,29 @@ $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
$courseInfo = api_get_course_info();
$sessionId = api_get_session_id();
$is_allowedToEdit = api_is_allowed_to_edit(null, true) ||
$is_allowedToEdit =
api_is_allowed_to_edit(null, true) ||
api_is_course_tutor() ||
api_is_session_admin() ||
api_is_drh() ||
api_is_student_boss();
if (!empty($sessionId) && !$is_allowedToEdit) {
if (api_is_course_session_coach(
$currentUserId,
api_get_course_int_id(),
$sessionId
)) {
if (!api_coach_can_edit_view_results(api_get_course_int_id(), $sessionId)
) {
if (!api_coach_can_edit_view_results(api_get_course_int_id(), $sessionId)) {
api_not_allowed($printHeaders);
}
}
} else {
if (!$is_allowedToEdit) {
api_not_allowed($printHeaders);
}
}
$allowCoachFeedbackExercises = api_get_setting('allow_coach_feedback_exercises') === 'true';
@ -122,7 +129,8 @@ if (empty($objExercise)) {
$objExercise->read($exercise_id);
}
$feedback_type = $objExercise->feedback_type;
//Only users can see their own results
// Only users can see their own results
if (!$is_allowedToEdit) {
if ($student_id != $currentUserId) {
api_not_allowed($printHeaders);
@ -230,43 +238,47 @@ $showTotalScoreAndUserChoicesInLastAttempt = true;
if (!empty($track_exercise_info)) {
// if the results_disabled of the Quiz is 1 when block the script
$result_disabled = $track_exercise_info['results_disabled'];
if ($result_disabled == RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS) {
$show_results = false;
} elseif ($result_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY) {
$show_results = false;
$show_only_total_score = true;
if ($origin != 'learnpath') {
if ($currentUserId == $student_id) {
echo Display::return_message(
get_lang('ThankYouForPassingTheTest'),
'warning',
false
);
}
}
} elseif ($result_disabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$attempts = Event::getExerciseResultsByUser(
$currentUserId,
$objExercise->id,
api_get_course_int_id(),
api_get_session_id(),
$track_exercise_info['orig_lp_id'],
$track_exercise_info['orig_lp_item_id'],
'desc'
);
$numberAttempts = count($attempts);
if ($numberAttempts >= $track_exercise_info['max_attempt']) {
$show_results = true;
$show_only_total_score = true;
// Attempt reach max so show score/feedback now
$showTotalScoreAndUserChoicesInLastAttempt = true;
} else {
$show_results = true;
switch ($result_disabled) {
case RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS:
$show_results = false;
break;
case RESULT_DISABLE_SHOW_SCORE_ONLY:
$show_results = false;
$show_only_total_score = true;
// Last attempt not reach don't show score/feedback
$showTotalScoreAndUserChoicesInLastAttempt = false;
}
if ($origin != 'learnpath') {
if ($currentUserId == $student_id) {
echo Display::return_message(
get_lang('ThankYouForPassingTheTest'),
'warning',
false
);
}
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$attempts = Event::getExerciseResultsByUser(
$currentUserId,
$objExercise->id,
api_get_course_int_id(),
api_get_session_id(),
$track_exercise_info['orig_lp_id'],
$track_exercise_info['orig_lp_item_id'],
'desc'
);
$numberAttempts = count($attempts);
if ($numberAttempts >= $track_exercise_info['max_attempt']) {
$show_results = true;
$show_only_total_score = true;
// Attempt reach max so show score/feedback now
$showTotalScoreAndUserChoicesInLastAttempt = true;
} else {
$show_results = true;
$show_only_total_score = true;
// Last attempt not reach don't show score/feedback
$showTotalScoreAndUserChoicesInLastAttempt = false;
}
break;
}
} else {
echo Display::return_message(get_lang('CantViewResults'), 'warning');
@ -369,6 +381,10 @@ if (!empty($maxEditors) && count($questionList) > $maxEditors) {
}
$objExercise->export = $action === 'export';
$arrid = [];
$arrmarks = [];
$strids = '';
$marksid = '';
$countPendingQuestions = 0;
foreach ($questionList as $questionId) {
@ -388,7 +404,6 @@ foreach ($questionList as $questionId) {
// Start buffer
ob_start();
if ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
$choice = [];
}

@ -732,7 +732,7 @@ if ($formSent && isset($_POST)) {
exit;
} else {
if ($debug) {
error_log('10. Redirecting to exercise_show.php');
error_log('10. Redirecting to exercise_result.php');
}
header("Location: exercise_result.php?".api_get_cidreq()."&exe_id=$exe_id&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&learnpath_item_view_id=$learnpath_item_view_id");
exit;

@ -1195,7 +1195,12 @@ class FillBlanks extends Question
$result = '';
$listStudentAnswerInfo = self::getAnswerInfo($answer, true);
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
if (in_array($resultsDisabled, [
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
]
)
) {
$resultsDisabled = true;
if ($showTotalScoreAndUserChoices) {
$resultsDisabled = false;
@ -1257,15 +1262,19 @@ class FillBlanks extends Question
$showTotalScoreAndUserChoices = false
) {
$hideExpectedAnswer = false;
if ($feedbackType == 0 && $resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ONLY) {
$hideExpectedAnswer = true;
}
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$hideExpectedAnswer = true;
if ($showTotalScoreAndUserChoices) {
$hideExpectedAnswer = false;
}
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedbackType == 0) {
$hideExpectedAnswer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hideExpectedAnswer = true;
if ($showTotalScoreAndUserChoices) {
$hideExpectedAnswer = false;
}
break;
}
$style = 'feedback-green';

@ -61,7 +61,7 @@ class FreeAnswer extends Question
$header = parent::return_header($exercise, $counter, $score);
$header .= '<table class="'.$this->question_table_class.'" >
<tr>
<th>'.get_lang("Answer").'</th>
<th>'.get_lang('Answer').'</th>
</tr>';
return $header;

@ -27,12 +27,13 @@ if ($debug) {
error_log("Call to hotspot_answers.as.php");
}
$trackExerciseInfo = $objExercise->get_stat_track_exercise_info_by_exe_id($exeId);
// Check if student has access to the hotspot answers
if (!api_is_allowed_to_edit(null, true)) {
if (empty($exeId)) {
api_not_allowed();
}
$trackExerciseInfo = $objExercise->get_stat_track_exercise_info_by_exe_id($exeId);
if (empty($trackExerciseInfo)) {
api_not_allowed();
@ -92,7 +93,13 @@ $data['courseCode'] = $_course['path'];
$data['hotspots'] = [];
$showTotalScoreAndUserChoicesInLastAttempt = true;
if ($objExercise->selectResultsDisabled() == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
if (in_array(
$objExercise->selectResultsDisabled(), [
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
]
)
) {
$showOnlyScore = true;
$showResults = true;
if ($objExercise->attempts > 0) {
@ -117,11 +124,19 @@ if ($objExercise->selectResultsDisabled() == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_S
}
$hideExpectedAnswer = false;
if ($objExercise->selectFeedbackType() == 0 && $objExercise->selectResultsDisabled() == 2) {
if ($objExercise->selectFeedbackType() == 0 &&
$objExercise->selectResultsDisabled() == RESULT_DISABLE_SHOW_SCORE_ONLY
) {
$hideExpectedAnswer = true;
}
if ($objExercise->selectResultsDisabled() == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
if (in_array(
$objExercise->selectResultsDisabled(), [
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
]
)
) {
$hideExpectedAnswer = $showTotalScoreAndUserChoicesInLastAttempt ? false : true;
}

@ -197,11 +197,18 @@ if ($current_browser == 'Internet Explorer') {
}
$blockShowAnswers = false;
if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
if (in_array(
$objExercise->results_disabled,
[
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
])
) {
if (count($attempts) < $objExercise->attempts) {
$blockShowAnswers = true;
}
}
if (!empty($attempts)) {
$i = $counter;
foreach ($attempts as $attempt_result) {
@ -238,7 +245,7 @@ if (!empty($attempts)) {
),
'userIp' => $attempt_result['user_ip'],
];
$attempt_link .= "&nbsp;&nbsp;&nbsp;".$teacher_revised;
$attempt_link .= '&nbsp;&nbsp;&nbsp;'.$teacher_revised;
if (in_array(
$objExercise->results_disabled,
@ -247,6 +254,7 @@ if (!empty($attempts)) {
RESULT_DISABLE_SHOW_SCORE_ONLY,
RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES,
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
]
)) {
$row['result'] = $score;
@ -258,16 +266,25 @@ if (!empty($attempts)) {
RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS,
RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES,
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
]
) || (
$objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY &&
$objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_END
)
) {
if ($blockShowAnswers) {
if ($blockShowAnswers &&
$objExercise->results_disabled != RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
) {
$attempt_link = '';
}
if ($blockShowAnswers == true &&
$objExercise->results_disabled == RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
) {
if (isset($row['result'])) {
unset($row['result']);
}
}
$row['attempt_link'] = $attempt_link;
}
$my_attempt_array[] = $row;
@ -279,6 +296,19 @@ if (!empty($attempts)) {
// Hiding score and answer
switch ($objExercise->results_disabled) {
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
if ($blockShowAnswers) {
$header_names = [get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Details')];
} else {
$header_names = [
get_lang('Attempt'),
get_lang('StartDate'),
get_lang('IP'),
get_lang('Score'),
get_lang('Details'),
];
}
break;
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
if ($blockShowAnswers) {
$header_names = [get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score')];

@ -469,6 +469,7 @@ define('RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS', 1); //Do not show score n
define('RESULT_DISABLE_SHOW_SCORE_ONLY', 2); //Show score only
define('RESULT_DISABLE_SHOW_FINAL_SCORE_ONLY_WITH_CATEGORIES', 3); //Show final score only with categories
define('RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT', 4);
define('RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK', 5);
// 4: Show final score only with categories and show expected answers only on the last attempt
define('EXERCISE_MAX_NAME_SIZE', 80);

@ -4434,7 +4434,6 @@ EOT;
// Hide results
$show_results = false;
$show_only_score = false;
if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_AND_EXPECTED_ANSWERS) {
$show_results = true;
}
@ -4461,9 +4460,19 @@ EOT;
}
$showTotalScoreAndUserChoicesInLastAttempt = true;
if ($objExercise->results_disabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$showTotalScore = true;
$showQuestionScore = true;
if (in_array(
$objExercise->results_disabled,
[
RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT,
RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK
])
) {
$show_only_score = true;
$show_results = true;
$numberAttempts = 0;
if ($objExercise->attempts > 0) {
$attempts = Event::getExerciseResultsByUser(
api_get_user_id(),
@ -4474,22 +4483,32 @@ EOT;
$exercise_stat_info['orig_lp_item_id'],
'desc'
);
if ($attempts) {
$numberAttempts = count($attempts);
} else {
$numberAttempts = 0;
}
if ($save_user_result) {
$numberAttempts++;
}
$showTotalScore = false;
$showTotalScoreAndUserChoicesInLastAttempt = false;
if ($numberAttempts >= $objExercise->attempts) {
$showTotalScore = true;
$show_results = true;
$show_only_score = false;
$showTotalScoreAndUserChoicesInLastAttempt = true;
} else {
$showTotalScoreAndUserChoicesInLastAttempt = false;
}
}
if ($objExercise->results_disabled == RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK) {
$show_only_score = false;
$show_results = true;
$show_all_but_expected_answer = false;
$showTotalScore = false;
$showQuestionScore = false;
if ($numberAttempts >= $objExercise->attempts) {
$showTotalScore = true;
$showQuestionScore = true;
}
}
}
@ -4672,12 +4691,18 @@ EOT;
$question_content = '';
if ($show_results) {
$question_content = '<div class="question_row_answer">';
if ($showQuestionScore == false) {
$score = [];
}
// Shows question title an description
$question_content .= $objQuestionTmp->return_header(
$objExercise,
$counter,
$score
);
}
$counter++;
$question_content .= $contents;
@ -4703,7 +4728,7 @@ EOT;
}
$totalScoreText = null;
if ($show_results || $show_only_score) {
if (($show_results || $show_only_score) && $showTotalScore) {
if ($result['answer_type'] == MULTIPLE_ANSWER_TRUE_FALSE_DEGREE_CERTAINTY) {
echo '<h1 style="text-align : center; margin : 20px 0;">'.get_lang('YourResults').'</h1><br />';
}
@ -4793,9 +4818,7 @@ EOT;
$learnpath_item_id,
$learnpath_item_view_id,
$exercise_stat_info['exe_duration'],
$question_list,
'',
[]
$question_list
);
}
}

@ -80,7 +80,7 @@ class ExerciseShowFunctions
$answer,
$id,
$questionId,
$results_disabled,
$resultsDisabled,
$showTotalScoreAndUserChoices,
$expectedChoice = '',
$choice = '',
@ -139,7 +139,7 @@ class ExerciseShowFunctions
$exe_id,
$questionId,
$questionScore = null,
$results_disabled = 0
$resultsDisabled = 0
) {
$comments = Event::get_comments($exe_id, $questionId);
@ -165,7 +165,7 @@ class ExerciseShowFunctions
* @param $id
* @param $questionId
* @param null $fileUrl
* @param int $results_disabled
* @param int $resultsDisabled
* @param int $questionScore
*/
public static function display_oral_expression_answer(
@ -174,7 +174,7 @@ class ExerciseShowFunctions
$id,
$questionId,
$fileUrl = null,
$results_disabled = 0,
$resultsDisabled = 0,
$questionScore = 0
) {
if (isset($fileUrl)) {
@ -238,16 +238,21 @@ class ExerciseShowFunctions
$showTotalScoreAndUserChoices
) {
$hide_expected_answer = false;
if ($feedback_type == 0 && $resultsDisabled == 2) {
$hide_expected_answer = true;
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
}
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
}
$hotspot_colors = [
"", // $i starts from 1 on next loop (ugly fix)
@ -339,15 +344,19 @@ class ExerciseShowFunctions
}
$hide_expected_answer = false;
if ($feedback_type == 0 && ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ONLY)) {
$hide_expected_answer = true;
}
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
}
$icon = in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION]) ? 'radio' : 'checkbox';
@ -433,15 +442,19 @@ class ExerciseShowFunctions
$showTotalScoreAndUserChoices
) {
$hide_expected_answer = false;
if ($feedback_type == 0 && ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ONLY)) {
$hide_expected_answer = true;
}
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
}
echo '<tr><td width="5%">';
$course_id = api_get_course_int_id();
@ -613,15 +626,19 @@ class ExerciseShowFunctions
$showTotalScoreAndUserChoices
) {
$hide_expected_answer = false;
if ($feedback_type == 0 && ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ONLY)) {
$hide_expected_answer = true;
}
if ($resultsDisabled == RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT) {
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) {
$hide_expected_answer = true;
}
break;
case RESULT_DISABLE_DONT_SHOW_SCORE_ONLY_IF_USER_FINISHES_ATTEMPTS_SHOW_ALWAYS_FEEDBACK:
case RESULT_DISABLE_SHOW_SCORE_ATTEMPT_SHOW_ANSWERS_LAST_ATTEMPT:
$hide_expected_answer = true;
if ($showTotalScoreAndUserChoices) {
$hide_expected_answer = false;
}
break;
}
echo '<tr><td width="5%">';
@ -690,14 +707,14 @@ class ExerciseShowFunctions
* @param $exe_id
* @param $questionId
* @param null $questionScore
* @param int $results_disabled
* @param int $resultsDisabled
*/
public static function displayAnnotationAnswer(
$feedback_type,
$exe_id,
$questionId,
$questionScore = null,
$results_disabled = 0
$resultsDisabled = 0
) {
$comments = Event::get_comments($exe_id, $questionId);
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {

@ -8336,4 +8336,5 @@ $NumberOfVisits = "Number of visits";
$FormationUnit = "Formation unit";
$GlobalProgress = "Global progress";
$AttestationOfAttendance = "Attestation of attendance";
$DontShowScoreOnlyWhenUserFinishesAllAttemptsButShowFeedbackEachAttempt = "Do not show the score (only when user finishes all attempts) but show feedback for each attempt.";
?>
Loading…
Cancel
Save