Some fixes in the exercise result page see #5576

skala
Julio Montoya 13 years ago
parent f7fbfa86ca
commit 344174c8a8
  1. 10
      main/css/base.css
  2. 61
      main/exercice/exercise.lib.php
  3. 16
      main/exercice/exercise_show.php
  4. 11
      main/exercice/question.class.php
  5. 12
      main/inc/lib/display.lib.php

@ -2580,7 +2580,7 @@ div.admin_section h4 {
}
.ribbon .rib {
height: 30px;
height: 28px;
width: 120px;
display: block;
line-height: 1.3;
@ -2588,7 +2588,7 @@ div.admin_section h4 {
top: 0px;
color: #cfcfcf;
margin: 0;
padding: 5px 10px;
padding: 2px 10px;
position: relative;
text-shadow: 0 1px 1px #111;
border-top: 1px solid #363636;
@ -2658,12 +2658,12 @@ div.admin_section h4 {
}
.ribbon h4 {
height: 28px;
display: block;
left: 140px;
height: 30px;
left: 140px;
line-height: 1.3;
margin: 0;
padding: 5px 10px;
padding: 2px 10px;
position: absolute;
top: 8px;
color: #444;

@ -1283,8 +1283,7 @@ function show_success_message($score, $weight, $pass_percentage) {
$is_success = is_success_exercise_result($score, $weight, $pass_percentage);
$icon = '';
if ($is_success) {
//$html .= Display::return_message(get_lang('CongratulationsYouPassedTheTest'), 'success');
if ($is_success) {
$html = get_lang('CongratulationsYouPassedTheTest');
$icon = Display::return_icon('completed.png', get_lang('Correct'), array(), ICON_SIZE_MEDIUM);
} else {
@ -2195,33 +2194,8 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
if ($origin != 'learnpath') {
if ($show_results || $show_only_score) {
$is_success = is_success_exercise_result($total_score, $total_weight, $objExercise->selectPassPercentage());
$total_score_text .= '<div class="question_row">';
$total_score_text .= '<div class="ribbon ribbon-total ">';
// Color the final test score if pass_percentage activated
$ribbon_total_success_or_error = "";
if (is_pass_pourcentage_enabled($objExercise->selectPassPercentage())) {
if ($is_success) {
$ribbon_total_success_or_error = ' ribbon-total-success';
} else {
$ribbon_total_success_or_error = ' ribbon-total-error';
}
}
$total_score_text .= '<div class="rib rib-total $ribbon_total_success_or_error">';
$total_score_text .= '<h3>';
$total_score_text .= get_lang('YourTotalScore')."&nbsp;";
if ($objExercise->selectPropagateNeg() == 0 && $total_score < 0) {
$total_score = 0;
}
$total_score_text .= show_score($total_score, $total_weight, false, true);
$total_score_text .= '</h3>';
$total_score_text .= '</div>';
$total_score_text .= show_success_message($total_score, $total_weight, $objExercise->selectPassPercentage());
$total_score_text .= '</div>';
$total_score_text .= '<div class="question_row">';
$total_score_text .= get_question_ribbon($objExercise, $total_score, $total_weight, true);
$total_score_text .= '</div>';
}
}
@ -2253,5 +2227,34 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
if (!api_is_allowed_to_edit(null,true)) {
$objExercise->send_notification_for_open_questions($question_list_answers, $origin, $exe_id);
}
}
}
function get_question_ribbon($objExercise, $score, $weight, $check_pass_percentage = false) {
$ribbon = '<div class="ribbon">';
if ($check_pass_percentage) {
$is_success = is_success_exercise_result($score, $weight, $objExercise->selectPassPercentage());
// Color the final test score if pass_percentage activated
$ribbon_total_success_or_error = "";
if (is_pass_pourcentage_enabled($objExercise->selectPassPercentage())) {
if ($is_success) {
$ribbon_total_success_or_error = ' ribbon-total-success';
} else {
$ribbon_total_success_or_error = ' ribbon-total-error';
}
}
$ribbon .= '<div class="rib rib-total '.$ribbon_total_success_or_error.'">';
} else {
$ribbon .= '<div class="rib rib-total">';
}
$ribbon .= '<h3>'.get_lang('YourTotalScore').":&nbsp;";
$ribbon .= show_score($score, $weight, false, true);
if ($check_pass_percentage) {
$ribbon .= show_success_message($score, $weight, $objExercise->selectPassPercentage());
}
$ribbon .= '</h3>';
$ribbon .= '</div>';
$ribbon .= '</div>';
return $ribbon;
}

@ -632,21 +632,13 @@ $total_score_text = null;
//Total score
if ($origin!='learnpath' || ($origin == 'learnpath' && isset($_GET['fb_type']))) {
if ($show_results || $show_only_total_score ) {
$total_score_text .= '<div class="question_row">
<div class="ribbon">
<div class="rib rib-total">';
$total_score_text .= '<h3>'.get_lang('YourTotalScore').": ";
if ($show_results || $show_only_total_score) {
$total_score_text .= '<div class="question_row">';
$my_total_score_temp = $totalScore;
if ($objExercise->selectPropagateNeg() == 0 && $my_total_score_temp < 0) {
$my_total_score_temp = 0;
}
$total_score_text .= show_score($my_total_score_temp, $totalWeighting, false);
$total_score_text .= '</h3>';
$total_score_text .= '</div>';
$total_score_text .= '</div>';
}
$total_score_text .= get_question_ribbon($objExercise, $my_total_score_temp, $totalWeighting, true);
$total_score_text .= '</div>';
}
}

@ -1373,8 +1373,7 @@ abstract class Question
* @param type $counter
* @param type $score
*/
function return_header($feedback_type = null, $counter = null, $score = null) {
function return_header($feedback_type = null, $counter = null, $score = null) {
$counter_label = '';
if (!empty($counter)) {
$counter_label = intval($counter);
@ -1394,11 +1393,11 @@ abstract class Question
$score_label = get_lang('NotRevised');
$class = 'error';
}
}
}
$question_title = $this->question;
$header = Display::div('<div class="rib rib-'.$class.'"><h3>'.$score_label.'</h3></div> <h4>'.get_lang("Question").' '.($counter_label).' </h4><h5 class="'.$class.'">'.$score['result'].' </h5>', array('class'=>'ribbon'));
$header .= '<div class="page-header"><h4>'.$question_title.'</h4></div>';
$header = Display::page_subheader2($counter_label.". ".$question_title);
//$header .= Display::div('<div class="rib rib-'.$class.'"><h3>'.$score_label.'</h3></div> <h4>'.($score['result']).' </h4><h5 class="'.$class.'">'.$score['result'].' </h5>', array('class'=>'ribbon'));
$header .= Display::div('<div class="rib rib-'.$class.'"><h3>'.$score_label.'</h3></div> <h4>'.$score['result'].' </h4>', array('class'=>'ribbon'));
$header .= Display::div($this->description, array('id'=>'question_description'));
return $header;
}

@ -1354,13 +1354,13 @@ class Display {
return 'data_table';
}
public static function page_header($title, $second_title = null) {
public static function page_header($title, $second_title = null, $size = 'h1') {
$title = Security::remove_XSS($title);
if (!empty($second_title)) {
$second_title = Security::remove_XSS($second_title);
$title .= "<small> $second_title<small>";
}
return '<div class="page-header"><h1>'.$title.'</h1></div>';
return '<div class="page-header"><'.$size.'>'.$title.'</'.$size.'></div>';
}
public static function page_header_and_translate($title, $second_title = null) {
@ -1381,6 +1381,14 @@ class Display {
return '<div class="page-header"><h2>'.Security::remove_XSS($title).'</h2></div>';
}
public static function page_subheader2($title, $second_title = null) {
return self::page_header($title, $second_title, 'h3');
}
public static function page_subheader3($title, $second_title = null) {
return self::page_header($title, $second_title, 'h4');
}
public static function description($list) {
$html = null;
if (!empty($list)) {

Loading…
Cancel
Save