|
293 | 293 | $nameTools = get_lang('Exercices'); |
294 | 294 | } else { |
295 | 295 | if ($is_allowedToEdit || $is_tutor) { |
296 | | - $nameTools = get_lang('StudentScore'); |
297 | | - $interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); |
| 296 | + $nameTools = get_lang('StudentScore'); |
| 297 | + $interbreadcrumb[] = array("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); |
| 298 | + $objExerciseTmp = new Exercise(); |
| 299 | + if ($objExerciseTmp->read($exerciseId)) { |
| 300 | + $interbreadcrumb[] = array("url" => "admin.php?exerciseId=".$exerciseId, "name" => cut($objExerciseTmp->exercise, EXERCISE_MAX_NAME_BREADCRUMB)); |
| 301 | + } |
298 | 302 | } else { |
299 | 303 | $nameTools = get_lang('YourScore'); |
300 | 304 | $interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook","name" => get_lang('Exercices')); |
301 | 305 | } |
302 | 306 | } |
303 | 307 |
|
304 | 308 | // need functions of statsutils lib to display previous exercices scores |
305 | | -require_once (api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php'); |
| 309 | +require_once api_get_path(LIBRARY_PATH) . 'statsUtils.lib.inc.php'; |
306 | 310 |
|
307 | 311 | if ($is_allowedToEdit && !empty ($choice) && $choice == 'exportqti2') { |
308 | 312 | require_once 'export/qti2/qti2_export.php'; |
|
347 | 351 | if (!$is_allowedToEdit and !$is_tutor) { |
348 | 352 | $user_id = api_get_user_id(); |
349 | 353 | } |
350 | | - require_once ('exercise_result.class.php'); |
| 354 | + require_once 'exercise_result.class.php'; |
351 | 355 | switch ($_POST['export_format']) { |
352 | 356 | case 'xls' : |
353 | 357 | $export = new ExerciseResult(); |
|
388 | 392 | // only for administrator |
389 | 393 |
|
390 | 394 | if ($is_allowedToEdit) { |
391 | | - if (!empty ($choice)) { |
| 395 | + if (!empty($choice)) { |
392 | 396 | // construction of Exercise |
393 | 397 |
|
394 | 398 | $objExerciseTmp = new Exercise(); |
|
443 | 447 | Security::clear_token(); |
444 | 448 | } |
445 | 449 |
|
446 | | - if (!empty ($hpchoice)) { |
447 | | - switch ($hpchoice) { |
| 450 | + if (!empty($hpchoice)) { |
| 451 | + switch($hpchoice) { |
448 | 452 | case 'delete' : // deletes an exercise |
449 | 453 | $imgparams = array (); |
450 | 454 | $imgcount = 0; |
|
712 | 716 | $i=1; |
713 | 717 |
|
714 | 718 | if ($is_allowedToEdit) { |
715 | | - $headers = array(get_lang('ExerciseName'), get_lang('QuantityQuestions'), get_lang('Actions')); |
| 719 | + $headers = array(array('name' => get_lang('ExerciseName')), |
| 720 | + array('name' => get_lang('QuantityQuestions'), 'params' => array('width'=>'80px')), |
| 721 | + array('name' => get_lang('Actions'), 'params' => array('width'=>'180px'))); |
716 | 722 | } else { |
717 | | - $headers = array(get_lang('ExerciseName'), get_lang('Status'), get_lang('Results')); |
| 723 | + $headers = array(array('name' => get_lang('ExerciseName')), |
| 724 | + array('name' => get_lang('Status')), |
| 725 | + array('name' => get_lang('Results'))); |
718 | 726 | } |
| 727 | + |
719 | 728 | $header_list = ''; |
720 | | - foreach($headers as $header) { |
721 | | - $header_list .= Display::tag('th',$header); |
| 729 | + foreach($headers as $header) { |
| 730 | + $header_list .= Display::tag('th', $header['name'], $header['params']); |
722 | 731 | } |
723 | | - echo Display::tag('tr',$header_list); |
| 732 | + echo Display::tag('tr', $header_list); |
724 | 733 |
|
725 | 734 | $count = 0; |
726 | 735 | if (!empty($exercise_list)) |
|
784 | 793 | } |
785 | 794 |
|
786 | 795 | //Showing exercise title |
787 | | - $row['title']= text_filter($row['title']); |
| 796 | + $row['title'] = text_filter($row['title']); |
788 | 797 | //echo Display::tag('h1',$row['title']); |
789 | 798 |
|
790 | 799 | if ($session_id == $row['session_id']) { |
|
883 | 892 | //This query might be improved later on by ordering by the new "tms" field rather than by exe_id |
884 | 893 | //Don't remove this marker: note-query-exe-results |
885 | 894 | $qry = "SELECT * FROM $TBL_TRACK_EXERCICES |
886 | | - WHERE exe_exo_id = ".$row['id']." AND exe_user_id = " . api_get_user_id() . " AND exe_cours_id = '" . api_get_course_id() . "' AND status <>'incomplete' AND orig_lp_id = 0 AND orig_lp_item_id = 0 AND session_id = '" . api_get_session_id() . "' |
| 895 | + WHERE exe_exo_id = ".$row['id']." AND |
| 896 | + exe_user_id = ".api_get_user_id()." AND |
| 897 | + exe_cours_id = '".api_get_course_id()."' AND |
| 898 | + status <> 'incomplete' AND |
| 899 | + orig_lp_id = 0 AND |
| 900 | + orig_lp_item_id = 0 AND |
| 901 | + session_id = '" . api_get_session_id() . "' |
887 | 902 | ORDER BY exe_id DESC"; |
888 | 903 | $qryres = Database::query($qry); |
889 | 904 | $num = Database :: num_rows($qryres); |
|
894 | 909 | //Time limits are on |
895 | 910 | if ($time_limits) { |
896 | 911 | // Examn is ready to be taken |
897 | | - if ($is_actived_time) { |
898 | | - if ($my_result_disabled == 0) { |
| 912 | + if ($is_actived_time) { |
| 913 | + //Show results |
| 914 | + if ($my_result_disabled == 0 || $my_result_disabled == 2) { |
| 915 | + //More than one attempt |
899 | 916 | if ($num > 0) { |
900 | 917 | $row_track = Database :: fetch_array($qryres); |
901 | 918 | $attempt_text = get_lang('LatestAttempt') . ' : '; |
902 | 919 | $attempt_text .= show_score($row_track['exe_result'], $row_track['exe_weighting']); |
903 | 920 | } else { |
904 | | - if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') { |
905 | | - $attempt_text = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time'])); |
906 | | - } else { |
907 | | - if ($row['start_time'] != '0000-00-00 00:00:00') { |
908 | | - $attempt_text = sprintf(get_lang('ExerciseAvailableFromX'), api_convert_and_format_date($row['start_time'])); |
909 | | - } |
910 | | - if ($row['end_time'] != '0000-00-00 00:00:00') { |
911 | | - $attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time'])); |
912 | | - } |
913 | | - } |
| 921 | + //No attempts |
| 922 | + $attempt_text = get_lang('NotAttempted'); |
914 | 923 | } |
915 | 924 | } else { |
916 | 925 | $attempt_text = get_lang('CantShowResults'); |
917 | 926 | } |
918 | 927 | } else { |
919 | | - //Quiz not ready |
| 928 | + //Quiz not ready due to time limits |
920 | 929 | if ($row['start_time'] != '0000-00-00 00:00:00' && $row['end_time'] != '0000-00-00 00:00:00') { |
921 | 930 | $attempt_text = sprintf(get_lang('ExerciseWillBeActivatedFromXToY'), api_convert_and_format_date($row['start_time']), api_convert_and_format_date($row['end_time'])); |
922 | 931 | } else { |
|
926 | 935 | } |
927 | 936 | if ($row['end_time'] != '0000-00-00 00:00:00') { |
928 | 937 | $attempt_text = sprintf(get_lang('ExerciseAvailableUntilX'), api_convert_and_format_date($row['end_time'])); |
929 | | - } |
930 | | - |
| 938 | + } |
931 | 939 | } |
932 | 940 | } |
933 | 941 | } else { |
934 | 942 | //Normal behaviour |
935 | 943 | //Show results |
936 | | - if ($my_result_disabled == 0) { |
| 944 | + if ($my_result_disabled == 0 || $my_result_disabled == 2) { |
937 | 945 | if ($num > 0) { |
938 | 946 | $row_track = Database :: fetch_array($qryres); |
939 | 947 | $attempt_text = get_lang('LatestAttempt') . ' : '; |
|
957 | 965 | }*/ |
958 | 966 |
|
959 | 967 | if (empty($num)) { |
960 | | - $num = ''; |
| 968 | + $num = ''; |
961 | 969 | } |
962 | 970 |
|
963 | 971 | $item .= Display::tag('td', $attempt_text); |
|
0 commit comments