exercise_history.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. require_once '../inc/global.inc.php';
  14. $this_section=SECTION_COURSES;
  15. api_protect_course_script(true);
  16. $show=(isset($_GET['show']) && $_GET['show'] == 'result')?'result':'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
  17. /* Constants and variables */
  18. $is_allowedToEdit = api_is_allowed_to_edit(null,true);
  19. $is_tutor = api_is_allowed_to_edit(true);
  20. if (!$is_allowedToEdit){
  21. header('Location: /main/exercice/exercise.php?cidReq='.Security::remove_XSS($_GET['cidReq']));
  22. exit;
  23. }
  24. $interbreadcrumb[]= array ('url' => 'exercise_report.php?'.api_get_cidreq(),'name' => get_lang('Exercises'));
  25. $interbreadcrumb[]= array ('url' => 'exercise_report.php?filter=2&'.api_get_cidreq(),'name' => get_lang('StudentScore'));
  26. $interbreadcrumb[]= array ('url' => 'exercise_history.php?exe_id='.intval($_GET['exe_id']).'&'.api_get_cidreq(), 'name' => get_lang('Details'));
  27. $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
  28. $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
  29. $TBL_EXERCISES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
  30. $TBL_TRACK_ATTEMPT_RECORDING= Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
  31. Display::display_header($nameTools,get_lang('Exercise'));
  32. if (isset($_GET['message'])) {
  33. if (in_array($_GET['message'], array('ExerciseEdited'))) {
  34. $my_message_history=Security::remove_XSS($_GET['message']);
  35. Display::display_confirmation_message(get_lang($my_message_history));
  36. }
  37. }
  38. echo '<div class="actions">';
  39. echo '<a href="exercise_report.php?' . api_get_cidreq() . '&filter=2">' .
  40. Display :: return_icon('back.png', get_lang('BackToResultList'),'',ICON_SIZE_MEDIUM).'</a>';
  41. echo '</div>';
  42. ?>
  43. <table class="data_table">
  44. <tr class="row_odd">
  45. <th><?php echo get_lang('Question'); ?></th>
  46. <th width="50px"><?php echo get_lang('Value'); ?></th>
  47. <th><?php echo get_lang('Feedback'); ?></th>
  48. <th><?php echo get_lang('Author'); ?></th>
  49. <th width="160px"><?php echo get_lang('Date'); ?></th>
  50. </tr>
  51. <?php
  52. $sql = "SELECT *, quiz_question.question, firstname, lastname FROM $TBL_TRACK_ATTEMPT_RECORDING t, $TBL_USER,$TBL_EXERCISES_QUESTION quiz_question
  53. WHERE quiz_question.id = question_id AND user_id = author AND exe_id = '".(int)$_GET['exe_id']."' ORDER BY position";
  54. $query = Database::query($sql);
  55. while($row = Database::fetch_array($query)){
  56. echo '<tr';
  57. if ($i%2==0) {
  58. echo 'class="row_odd"';
  59. } else {
  60. echo 'class="row_even"';
  61. }
  62. echo '>';
  63. echo '<td>'.$row['question'].'</td>';
  64. echo '<td>'.$row['marks'].'</td>';
  65. if (!empty($row['teacher_comment'])) {
  66. echo '<td>'.$row['teacher_comment'].'</td>';
  67. } else {
  68. echo '<td>'.get_lang('WithoutComment').'</td>';
  69. }
  70. echo '<td>'.(empty($row['firstname']) && empty($row['lastname']) ? '<i>'.get_lang('OriginalValue').'</i>' : api_get_person_name($row['firstname'], $row['lastname'])).'</td>';
  71. echo '<td>'.api_convert_and_format_date($row['insert_date'], DATE_TIME_FORMAT_LONG).'</td>';
  72. echo '</tr>';
  73. }
  74. echo '</table>';
  75. Display::display_footer();