question_list_admin.inc.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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 des Palais 44 Paleizenstraat
  13. B-1030 Brussels - Belgium
  14. Tel. +32 (2) 211 34 56
  15. */
  16. /**
  17. * Code library for HotPotatoes integration.
  18. * @package dokeos.exercise
  19. * @author
  20. * @version $Id: question_list_admin.inc.php 13188 2007-09-22 05:36:41Z yannoo $
  21. */
  22. /**
  23. ==============================================================================
  24. * QUESTION LIST ADMINISTRATION
  25. *
  26. * This script allows to manage the question list
  27. * It is included from the script admin.php
  28. *
  29. * @author Olivier Brouckaert
  30. * @package dokeos.exercise
  31. ==============================================================================
  32. */
  33. // ALLOWED_TO_INCLUDE is defined in admin.php
  34. if(!defined('ALLOWED_TO_INCLUDE'))
  35. {
  36. exit();
  37. }
  38. // moves a question up in the list
  39. if(isset($_GET['moveUp']))
  40. {
  41. $objExercise->moveUp(intval($_GET['moveUp']));
  42. $objExercise->save();
  43. }
  44. // moves a question down in the list
  45. if(isset($_GET['moveDown']))
  46. {
  47. $objExercise->moveDown(intval($_GET['moveDown']));
  48. $objExercise->save();
  49. }
  50. // deletes a question from the exercise (not from the data base)
  51. if($deleteQuestion)
  52. {
  53. // if the question exists
  54. if($objQuestionTmp = Question::read($deleteQuestion))
  55. {
  56. $objQuestionTmp->delete($exerciseId);
  57. // if the question has been removed from the exercise
  58. if($objExercise->removeFromList($deleteQuestion))
  59. {
  60. $nbrQuestions--;
  61. }
  62. }
  63. // destruction of the Question object
  64. unset($objQuestionTmp);
  65. }
  66. Question :: display_type_menu ();
  67. ?>
  68. <table class="data_table">
  69. <tr class="row_odd" bgcolor='#e6e6e6'><th><b><?php echo get_lang('Question'); ?></b></th>
  70. <th><b><?php echo get_lang('Type');?></b></th>
  71. <th><b><?php echo get_lang('Export'); ?></b></th>
  72. <th><b><?php echo get_lang('Modify'); ?></b></th>
  73. </tr>
  74. <?php
  75. if($nbrQuestions)
  76. {
  77. $questionList=$objExercise->selectQuestionList();
  78. $i=1;
  79. foreach($questionList as $id)
  80. {
  81. $objQuestionTmp = Question :: read($id);
  82. //showQuestion($id);
  83. ?>
  84. <tr <?php if($i%2==0) echo 'class="row_odd"'; else echo 'class="row_even"'; ?>>
  85. <td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td> <td><?php eval('echo get_lang('.get_class($objQuestionTmp).'::$explanationLangVar);'); ?></td>
  86. <td align="center"><a href="<?php echo api_get_self(); ?>?action=exportqti2&questionId=<?php echo $id; ?>"><img src="../img/export.png" border="0" align="absmiddle" alt="IMS/QTI" /></a></td>
  87. <td> <a href="<?php echo api_get_self(); ?>?myid=1&editQuestion=<?php echo $id; ?>"><img src="../img/edit.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Modify'); ?>" /></a> <a href="<?php echo api_get_self(); ?>?deleteQuestion=<?php echo $id; ?>" onclick="javascript:if(!confirm('<?php echo addslashes(htmlentities(get_lang('ConfirmYourChoice'))); ?>')) return false;"><img src="../img/delete.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Delete'); ?>" /></a>
  88. <?php
  89. if($i != 1)
  90. {
  91. ?>
  92. <a href="<?php echo api_get_self(); ?>?moveUp=<?php echo $id; ?>"><img src="../img/up.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveUp'); ?>"></a>
  93. <?php
  94. }
  95. if($i != $nbrQuestions)
  96. {
  97. ?>
  98. <a href="<?php echo api_get_self(); ?>?moveDown=<?php echo $id; ?>"><img src="../img/down.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveDown'); ?>"></a>
  99. <?php
  100. }
  101. ?>
  102. </td>
  103. <?php
  104. $i++;
  105. unset($objQuestionTmp);
  106. ?>
  107. </tr>
  108. <?php
  109. }
  110. }
  111. ?>
  112. </table>
  113. <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
  114. <?php
  115. if(!$i)
  116. {
  117. ?>
  118. <tr>
  119. <td><?php echo get_lang('NoQuestion'); ?></td>
  120. </tr>
  121. <?php
  122. }
  123. ?>
  124. </table>