Result message is green or red if success or not see #5311

skala
Julio Montoya 12 years ago
parent fdd798b4f4
commit 74468146e5
  1. 4
      main/css/base.css
  2. 37
      main/exercice/exercise.lib.php

@ -2593,7 +2593,7 @@ div.admin_section h4 {
width: 260px;
}
.ribbon .rib-error {
.ribbon .rib-error, .ribbon .ribbon-total-error {
background:#C83F25;
background-image: -ms-linear-gradient(top, #992800, #C83F25);
@ -2607,7 +2607,7 @@ div.admin_section h4 {
border-bottom: 1px solid #7A290F;
}
.ribbon .rib-success {
.ribbon .rib-success, .ribbon .ribbon-total-success{
background-color: #768E00;
background-image: -ms-linear-gradient(top, #9CB80A, #768E00);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#9CB80A), to(#768E00));

@ -1203,21 +1203,29 @@ function show_score($score, $weight, $show_percentage = true, $use_platform_sett
return $html;
}
function show_success_message($score, $weight, $pass_percentage) {
function is_success_exercise_result($score, $weight, $pass_percentage) {
$percentage = float_format(($score / ($weight != 0 ? $weight : 1)) * 100, 1);
$html = '';
$icon = '';
if (isset($pass_percentage) && !empty($pass_percentage)) {
if ($percentage >= $pass_percentage) {
return true;
}
}
return false;
}
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');
$html .= get_lang('CongratulationsYouPassedTheTest');
$html = get_lang('CongratulationsYouPassedTheTest');
$icon = Display::return_icon('completed.png', get_lang('Correct'), array(), ICON_SIZE_MEDIUM);
} else {
//$html .= Display::return_message(get_lang('YouDidNotReachTheMinimumScore'), 'warning');
$html .= get_lang('YouDidNotReachTheMinimumScore');
$html = get_lang('YouDidNotReachTheMinimumScore');
$icon = Display::return_icon('warning.png', get_lang('Wrong'), array(), ICON_SIZE_MEDIUM);
}
}
$html = Display::tag('h4', $html);
$html .= Display::tag('h5', $icon, array('style' => 'width:40px; padding:5px 10px 0px 0px'));
return $html;
@ -2068,9 +2076,20 @@ function display_question_list_by_attempt($objExercise, $exe_id, $save_user_resu
if ($origin != 'learnpath') {
if ($show_results || $show_only_score) {
$total_score_text .= '<div class="question_row">
<div class="ribbon ribbon-total">
<div class="rib rib-total">';
$is_success = is_success_exercise_result($total_score, $total_weight, $objExercise->selectPassPercentage());
$total_score_text .= '<div class="question_row">';
if ($is_success) {
$total_score_text .= '
<div class="ribbon ribbon-total ">
<div class="rib rib-total ribbon-total-success">';
} else {
$total_score_text .= '
<div class="ribbon ribbon-total ">
<div class="rib rib-total ribbon-total-error">';
}
$total_score_text .= '<h3>';
$total_score_text .= get_lang('YourTotalScore')."&nbsp;";
if ($objExercise->selectPropagateNeg() == 0 && $total_score < 0) {

Loading…
Cancel
Save