question_list_admin.inc.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?php // $Id: question_list_admin.inc.php 9775 2006-10-25 15:25:11Z yannoo $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  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: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * QUESTION LIST ADMINISTRATION
  22. *
  23. * This script allows to manage the question list
  24. * It is included from the script admin.php
  25. *
  26. * @author Olivier Brouckaert
  27. * @package dokeos.exercise
  28. ==============================================================================
  29. */
  30. // ALLOWED_TO_INCLUDE is defined in admin.php
  31. if(!defined('ALLOWED_TO_INCLUDE'))
  32. {
  33. exit();
  34. }
  35. // moves a question up in the list
  36. if($moveUp)
  37. {
  38. $objExercise->moveUp($moveUp);
  39. $objExercise->save();
  40. }
  41. // moves a question down in the list
  42. if($moveDown)
  43. {
  44. $objExercise->moveDown($moveDown);
  45. $objExercise->save();
  46. }
  47. // deletes a question from the exercise (not from the data base)
  48. if($deleteQuestion)
  49. {
  50. // construction of the Question object
  51. $objQuestionTmp=new Question();
  52. // if the question exists
  53. if($objQuestionTmp->read($deleteQuestion))
  54. {
  55. $objQuestionTmp->delete($exerciseId);
  56. // if the question has been removed from the exercise
  57. if($objExercise->removeFromList($deleteQuestion))
  58. {
  59. $nbrQuestions--;
  60. }
  61. }
  62. // destruction of the Question object
  63. unset($objQuestionTmp);
  64. }
  65. ?>
  66. <hr size="1" noshade="noshade">
  67. <a href="question_pool.php?fromExercise=<?php echo $exerciseId; ?>"><?php echo get_lang('GetExistingQuestion'); ?></a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; <!--<a href="exercice.php?<?php echo api_get_cidreq(); ?>"><?php echo get_lang('backtoTesthome'); ?></a>--><br />
  68. <br /><?php echo get_lang('NewQu').' : ';?> <a href="admin.php?newQuestion=yes&answerType=1"><?php echo get_lang('UniqueSelect'); ?> </a>|<a href="admin.php?newQuestion=yes&answerType=2"> <?php echo get_lang('MultipleSelect'); ?> | </a> <a href="admin.php?newQuestion=yes&answerType=3"><?php echo get_lang('FillBlanks'); ?>| </a><a href="admin.php?newQuestion=yes&answerType=4"><?php echo get_lang('Matching'); ?>| </a>
  69. <a href="admin.php?newQuestion=yes&answerType=5"><?php echo get_lang('freeAnswer'); ?> </a> | </a>
  70. <a href="admin.php?newQuestion=yes&answerType=6"><?php echo get_lang('Hotspot'); ?> </a>
  71. &nbsp;&nbsp;
  72. <br /><br />
  73. <!--<form method="get" action="exercice.php" style="margin:10px; margin-left:0px;">
  74. <input type="submit" value="<?php //echo htmlentities(get_lang('FinishTest')); ?>">
  75. </form>-->
  76. <?php //echo get_lang('QuestionList'); ?>
  77. <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
  78. <tr bgcolor='#e6e6e6'><td width="20%" align="center"><b><?php echo get_lang('Question'); ?></b></td>
  79. <td width="20%" align="center"><b><?php echo get_lang('Type');?></b></td>
  80. <!--<td width="20%" align="center"><b><?php echo get_lang('Addlimits'); ?> </b><br /> (time,attempts)</td>-->
  81. <td width="20%" align="center"><b><?php echo get_lang('Feedback'); ?> </b></td>
  82. <td width="20%" align="center"><b><?php echo get_lang('Modify'); ?></b></td>
  83. </tr>
  84. <?php
  85. if($nbrQuestions)
  86. {
  87. $questionList=$objExercise->selectQuestionList();
  88. $i=1;
  89. foreach($questionList as $id)
  90. {
  91. $objQuestionTmp=new Question();
  92. $objQuestionTmp->read($id);
  93. //showQuestion($id);
  94. ?>
  95. <tr>
  96. <td width="20%"><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?></td> <td width="20%"><?php echo $aType[$objQuestionTmp->selectType()-1]; ?></td>
  97. <!--<td width="20%" align="center"><a href="#"> <img src="../img/test_prop.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Addlimits'); ?>" /></a> </td>--> <td width="20%" align="center"> <a href="feedback.php?question=<?php echo $id;?>"><img src="../img/feedback.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Feedback'); ?>" /></a> </td>
  98. <td> <a href="<?php echo $_SERVER['PHP_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 $_SERVER['PHP_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>
  99. <?php
  100. if($i != 1)
  101. {
  102. ?>
  103. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?moveUp=<?php echo $id; ?>"><img src="../img/up.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveUp'); ?>"></a>
  104. <?php
  105. }
  106. if($i != $nbrQuestions)
  107. {
  108. ?>
  109. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?moveDown=<?php echo $id; ?>"><img src="../img/down.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveDown'); ?>"></a>
  110. <?php
  111. }
  112. ?>
  113. </td>
  114. <?php
  115. $i++;
  116. unset($objQuestionTmp);
  117. ?>
  118. </tr>
  119. <?php }
  120. }
  121. ?>
  122. </table>
  123. <table border="0" align="center" cellpadding="2" cellspacing="2" width="100%">
  124. <?php /*
  125. if($nbrQuestions)
  126. {
  127. $questionList=$objExercise->selectQuestionList();
  128. $i=1;
  129. //echo "<pre>";
  130. // print_r($questionList);
  131. //echo "</pre>";
  132. foreach($questionList as $id)
  133. {
  134. $objQuestionTmp=new Question();
  135. $objQuestionTmp->read($id);
  136. $s="<tr bgcolor='#e6e6e6'>
  137. <td valign='top' colspan='2'>
  138. ".get_lang('Question')." ";
  139. $s.=$i;
  140. if($exerciseType == 2) $s.=' / '.$nbrQuestions;
  141. //$s.="<a href=".$_SERVER['PHP_SELF']."?editQuestion=".$id."><img src='../img/edit.gif' border='0' align='absmiddle' alt=".get_lang('Modify')."></a>";
  142. $s.='</td></tr>';
  143. echo $s;
  144. showQuestion($id);
  145. ?> <!--<tr>
  146. <td><?php echo "$i. ".$objQuestionTmp->selectTitle(); ?><br><?php echo $aType[$objQuestionTmp->selectType()-1]; ?></td>
  147. </tr>
  148. <tr>-->
  149. <tr><td><table>
  150. <tr>
  151. <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?myid=1&editQuestion=<?php echo $id; ?>"><img src="../img/edit.gif" border="0" align="absmiddle" alt="<?php echo get_lang('Modify'); ?>" /></a></td>
  152. <td><a href="<?php echo $_SERVER['PHP_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></td>
  153. <?php
  154. if($i != 1)
  155. {
  156. ?>
  157. <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?moveUp=<?php echo $id; ?>"><img src="../img/up.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveUp'); ?>"></a></td>
  158. <?php
  159. }
  160. if($i != $nbrQuestions)
  161. {
  162. ?>
  163. <td>
  164. <a href="<?php echo $_SERVER['PHP_SELF']; ?>?moveDown=<?php echo $id; ?>"><img src="../img/down.gif" border="0" align="absmiddle" alt="<?php echo get_lang('MoveDown'); ?>"></a></td>
  165. <?php
  166. }
  167. ?>
  168. </tr>
  169. </table>
  170. </td>
  171. </tr>
  172. <?php
  173. $i++;
  174. unset($objQuestionTmp);
  175. }
  176. }
  177. */
  178. if(!$i)
  179. {
  180. ?>
  181. <tr>
  182. <td><?php echo get_lang('NoQuestion'); ?></td>
  183. </tr>
  184. <?php
  185. }
  186. ?>
  187. </table>