adminhp.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php // $Id: adminhp.php 9665 2006-10-24 10:43:48Z elixir_inter $
  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. * HOTPOTATOES ADMINISTRATION
  21. * @author Istvan Mandak
  22. * @package dokeos.exercise
  23. */
  24. include('exercise.class.php');
  25. include('question.class.php');
  26. include('answer.class.php');
  27. include('exercise.lib.php');
  28. $langFile='exercice';
  29. include('../inc/global.inc.php');
  30. $this_section=SECTION_COURSES;
  31. if(isset($_REQUEST["cancel"]))
  32. {
  33. if($_REQUEST["cancel"]==get_lang('Cancel'))
  34. {
  35. header("Location: exercice.php");
  36. }
  37. }
  38. //$is_courseAdmin = $_SESSION['is_courseAdmin'];
  39. $newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
  40. $hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_REQUEST['hotpotatoesName']:'');
  41. // answer types
  42. define(UNIQUE_ANSWER, 1);
  43. define(MULTIPLE_ANSWER, 2);
  44. define(FILL_IN_BLANKS, 3);
  45. define(MATCHING, 4);
  46. define(FREE_ANSWER, 5);
  47. // allows script inclusions
  48. define(ALLOWED_TO_INCLUDE,1);
  49. $is_allowedToEdit=$is_courseAdmin;
  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. // tables used in the exercise tool
  57. //$TBL_EXERCICE_QUESTION = $_course['dbNameGlu'].'quiz_rel_test_question';
  58. //$TBL_EXERCICES = $_course['dbNameGlu'].'quiz_test';
  59. //$TBL_QUESTIONS = $_course['dbNameGlu'].'quiz_question';
  60. //$TBL_REPONSES = $_course['dbNameGlu'].'quiz_answer';
  61. //$TBL_DOCUMENT = $_course['dbNameGlu']."document";
  62. $TBL_EXERCICE_QUESTION = Database::get_course_table(QUIZ_TEST_QUESTION_TABLE);
  63. $TBL_EXERCICES = Database::get_course_table(QUIZ_TEST_TABLE);
  64. $TBL_QUESTIONS = Database::get_course_table(QUIZ_QUESTION_TABLE);
  65. $TBL_REPONSES = Database::get_course_table(QUIZ_ANSWER_TABLE);
  66. $TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
  67. //$dbTable = $_course['dbNameGlu']."document";
  68. $dbTable = $TBL_DOCUMENT;
  69. if(!$is_allowedToEdit)
  70. {
  71. api_not_allowed();
  72. }
  73. $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
  74. $nameTools = get_lang('adminHP');
  75. Display::display_header($nameTools,"Exercise");
  76. require_once(api_get_path(SYS_PATH).'claroline/exercice/hotpotatoes.lib.php');
  77. ?>
  78. <h4>
  79. <?php echo $nameTools; ?>
  80. </h4>
  81. <?php
  82. if(isset($newName))
  83. {
  84. if($newName!="")
  85. {
  86. //alter database record for that test
  87. SetComment($hotpotatoesName,$newName);
  88. echo "<script language='Javascript' type='text/javascript'> window.location='exercice.php'; </script>";
  89. }
  90. }
  91. echo "<form action=\"{$_SERVER['PHP_SELF']}\" method='post' name='form1'>";
  92. echo "<input type=\"hidden\" name=\"hotpotatoesName\" value=\"$hotpotatoesName\">";
  93. echo "<input type=\"text\" name=\"newName\" value=\"";
  94. $lstrComment = "";
  95. $lstrComment = GetComment($hotpotatoesName);
  96. if($lstrComment=="")
  97. $lstrComment = GetQuizName($hotpotatoesName,$documentPath);
  98. if($lstrComment=="")
  99. $lstrComment = GetFileName($hotpotatoesName,$documentPath);
  100. echo $lstrComment;
  101. echo "\" size=40>&nbsp;";
  102. echo "<input type=\"submit\" name=\"submit\" value=\"".get_lang('Ok')."\">&nbsp;";
  103. echo "<input type=\"button\" name=\"cancel\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:document.form1.newName.value='';\">";
  104. echo "</form>";
  105. ?>
  106. <?php
  107. Display::display_footer();
  108. ?>