exercice_history.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. /*
  3. DOKEOS - elearning and course management software
  4. For a full list of contributors, see documentation/credits.html
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. See "documentation/licence.html" more details.
  10. Contact:
  11. Dokeos
  12. Rue du Corbeau, 108
  13. B-1030 Brussels - Belgium
  14. info@dokeos.com
  15. */
  16. /**
  17. * Exercise list: This script shows the list of exercises for administrators and students.
  18. * @package dokeos.exercise
  19. * @author Olivier Brouckaert, original author
  20. * @author Denes Nagy, HotPotatoes integration
  21. * @author Wolfgang Schneider, code/html cleanup
  22. * @version $Id:exercice.php 12269 2007-05-03 14:17:37Z elixir_julian $
  23. */
  24. // name of the language file that needs to be included
  25. $language_file='exercice';
  26. require_once('../inc/global.inc.php');
  27. $this_section=SECTION_COURSES;
  28. api_protect_course_script(true);
  29. $show=(isset($_GET['show']) && $_GET['show'] == 'result')?'result':'test'; // moved down to fix bug: http://www.dokeos.com/forum/viewtopic.php?p=18609#18609
  30. /*
  31. -----------------------------------------------------------
  32. Libraries
  33. -----------------------------------------------------------
  34. */
  35. require_once(api_get_path(LIBRARY_PATH).'document.lib.php');
  36. //include(api_get_path(LIBRARY_PATH).'mail.lib.inc.php');
  37. include(api_get_path(LIBRARY_PATH).'usermanager.lib.php');
  38. /*
  39. -----------------------------------------------------------
  40. Constants and variables
  41. -----------------------------------------------------------
  42. */
  43. $is_allowedToEdit = api_is_allowed_to_edit(null,true);
  44. $is_tutor = api_is_allowed_to_edit(true);
  45. if(!$is_allowedToEdit){
  46. header('Location: /main/exercice/exercice.php?cidReq='.Security::remove_XSS($_GET['cidReq']));
  47. exit;
  48. }
  49. $interbreadcrumb[]= array (
  50. 'url' => 'exercice.php'.'?show=result',
  51. 'name' => get_lang('Exercices')
  52. );
  53. $interbreadcrumb[]= array (
  54. 'url' => 'exercice.php'.'?show=result&amp;filter=2',
  55. 'name' => get_lang('StudentScore')
  56. );
  57. $interbreadcrumb[]= array (
  58. 'url' => 'exercice_history.php'.'?exe_id='.Security::remove_XSS($_GET['exe_id']),
  59. 'name' => get_lang('Details')
  60. );
  61. $TBL_USER = Database::get_main_table(TABLE_MAIN_USER);
  62. $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
  63. $TBL_EXERCICES_QUESTION = Database::get_course_table(TABLE_QUIZ_QUESTION);
  64. $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES);
  65. $TBL_TRACK_ATTEMPT_RECORDING= Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
  66. //$nameTools=get_lang('Exercices');
  67. Display::display_header($nameTools,"Exercise");
  68. if(isset($_GET['message'])) {
  69. if (in_array($_GET['message'], array('ExerciseEdited'))) {
  70. $my_message_history=Security::remove_XSS($_GET['message']);
  71. Display::display_confirmation_message(get_lang($my_message_history));
  72. }
  73. }
  74. //event_access_tool(TOOL_QUIZ);
  75. ?>
  76. <div class="actions">
  77. <a href="exercice.php?cidReq=<?php echo $_GET['cidReq'] ?>&show=result"><img src="../img/back.png"/><?php echo get_lang('BackToResultList') ?></a>
  78. </div>
  79. <table class="data_table">
  80. <tr class="row_odd">
  81. <th><?php echo get_lang('Question'); ?></th>
  82. <th width="50px"><?php echo get_lang('Value'); ?></th>
  83. <th><?php echo get_lang('Feedback'); ?></th>
  84. <th width="150px"><?php echo get_lang('Date'); ?></th>
  85. <th ><?php echo get_lang('Author'); ?></th>
  86. </tr>
  87. <?php
  88. //Display::display_introduction_section(TOOL_QUIZ);
  89. /*
  90. $sql = 'SELECT * FROM '.$TBL_EXERCICES;
  91. $query = Database::query($sql);
  92. */
  93. $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 t.insert_date desc,question ASC";
  94. $query = Database::query($sql);
  95. while($row = Database::fetch_array($query)){
  96. echo '<tr';
  97. if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"';
  98. echo '>';
  99. echo '<td>'.$row['question'].'</td>';
  100. echo '<td>'.$row['marks'].'</td>';
  101. if(!empty($row['teacher_comment'])){
  102. echo '<td>'.$row['teacher_comment'].'</td>';
  103. } else {
  104. echo '<td>'.get_lang('WithoutComment').'</td>';
  105. }
  106. echo '<td>'.$row['insert_date'].'</td>';
  107. echo '<td>'.(empty($row['firstname']) && empty($row['lastname']) ? '<i>'.get_lang('OriginalValue').'</i>' : api_get_person_name($row['firstname'], $row['lastname'])).'</td>';
  108. echo '</tr>';
  109. }
  110. echo '</table>';
  111. Display::display_footer();
  112. ?>