exercise_history.php 3.6 KB

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