diff --git a/main/css/base.css b/main/css/base.css index 99b3ab4fc8..0456ff4f51 100644 --- a/main/css/base.css +++ b/main/css/base.css @@ -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; diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index ce354a1d49..d127abe9ea 100644 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -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 .= '
'; - $total_score_text .= '
'; - - // 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 .= '
'; - - $total_score_text .= '

'; - $total_score_text .= get_lang('YourTotalScore')." "; - if ($objExercise->selectPropagateNeg() == 0 && $total_score < 0) { - $total_score = 0; - } - $total_score_text .= show_score($total_score, $total_weight, false, true); - $total_score_text .= '

'; - $total_score_text .= '
'; - $total_score_text .= show_success_message($total_score, $total_weight, $objExercise->selectPassPercentage()); - - $total_score_text .= '
'; + $total_score_text .= '
'; + $total_score_text .= get_question_ribbon($objExercise, $total_score, $total_weight, true); $total_score_text .= '
'; } } @@ -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 = '
'; + 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 .= '
'; + } else { + $ribbon .= '
'; + } + $ribbon .= '

'.get_lang('YourTotalScore').": "; + $ribbon .= show_score($score, $weight, false, true); + if ($check_pass_percentage) { + $ribbon .= show_success_message($score, $weight, $objExercise->selectPassPercentage()); } + $ribbon .= '

'; + $ribbon .= '
'; + $ribbon .= '
'; + return $ribbon; } \ No newline at end of file diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index bfe42fa834..35101d493f 100644 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -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 .= '
-
-
'; - - $total_score_text .= '

'.get_lang('YourTotalScore').": "; + if ($show_results || $show_only_total_score) { + $total_score_text .= '
'; $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 .= '

'; - $total_score_text .= '
'; - $total_score_text .= '
'; + } + $total_score_text .= get_question_ribbon($objExercise, $my_total_score_temp, $totalWeighting, true); $total_score_text .= '
'; } } diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index 4e392ea5d8..39ff852b96 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -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('

'.$score_label.'

'.get_lang("Question").' '.($counter_label).'

'.$score['result'].'
', array('class'=>'ribbon')); - $header .= ''; + $header = Display::page_subheader2($counter_label.". ".$question_title); + //$header .= Display::div('

'.$score_label.'

'.($score['result']).'

'.$score['result'].'
', array('class'=>'ribbon')); + $header .= Display::div('

'.$score_label.'

'.$score['result'].'

', array('class'=>'ribbon')); $header .= Display::div($this->description, array('id'=>'question_description')); return $header; } diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 30a3a08641..d3a8f9f3d3 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -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 .= " $second_title"; } - return ''; + return ''; } public static function page_header_and_translate($title, $second_title = null) { @@ -1381,6 +1381,14 @@ class Display { return ''; } + 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)) {