adminhp.php 3.3 KB

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