exercice_history.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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();
  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. //include_once(api_get_path(LIBRARY_PATH).'events.lib.inc.php');
  75. //event_access_tool(TOOL_QUIZ);
  76. ?>
  77. <div class="actions">
  78. <a href="exercice.php?cidReq=<?php echo $_GET['cidReq'] ?>&show=result"><< <?php echo get_lang('Back') ?></a>
  79. </div>
  80. <table class="data_table">
  81. <tr class="row_odd">
  82. <th><?php echo get_lang('Question'); ?></th>
  83. <th width="50px"><?php echo get_lang('Value'); ?></th>
  84. <th><?php echo get_lang('Feedback'); ?></th>
  85. <th width="150px"><?php echo get_lang('Date'); ?></th>
  86. <th ><?php echo get_lang('Author'); ?></th>
  87. </tr>
  88. <?php
  89. //Display::display_introduction_section(TOOL_QUIZ);
  90. /*
  91. $sql = 'SELECT * FROM '.$TBL_EXERCICES;
  92. $query = api_sql_query($sql,__FILE__,__LINE__);
  93. */
  94. $sql = "SELECT *, quiz_question.question, CONCAT(firstname,' ',lastname) as full_name 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";
  95. $query = api_sql_query($sql,__FILE__,__LINE__);
  96. while($row = Database::fetch_array($query)){
  97. echo '<tr';
  98. if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"';
  99. echo '>';
  100. echo '<td>'.$row['question'].'</td>';
  101. echo '<td>'.$row['marks'].'</td>';
  102. if(!empty($row['teacher_comment'])){
  103. echo '<td>'.$row['teacher_comment'].'</td>';
  104. } else {
  105. echo '<td>'.get_lang('WithoutComment').'</td>';
  106. }
  107. echo '<td>'.$row['insert_date'].'</td>';
  108. echo '<td>'.(empty($row['full_name'])?'<i>'.get_lang('OriginalValue').'</i>':$row['full_name']).'</td>';
  109. echo '</tr>';
  110. }
  111. echo '</table>';
  112. Display::display_footer();
  113. ?>