adminhp.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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. * HotPotatoes administration.
  18. * @package dokeos.exercise
  19. * @author Istvan Mandak
  20. * @version $Id: adminhp.php 20089 2009-04-24 21:12:54Z cvargas1 $
  21. */
  22. include('exercise.class.php');
  23. include('question.class.php');
  24. include('answer.class.php');
  25. include('exercise.lib.php');
  26. // name of the language file that needs to be included
  27. $language_file='exercice';
  28. include('../inc/global.inc.php');
  29. $this_section=SECTION_COURSES;
  30. if(isset($_REQUEST["cancel"]))
  31. {
  32. if($_REQUEST["cancel"]==get_lang('Cancel'))
  33. {
  34. header("Location: exercice.php");
  35. }
  36. }
  37. //$is_courseAdmin = $_SESSION['is_courseAdmin'];
  38. $newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
  39. $hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_REQUEST['hotpotatoesName']:'');
  40. // answer types
  41. define(UNIQUE_ANSWER, 1);
  42. define(MULTIPLE_ANSWER, 2);
  43. define(FILL_IN_BLANKS, 3);
  44. define(MATCHING, 4);
  45. define(FREE_ANSWER, 5);
  46. define(MULTIPLE_ANSWER_COMBINATION, 6);
  47. // allows script inclusions
  48. define(ALLOWED_TO_INCLUDE,1);
  49. $is_allowedToEdit=api_is_allowed_to_edit(null,true);
  50. // document path
  51. $documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  52. // picture path
  53. $picturePath=$documentPath.'/images';
  54. // audio path
  55. $audioPath=$documentPath.'/audio';
  56. // Database table definitions
  57. $TBL_EXERCICE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
  58. $TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
  59. $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
  60. $TBL_REPONSES = Database::get_course_table(TABLE_QUIZ_ANSWER);
  61. $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
  62. $dbTable = $TBL_DOCUMENT;
  63. if(!$is_allowedToEdit)
  64. {
  65. api_not_allowed(true);
  66. }
  67. if (isset($_SESSION['gradebook'])){
  68. $gradebook= $_SESSION['gradebook'];
  69. }
  70. if (!empty($gradebook) && $gradebook=='view') {
  71. $interbreadcrumb[]= array (
  72. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  73. 'name' => get_lang('ToolGradebook')
  74. );
  75. }
  76. $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
  77. $nameTools = get_lang('adminHP');
  78. Display::display_header($nameTools,"Exercise");
  79. /** @todo probably wrong !!!! */
  80. require_once(api_get_path(SYS_CODE_PATH).'/exercice/hotpotatoes.lib.php');
  81. ?>
  82. <h4>
  83. <?php echo $nameTools; ?>
  84. </h4>
  85. <?php
  86. if(isset($newName))
  87. {
  88. if($newName!="")
  89. {
  90. //alter database record for that test
  91. SetComment($hotpotatoesName,$newName);
  92. echo "<script language='Javascript' type='text/javascript'> window.location='exercice.php'; </script>";
  93. }
  94. }
  95. echo "<form action=\"".api_get_self()."\" method='post' name='form1'>";
  96. echo "<input type=\"hidden\" name=\"hotpotatoesName\" value=\"$hotpotatoesName\">";
  97. echo "<input type=\"text\" name=\"newName\" value=\"";
  98. $lstrComment = "";
  99. $lstrComment = GetComment($hotpotatoesName);
  100. if($lstrComment=="")
  101. $lstrComment = GetQuizName($hotpotatoesName,$documentPath);
  102. if($lstrComment=="")
  103. $lstrComment = basename($hotpotatoesName,$documentPath);
  104. echo $lstrComment;
  105. echo "\" size=40>&nbsp;";
  106. echo "<button type=\"submit\" class=\"save\" name=\"submit\" value=\"".get_lang('Ok')."\">".get_lang('Ok')."</button>";
  107. echo "<button type=\"button\" class=\"cancel\" name=\"cancel\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:document.form1.newName.value='';\">".get_lang('Cancel')."</button>";
  108. echo "</form>";
  109. Display::display_footer();