diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php
index 8080010f63..eed5499ea0 100755
--- a/main/exercice/exercise.class.php
+++ b/main/exercice/exercise.class.php
@@ -1678,6 +1678,8 @@ class Exercise {
*/
function manage_answer($exeId, $questionId, $choice, $from = 'exercise_show', $exerciseResultCoordinates = array(), $saved_results = true, $from_database = false, $show_result = true, $propagate_neg = 0) {
global $_configuration, $feedback_type;
+
+ $html = '';
$questionId = intval($questionId);
$exeId = intval($exeId);
@@ -1787,10 +1789,8 @@ class Exercise {
} else {
$questionScore += $doubt_score;
}
- }
- //$questionWeighting+=$true_score;
- $totalScore +=$true_score;
- //echo $studentChoice.' - '.$answerCorrect.' '.$questionScore.' - '.$questionWeighting.'
';
+ }
+ $totalScore +=$true_score;
break;
case MULTIPLE_ANSWER :
if ($from_database) {
@@ -1829,8 +1829,7 @@ class Exercise {
$numAnswer=$objAnswerTmp->selectAutoId($answerId);
$studentChoice=$choice[$numAnswer];
- //echo $studentChoice.' - '.$answerCorrect.'
';
-
+
if ($answerCorrect == 1) {
if ($studentChoice == 1) { //true value see MultipleAnswerCombinationTrueFalse class
$real_answers[$answerId] = true;
@@ -2102,8 +2101,8 @@ class Exercise {
}
break;
// for matching
- case MATCHING :
- if ($from_database) {
+ case MATCHING :
+ if ($from_database) {
$sql_answer = 'SELECT id, answer FROM '.$table_ans.' WHERE question_id="'.$questionId.'" AND correct=0';
$res_answer = Database::query($sql_answer);
// getting the real answer
@@ -2116,15 +2115,8 @@ class Exercise {
WHERE question_id="'.$questionId.'" AND correct <> 0 ORDER BY id_auto';
$res_answers = Database::query($sql_select_answer);
- if ($show_result) {
- echo '
';
- echo '| |
';
- echo '
- | '.get_lang('ElementList').' |
- '.get_lang('CorrespondsTo').' |
-
';
- echo '| |
';
- }
+
+
$questionScore = 0;
while ($a_answers = Database::fetch_array($res_answers)) {
@@ -2331,13 +2323,14 @@ class Exercise {
}
}
- if ($from == 'exercise_result') {
- global $colspan;
+ if ($from == 'exercise_result') {
// if answer is hotspot. To the difference of exercise_show.php, we use the results from the session (from_db=0)
// TODO Change this, because it is wrong to show the user some results that haven't been stored in the database yet
if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER) {
- // We made an extra table for the answers
- if($origin != 'learnpath') {
+ // We made an extra table for the answers
+ if ($show_result) {
+ if ($origin != 'learnpath') {
+
echo '
';
echo '
| ';
@@ -2346,28 +2339,26 @@ class Exercise {
echo '
|
-
';
+ ';
+
}
- }
+ }
+ }
if ($origin != 'learnpath') {
- ?>
-
- |
- ';
if ($this->type == ALL_ON_ONE_PAGE) {
echo ' ';
if ($propagate_neg == 0 && $questionScore < 0) {
$questionScore = 0;
}
- echo get_lang('Score').": ".show_score($questionScore, $questionWeighting,false, false);
+ echo get_lang('Score').": ".show_score($questionScore, $questionWeighting, false, false);
echo ' ';
}
- ?>
- |
-
-
- ';
+ }
+ }
}
unset ($objAnswerTmp);
$i++;
@@ -2588,6 +2579,50 @@ class Exercise {
$result = @api_mail_html('', $to, $subject, $mail_content, $sender_name, $email_admin, array('charset'=>$mycharset));
}
}
+
+ function show_exercise_result_header($user_data, $date = null) {
+ $description = '';
+ if (!empty($this->description)) {
+ $description = '
+ |
+ '.get_lang("Description").' :
+ |
+
+ '.$this->description.'
+ |
+
';
+ }
+ $date_data = '';
+ if (!empty($date)) {
+ $date_data = '
+ |
+ '.get_lang("Date").' :
+ |
+
+ '.$date.'
+ |
+
';
+ }
+
+
+ $html = '
+
+
+ '.Display::return_icon('quiz_big.png', get_lang('Result')).' '.$this->exercise.' : '.get_lang('Result').'
+ |
+
+
+ | '.get_lang('User').' : |
+
+ '.$user_data.'
+ |
+
+ '.$date_data.'
+ '.$description.'
+
+
';
+ return $html;
+ }
}
endif;
?>
diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php
index 105a6e4307..bfd0b6e9aa 100755
--- a/main/exercice/exercise_result.php
+++ b/main/exercice/exercise_result.php
@@ -135,10 +135,18 @@ if ($origin != 'learnpath') {
results_disabled) {
- ob_start();
+if ($objExercise->results_disabled == 0) {
+ $show_results = true;
}
+
+if ($objExercise->results_disabled == 2) {
+ $show_only_score = true;
+}
+
/* DISPLAY AND MAIN PROCESS */
// I'm in a preview mode as course admin. Display the action menu.
@@ -153,31 +161,34 @@ $exerciseTitle=text_filter($objExercise->selectTitle());
$feedback_type = $objExercise->feedbacktype;
//show exercise title
-if($origin != 'learnpath') {?>
- :
- selectDescription(); ?>
-
-
+if($origin == 'learnpath') { ?>