question_list_admin.inc.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php // $Id: question_list_admin.inc.php 20810 2009-05-18 21:16:22Z cfasanando $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004-2008 Dokeos SPRL
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) various contributors
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /**
  21. * Code library for HotPotatoes integration.
  22. * @package dokeos.exercise
  23. * @author
  24. * @version $Id: question_list_admin.inc.php 20810 2009-05-18 21:16:22Z cfasanando $
  25. */
  26. /**
  27. ==============================================================================
  28. * QUESTION LIST ADMINISTRATION
  29. *
  30. * This script allows to manage the question list
  31. * It is included from the script admin.php
  32. *
  33. * @author Olivier Brouckaert
  34. * @package dokeos.exercise
  35. ==============================================================================
  36. */
  37. // ALLOWED_TO_INCLUDE is defined in admin.php
  38. if(!defined('ALLOWED_TO_INCLUDE'))
  39. {
  40. exit();
  41. }
  42. // moves a question up in the list
  43. if(isset($_GET['moveUp']))
  44. {
  45. $objExercise->moveUp(intval($_GET['moveUp']));
  46. $objExercise->save();
  47. }
  48. // moves a question down in the list
  49. if(isset($_GET['moveDown']))
  50. {
  51. $objExercise->moveDown(intval($_GET['moveDown']));
  52. $objExercise->save();
  53. }
  54. // deletes a question from the exercise (not from the data base)
  55. if($deleteQuestion)
  56. {
  57. // if the question exists
  58. if($objQuestionTmp = Question::read($deleteQuestion))
  59. {
  60. $objQuestionTmp->delete($exerciseId);
  61. // if the question has been removed from the exercise
  62. if($objExercise->removeFromList($deleteQuestion))
  63. {
  64. $nbrQuestions--;
  65. }
  66. }
  67. // destruction of the Question object
  68. unset($objQuestionTmp);
  69. }
  70. echo '<div class="actionsbig">';
  71. //we filter the type of questions we can add
  72. Question :: display_type_menu ($objExercise->feedbacktype);
  73. echo '</div>';
  74. ?>
  75. <div class="content_table"><table class="data_table">
  76. <span class="row_odd">
  77. <th><?php echo get_lang('Question'); ?></th>
  78. <th><?php echo get_lang('Type');?></th>
  79. <th><?php echo get_lang('Difficulty'); ?></th>
  80. <!--<th><?php //echo get_lang('Export'); ?></th>-->
  81. <th><?php echo get_lang('Modify'); ?></th>
  82. </span>
  83. <?php
  84. if($nbrQuestions) {
  85. $questionList=$objExercise->selectQuestionList();
  86. $i=1;
  87. if (is_array($questionList)) {
  88. foreach($questionList as $id) {
  89. $objQuestionTmp = Question :: read($id);
  90. //showQuestion($id);
  91. ?>
  92. <tr <?php if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"'; ?>>
  93. <td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td>
  94. <td><?php eval('echo get_lang('.get_class($objQuestionTmp).'::$explanationLangVar);'); ?></td>
  95. <td align="center"><?php echo $objQuestionTmp->selectLevel(); ?></td>
  96. <td>
  97. <a href="<?php echo api_get_self(); ?>?myid=1&editQuestion=<?php echo $id; ?>"><img src="../img/edit.gif" border="0" alt="<?php echo get_lang('Modify'); ?>" /></a>
  98. <a href="<?php echo api_get_self(); ?>?deleteQuestion=<?php echo $id; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(api_htmlentities(get_lang('ConfirmYourChoice'))); ?>')) return false;"><img src="../img/delete.gif" border="0" alt="<?php echo get_lang('Delete'); ?>" /></a>
  99. <?php if($i != 1) { ?>
  100. <a href="<?php echo api_get_self(); ?>?moveUp=<?php echo $id; ?>"><img src="../img/up.gif" border="0" alt="<?php echo get_lang('MoveUp'); ?>"></a>
  101. <?php if($i == $nbrQuestions) {
  102. echo '<img src="../img/down_na.gif">';
  103. }
  104. }
  105. if($i != $nbrQuestions) {
  106. if($i == 1){
  107. echo '<img src="../img/up_na.gif">';
  108. }
  109. ?>
  110. <a href="<?php echo api_get_self(); ?>?moveDown=<?php echo $id; ?>"><img src="../img/down.gif" border="0" alt="<?php echo get_lang('MoveDown'); ?>"></a>
  111. <?php } ?>
  112. </td>
  113. <?php
  114. $i++;
  115. unset($objQuestionTmp);
  116. ?>
  117. </tr>
  118. <?php
  119. }
  120. }
  121. }
  122. ?>
  123. </table></div>
  124. <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
  125. <?php
  126. if(!$i) {
  127. ?>
  128. <tr>
  129. <td><?php echo get_lang('NoQuestion'); ?></td>
  130. </tr>
  131. <?php
  132. }
  133. ?>
  134. </table>