exercise_history.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Exercise list: This script shows the list of exercises for administrators and students.
  5. * @package chamilo.exercise
  6. * @author Olivier Brouckaert, original author
  7. * @author Denes Nagy, HotPotatoes integration
  8. * @author Wolfgang Schneider, code/html cleanup
  9. */
  10. /**
  11. * Code
  12. */
  13. /**
  14. * name of the language file that needs to be included
  15. */
  16. $language_file='exercice';
  17. require_once '../inc/global.inc.php';
  18. $this_section=SECTION_COURSES;
  19. api_protect_course_script(true);
  20. $show=(isset($_GET['show']) && $_GET['show'] == 'result')?'result':'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
  21. /**
  22. * Libraries
  23. */
  24. require_once api_get_path(LIBRARY_PATH).'document.lib.php';
  25. /* Constants and variables */
  26. $is_allowedToEdit = api_is_allowed_to_edit(null,true);
  27. $is_tutor = api_is_allowed_to_edit(true);
  28. if(!$is_allowedToEdit){
  29. header('Location: /main/exercice/exercice.php?cidReq='.Security::remove_XSS($_GET['cidReq']));
  30. exit;
  31. }
  32. $interbreadcrumb[]= array ('url' => 'exercise_report.php','name' => get_lang('Exercices'));
  33. $interbreadcrumb[]= array ('url' => 'exercise_report.php'.'?filter=2','name' => get_lang('StudentScore'));
  34. $interbreadcrumb[]= array ('url' => 'exercise_history.php'.'?exe_id='.intval($_GET['exe_id']), 'name' => get_lang('Details'));
  35. $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
  36. $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
  37. $TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
  38. $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  39. $TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
  40. Display::display_header($nameTools,get_lang('Exercise'));
  41. if (isset($_GET['message'])) {
  42. if (in_array($_GET['message'], array('ExerciseEdited'))) {
  43. $my_message_history=Security::remove_XSS($_GET['message']);
  44. Display::display_confirmation_message(get_lang($my_message_history));
  45. }
  46. }
  47. echo '<div class="actions">';
  48. echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' . Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>';
  49. echo '</div>';
  50. ?>
  51. <table class="data_table">
  52. <tr class="row_odd">
  53. <th><?php echo get_lang('Question'); ?></th>
  54. <th width="50px"><?php echo get_lang('Value'); ?></th>
  55. <th><?php echo get_lang('Feedback'); ?></th>
  56. <th><?php echo get_lang('Author'); ?></th>
  57. <th width="160px"><?php echo get_lang('Date'); ?></th>
  58. </tr>
  59. <?php
  60. $sql = "SELECT *, quiz_question.question, firstname, lastname FROM $TBL_TRACK_ATTEMPT_RECORDING t, $TBL_USER,$TBL_EXERCICES_QUESTION quiz_question
  61. WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int)$_GET['exe_id']."' ORDER BY position";
  62. $query = Database::query($sql);
  63. while($row = Database::fetch_array($query)){
  64. echo '<tr';
  65. if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"';
  66. echo '>';
  67. echo '<td>'.$row['question'].'</td>';
  68. echo '<td>'.$row['marks'].'</td>';
  69. if(!empty($row['teacher_comment'])){
  70. echo '<td>'.$row['teacher_comment'].'</td>';
  71. } else {
  72. echo '<td>'.get_lang('WithoutComment').'</td>';
  73. }
  74. echo '<td>'.(empty($row['firstname']) && empty($row['lastname']) ? '<i>'.get_lang('OriginalValue').'</i>' : api_get_person_name($row['firstname'], $row['lastname'])).'</td>';
  75. echo '<td>'.api_convert_and_format_date($row['insert_date'], DATE_TIME_FORMAT_LONG).'</td>';
  76. echo '</tr>';
  77. }
  78. echo '</table>';
  79. Display::display_footer();