diff --git a/main/exercice/exercice.php b/main/exercice/exercice.php index 97507676a2..907edde139 100755 --- a/main/exercice/exercice.php +++ b/main/exercice/exercice.php @@ -778,7 +778,13 @@ if ($show == 'test') { //Showing exercise title $row['title']=text_filter($row['title']); - echo Display::tag('h1',$row['title']); + echo Display::tag('h1',$row['title']); + + if ($session_id == $row['session_id']) { + //Settings + //echo Display::url(Display::return_icon('settings.png',get_lang('Edit'), array('width'=>'22px'))." ".get_lang('Edit'), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']); + } + echo '

'; echo $session_img; $exid = $row['id']; @@ -800,7 +806,7 @@ if ($show == 'test') { if ($session_id == $row['session_id']) { //Settings - echo Display::url(Display::return_icon('settings.png',get_lang('Edit'), array('width'=>'22px'))." ".get_lang('Edit'), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']); + echo Display::url(Display::return_icon('edit.gif',get_lang('Edit'), array('width'=>'20px')), 'exercise_admin.php?'.api_get_cidreq().'&modifyExercise=yes&exerciseId='.$row['id']); //Export echo Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick'=>"javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'),ENT_QUOTES,$charset))." ".addslashes($row['title'])."?"."')) return false;",'href'=>'exercice.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id'])); diff --git a/main/exercice/exercise.lib.php b/main/exercice/exercise.lib.php index 188fec91d2..0be1607b12 100755 --- a/main/exercice/exercise.lib.php +++ b/main/exercice/exercise.lib.php @@ -1015,7 +1015,8 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) { $ex = show_score($my_res, $my_total); - $result_list = round(($my_res / ($my_total != 0 ? $my_total : 1)) * 100, 2) . '% (' . $my_res . ' / ' . $my_total . ') --> '.$ex; + //$result_list = round(($my_res / ($my_total != 0 ? $my_total : 1)) * 100, 2) . '% (' . $my_res . ' / ' . $my_total . ')'; + $result_list = $ex; $html_link = ''; if ($is_allowedToEdit || $is_tutor) { @@ -1105,5 +1106,26 @@ function show_score($score, $weight, $show_porcentage = true) { } +function convert_score($score, $weight) { + $html = ''; + $score_rounded = $score; + + if ($score != '' && $weight != '') { + $max_note = api_get_setting('exercise_max_score'); + $min_note = api_get_setting('exercise_min_score'); + if ($max_note != '' && $min_note != '') { + + if (!empty($weight)) { + + $score = $min_note + ($max_note - $min_note) * $score /$weight; + } else { + $score = $min_note; + } + $score_rounded = round($score, 2); + } + } + return $score_rounded; +} + diff --git a/main/exercice/exercise_show.php b/main/exercice/exercise_show.php index 3672eb635c..6d8c04b47d 100755 --- a/main/exercice/exercise_show.php +++ b/main/exercice/exercise_show.php @@ -578,12 +578,13 @@ if ($show_results) { '; - //echo get_lang('Score')." : $my_total_score/$my_total_weight"; - echo get_lang('Score')." : ".show_score($my_total_score,$total_weighting,false); + echo get_lang('Score')." : $my_total_score/$my_total_weight"; + //echo get_lang('Score')." : ".show_score($my_total_score, $total_weighting, false); echo ''; unset($objAnswerTmp); diff --git a/main/newscorm/lp_stats.php b/main/newscorm/lp_stats.php index 57063c5dc3..0f5280d60b 100755 --- a/main/newscorm/lp_stats.php +++ b/main/newscorm/lp_stats.php @@ -14,6 +14,7 @@ require_once 'learnpath.class.php'; require_once 'resourcelinker.inc.php'; require_once api_get_path(LIBRARY_PATH).'tracking.lib.php'; require_once api_get_path(LIBRARY_PATH).'course.lib.php'; +require_once '../exercice/exercise.lib.php'; if (empty($_SESSION['_course']['id']) && isset($_GET['course'])) { $course_code = Security::remove_XSS($_GET['course']); @@ -285,7 +286,9 @@ if (is_array($list) && count($list) > 0) { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { - $view_score = ($score == 0 ? '/' : ($maxscore === 0 ? $score : $score . '/' . float_format($maxscore, 1))); + //$view_score = ($score == 0 ? '/' : ($maxscore === 0 ? $score : $score . '/' . float_format($maxscore, 1))); + $view_score = show_score($score,$maxscore, false); + } $output .= "\n" . "\n" . "$extend_attempt_link\n" . '' . get_lang('Attempt') . ' ' . $row['iv_view_count'] . "\n" . '

' . $my_lesson_status . "
\n" . '
' . $view_score . "
\n" . '
'.$time.'
'; @@ -296,7 +299,6 @@ if (is_array($list) && count($list) > 0) { $temp[] = Security::remove_XSS($my_lesson_status); if ($row['item_type'] == 'quiz') { - if (!$is_allowed_to_edit && $result_disabled_ext_all) { $temp[] = '/'; } else { @@ -546,13 +548,12 @@ if (is_array($list) && count($list) > 0) { $output .= "$extend_link\n" . '
' .$title. '
' . "\n"; $output .= '
' . $my_lesson_status . "
\n" . '
'; if ($row['item_type'] == 'quiz') { - if (!$is_allowed_to_edit && $result_disabled_ext_all) { $output .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { - $output .= ($score == 0 ? '0/'.float_format($maxscore, 1) : ($maxscore == 0 ? $score : float_format($score, 1) . '/' . float_format($maxscore, 1))); + // $output .= ($score == 0 ? '0/'.float_format($maxscore, 1) : ($maxscore == 0 ? $score : float_format($score, 1) . '/' . float_format($maxscore, 1))); + $output .= show_score($score, $maxscore, false); } - } else { $output .= ($score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore)); } @@ -642,10 +643,13 @@ if (is_array($list) && count($list) > 0) { if ($my_score == 0 ) { $view_score = '0/'.$my_maxscore; } else { - if ($my_maxscore == 0) + if ($my_maxscore == 0) { $view_score = $my_score; - else - $view_score = $my_score . '/' . $my_maxscore; + } else { + //$view_score = $my_score . '/' . $my_maxscore; + $view_score = show_score($my_score, $my_maxscore, false); + } + } //$view_score = ($my_score == 0 ? '0.00/'.$my_maxscore : ($my_maxscore == 0 ? $my_score : $my_score . '/' . $my_maxscore)); }