diff --git a/main/exercice/exercise_result.php b/main/exercice/exercise_result.php
index 6ab12ec1c4..3644e0f8a2 100755
--- a/main/exercice/exercise_result.php
+++ b/main/exercice/exercise_result.php
@@ -108,7 +108,7 @@ if (!empty($gradebook) && $gradebook=='view') {
$interbreadcrumb[]= array ('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'));
}
-$nameTools = get_lang('Exercice');
+$nameTools = get_lang('Result');
$interbreadcrumb[]=array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices'));
//$htmlHeadXtra[] = $objExercise->show_lp_javascript();
diff --git a/main/exercice/result.php b/main/exercice/result.php
index 42028b2ea3..4688c053a9 100644
--- a/main/exercice/result.php
+++ b/main/exercice/result.php
@@ -27,8 +27,9 @@ if (empty($origin) ) {
api_protect_course_script();
-$id = intval($_REQUEST['id']); //exe id
-$current_time = time();
+$id = isset($_REQUEST['id']) ? intval($_GET['id']) : null; //exe id
+$show_headers = isset($_GET['show_headers']) ? intval($_GET['show_headers']) : null; //exe id
+
if (empty($id)) {
api_not_allowed();
@@ -64,7 +65,15 @@ if (!$is_allowedToEdit) {
}
}
-Display::display_reduced_header();
+if ($show_headers) {
+ $interbreadcrumb[] = array("url" => "exercice.php","name" => get_lang('Exercices'));
+ $interbreadcrumb[] = array("url" => "#","name" => get_lang('Result'));
+ $this_section = SECTION_COURSES;
+
+ Display::display_header();
+} else {
+ Display::display_reduced_header();
+}
$show_results = true;
$show_only_total_score = false;
@@ -87,7 +96,6 @@ if (!empty($track_exercise_info)) {
}
}
-$html = '';
if ($show_results || $show_only_total_score) {
$user_info = api_get_user_info($student_id);
//Shows exercise header
@@ -102,247 +110,251 @@ $question_list = $result[$id]['question_list'];
// for each question
$total_weighting = 0;
-foreach ($question_list as $question_item) {
- $objQuestionTmp = Question::read($question_item['question_id']);
- $total_weighting += $objQuestionTmp->selectWeighting();
-}
$counter = 1;
+if (!empty($question_list)) {
-foreach ($question_list as $question_item) {
- $choice = $question_item['answer'];
+ foreach ($question_list as $question_item) {
+ $objQuestionTmp = Question::read($question_item['question_id']);
+ $total_weighting += $objQuestionTmp->selectWeighting();
+ }
+
+
+ foreach ($question_list as $question_item) {
+ $choice = $question_item['answer'];
+
+ // creates a temporary Question object
+ $questionId = $question_item['question_id'];
+ $objQuestionTmp = Question::read($questionId);
- // creates a temporary Question object
- $questionId = $question_item['question_id'];
- $objQuestionTmp = Question::read($questionId);
-
- $questionName = $objQuestionTmp->selectTitle();
- $questionDescription= $objQuestionTmp->selectDescription();
- $questionWeighting = $objQuestionTmp->selectWeighting();
- $answerType = $objQuestionTmp->selectType();
- $quesId = $objQuestionTmp->selectId();
+ $questionName = $objQuestionTmp->selectTitle();
+ $questionDescription= $objQuestionTmp->selectDescription();
+ $questionWeighting = $objQuestionTmp->selectWeighting();
+ $answerType = $objQuestionTmp->selectType();
+ $quesId = $objQuestionTmp->selectId();
+
+ if ($show_results) {
+ echo $objQuestionTmp->return_header($objExercise->feedbacktype, $counter);
+ }
+ $counter++;
+ if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+ } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
+ $choice = array();
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+ } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+ } elseif ($answerType == FILL_IN_BLANKS) {
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+ } elseif ($answerType == FREE_ANSWER) {
+ $answer = $str;
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+ } elseif ($answerType == MATCHING) {
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+ } elseif ($answerType == HOT_SPOT) {
+ if ($show_results) {
+ echo '
+
+ ';
+ }
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+
+ if ($show_results) {
+ echo ' |
';
+ echo '
+ '.
+ '
+ |
+
+
';
+ }
+ } else if($answerType == HOT_SPOT_DELINEATION) {
+
+ $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database');
+
+ $questionScore = $question_result['score'];
+ $totalScore += $question_result['score'];
+
+ $final_overlap = $question_result['extra']['final_overlap'];
+ $final_missing = $question_result['extra']['final_missing'];
+ $final_excess = $question_result['extra']['final_excess'];
+
+ $overlap_color = $question_result['extra']['overlap_color'];
+ $missing_color = $question_result['extra']['missing_color'];
+ $excess_color = $question_result['extra']['excess_color'];
+
+ $threadhold1 = $question_result['extra']['threadhold1'];
+ $threadhold2 = $question_result['extra']['threadhold2'];
+ $threadhold3 = $question_result['extra']['threadhold3'];
+
+
+ if ($show_results) {
+
+ if ($overlap_color) {
+ $overlap_color='green';
+ } else {
+ $overlap_color='red';
+ }
+
+ if ($missing_color) {
+ $missing_color='green';
+ } else {
+ $missing_color='red';
+ }
+ if ($excess_color) {
+ $excess_color='green';
+ } else {
+ $excess_color='red';
+ }
+
+
+ if (!is_numeric($final_overlap)) {
+ $final_overlap = 0;
+ }
+
+ if (!is_numeric($final_missing)) {
+ $final_missing = 0;
+ }
+ if (!is_numeric($final_excess)) {
+ $final_excess = 0;
+ }
+
+ if ($final_excess>100) {
+ $final_excess = 100;
+ }
+
+ $table_resume='
+
+ |
+ '.get_lang('Requirements').' |
+ '.get_lang('YourAnswer').' |
+
+
+
+ '.get_lang('Overlap').' |
+ '.get_lang('Min').' '.$threadhold1.' |
+ '.(($final_overlap < 0)?0:intval($final_overlap)).' |
+
+
+
+ '.get_lang('Excess').' |
+ '.get_lang('Max').' '.$threadhold2.' |
+ '.(($final_excess < 0)?0:intval($final_excess)).' |
+
+
+
+ '.get_lang('Missing').' |
+ '.get_lang('Max').' '.$threadhold3.' |
+ '.(($final_missing < 0)?0:intval($final_missing)).' |
+
';
+
+ if ($answerType!= HOT_SPOT_DELINEATION) {
+ $item_list=explode('@@',$destination);
+ //print_R($item_list);
+ $try = $item_list[0];
+ $lp = $item_list[1];
+ $destinationid= $item_list[2];
+ $url=$item_list[3];
+ $table_resume='';
+ } else {
+ if ($next==0) {
+ $try = $try_hotspot;
+ $lp = $lp_hotspot;
+ $destinationid= $select_question_hotspot;
+ $url=$url_hotspot;
+ } else {
+ //show if no error
+ //echo 'no error';
+ $comment=$answerComment=$objAnswerTmp->selectComment($nbrAnswers);
+ $answerDestination=$objAnswerTmp->selectDestination($nbrAnswers);
+ }
+ }
- if ($show_results) {
- echo $objQuestionTmp->return_header($objExercise->feedbacktype, $counter);
- }
- $counter++;
- if ($answerType == MULTIPLE_ANSWER || $answerType == MULTIPLE_ANSWER_TRUE_FALSE) {
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
- } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION || $answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
- $choice = array();
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
- } elseif ($answerType == UNIQUE_ANSWER || $answerType == UNIQUE_ANSWER_NO_OPTION) {
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
- } elseif ($answerType == FILL_IN_BLANKS) {
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
- } elseif ($answerType == FREE_ANSWER) {
- $answer = $str;
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
- } elseif ($answerType == MATCHING) {
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
- } elseif ($answerType == HOT_SPOT) {
+ echo ''.get_lang('Feedback').'
';
+ if ($answerType == HOT_SPOT_DELINEATION) {
+ if ($organs_at_risk_hit>0) {
+ $message='
'.get_lang('ResultIs').' '.$result_comment.'
';
+ $message.=''.get_lang('OARHit').'
';
+ } else {
+ $message=''.get_lang('YourDelineation').'
';
+ $message.=$table_resume;
+ $message.='
'.get_lang('ResultIs').' '.$result_comment.'
';
+ }
+ $message.=''.$comment.'
';
+ echo $message;
+ } else {
+ echo ''.$comment.'
';
+ }
+
+ //showing the score
+ $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
+ $resfree = Database::query($queryfree);
+ $questionScore= Database::result($resfree,0,"marks");
+ $totalScore+=$questionScore;
+ ?>
+
+
+
+
+
+ |
+
+ ';
+ }
+ }
+
+ if ($show_results) {
+ if ($answerType != HOT_SPOT) {
+ echo '';
+ }
+ }
+
+ if ($show_results) {
+ $comnt = get_comments($id, $questionId);
+ if (!empty($comnt)) {
+ echo ''.get_lang('Feedback').'';
+ echo ''.$comnt.'
';
+ }
+ }
+
+
+ $my_total_score = $questionScore;
+ $my_total_weight = $questionWeighting;
+
+ if ($objExercise->selectPropagateNeg() == 0 && $my_total_score < 0) {
+ $my_total_score = 0;
+ }
if ($show_results) {
- echo '
-
- ';
- }
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg());
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
-
- if ($show_results) {
- echo ' |
';
- echo '
- '.
- '
- |
-
-
';
- }
- } else if($answerType == HOT_SPOT_DELINEATION) {
-
- $question_result = $objExercise->manage_answer($id, $questionId, $choice,'exercise_show', array(), false, true, $show_results, $objExercise->selectPropagateNeg(), 'database');
-
- $questionScore = $question_result['score'];
- $totalScore += $question_result['score'];
-
- $final_overlap = $question_result['extra']['final_overlap'];
- $final_missing = $question_result['extra']['final_missing'];
- $final_excess = $question_result['extra']['final_excess'];
-
- $overlap_color = $question_result['extra']['overlap_color'];
- $missing_color = $question_result['extra']['missing_color'];
- $excess_color = $question_result['extra']['excess_color'];
-
- $threadhold1 = $question_result['extra']['threadhold1'];
- $threadhold2 = $question_result['extra']['threadhold2'];
- $threadhold3 = $question_result['extra']['threadhold3'];
-
-
- if ($show_results) {
-
- if ($overlap_color) {
- $overlap_color='green';
- } else {
- $overlap_color='red';
- }
-
- if ($missing_color) {
- $missing_color='green';
- } else {
- $missing_color='red';
- }
- if ($excess_color) {
- $excess_color='green';
- } else {
- $excess_color='red';
- }
-
-
- if (!is_numeric($final_overlap)) {
- $final_overlap = 0;
- }
-
- if (!is_numeric($final_missing)) {
- $final_missing = 0;
- }
- if (!is_numeric($final_excess)) {
- $final_excess = 0;
- }
-
- if ($final_excess>100) {
- $final_excess = 100;
- }
-
- $table_resume='
-
- |
- '.get_lang('Requirements').' |
- '.get_lang('YourAnswer').' |
-
-
-
- '.get_lang('Overlap').' |
- '.get_lang('Min').' '.$threadhold1.' |
- '.(($final_overlap < 0)?0:intval($final_overlap)).' |
-
-
-
- '.get_lang('Excess').' |
- '.get_lang('Max').' '.$threadhold2.' |
- '.(($final_excess < 0)?0:intval($final_excess)).' |
-
-
-
- '.get_lang('Missing').' |
- '.get_lang('Max').' '.$threadhold3.' |
- '.(($final_missing < 0)?0:intval($final_missing)).' |
-
';
-
- if ($answerType!= HOT_SPOT_DELINEATION) {
- $item_list=explode('@@',$destination);
- //print_R($item_list);
- $try = $item_list[0];
- $lp = $item_list[1];
- $destinationid= $item_list[2];
- $url=$item_list[3];
- $table_resume='';
- } else {
- if ($next==0) {
- $try = $try_hotspot;
- $lp = $lp_hotspot;
- $destinationid= $select_question_hotspot;
- $url=$url_hotspot;
- } else {
- //show if no error
- //echo 'no error';
- $comment=$answerComment=$objAnswerTmp->selectComment($nbrAnswers);
- $answerDestination=$objAnswerTmp->selectDestination($nbrAnswers);
- }
- }
-
- echo ''.get_lang('Feedback').'
';
- if ($answerType == HOT_SPOT_DELINEATION) {
- if ($organs_at_risk_hit>0) {
- $message='
'.get_lang('ResultIs').' '.$result_comment.'
';
- $message.=''.get_lang('OARHit').'
';
- } else {
- $message=''.get_lang('YourDelineation').'
';
- $message.=$table_resume;
- $message.='
'.get_lang('ResultIs').' '.$result_comment.'
';
- }
- $message.=''.$comment.'
';
- echo $message;
- } else {
- echo ''.$comment.'
';
- }
-
- //showing the score
- $queryfree = "select marks from ".$TBL_TRACK_ATTEMPT." where exe_id = '".Database::escape_string($id)."' and question_id= '".Database::escape_string($questionId)."'";
- $resfree = Database::query($queryfree);
- $questionScore= Database::result($resfree,0,"marks");
- $totalScore+=$questionScore;
- ?>
-
-
-
-
-
- |
-
- ';
- }
- }
-
- if ($show_results) {
- if ($answerType != HOT_SPOT) {
- echo '';
+ echo '';
+ echo get_lang('Score')." : ".show_score($my_total_score, $my_total_weight, false, false);
+ echo '
';
}
- }
-
- if ($show_results) {
- $comnt = get_comments($id, $questionId);
- if (!empty($comnt)) {
- echo ''.get_lang('Feedback').'';
- echo ''.$comnt.'
';
- }
- }
-
-
- $my_total_score = $questionScore;
- $my_total_weight = $questionWeighting;
-
- if ($objExercise->selectPropagateNeg() == 0 && $my_total_score < 0) {
- $my_total_score = 0;
- }
- if ($show_results) {
- echo '';
- echo get_lang('Score')." : ".show_score($my_total_score, $my_total_weight, false, false);
- echo '
';
- }
- unset($objAnswerTmp);
- unset($objQuestionTmp);
- $i++;
- $totalWeighting += $questionWeighting;
-
-} // end of large foreach on questions
+ unset($objAnswerTmp);
+ unset($objQuestionTmp);
+ $i++;
+ $totalWeighting += $questionWeighting;
+
+ } // end of large foreach on questions
+}
//Total score
if ($show_results || $show_only_total_score) {
@@ -353,4 +365,8 @@ if ($show_results || $show_only_total_score) {
}
echo show_score($my_total_score_temp, $totalWeighting, false);
echo '';
-}
\ No newline at end of file
+}
+
+if ($show_headers) {
+ Display::display_footer();
+}
\ No newline at end of file
diff --git a/main/session/index.php b/main/session/index.php
index b5dba8a51e..33423eb32d 100644
--- a/main/session/index.php
+++ b/main/session/index.php
@@ -175,7 +175,9 @@ foreach($final_array as $session_data) {
$my_score = $exercise_result['exe_result']/$exercise_result['exe_weighting'];
}
$position = get_exercise_result_ranking($my_score, $exercise_result['exe_id'], $my_exercise_id, $my_course_code,$session_id);
- $exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/exercice.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id&show=result", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link'));
+ //$exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/exercice.php?cidReq=$my_course_code&exerciseId={$exercise_info->id}&id_session=$session_id&show=result", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link'));
+ $exercise_info->exercise = Display::url($exercise_info->exercise, api_get_path(WEB_CODE_PATH)."exercice/result.php?cidReq=$my_course_code&id={$exercise_result['exe_id']}&id_session=$session_id&show_headers=1", array('target'=>SESSION_LINK_TARGET,'class'=>'exercise-result-link'));
+
$my_real_array[]= array( //'date' => api_get_local_time($exercise_result['exe_date']),
'status' => Display::return_icon('quiz.gif', get_lang('Attempted'),'','22'),
'date' => $start_date,