adminhp.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * HotPotatoes administration.
  5. *
  6. * @package chamilo.exercise
  7. *
  8. * @author Istvan Mandak
  9. */
  10. require_once __DIR__.'/../inc/global.inc.php';
  11. $this_section = SECTION_COURSES;
  12. api_protect_course_script(true);
  13. $_course = api_get_course_info();
  14. if (isset($_REQUEST["cancel"])) {
  15. if ($_REQUEST["cancel"] == get_lang('Cancel')) {
  16. header("Location: exercise.php");
  17. exit;
  18. }
  19. }
  20. $newName = !empty($_REQUEST['newName']) ? $_REQUEST['newName'] : '';
  21. $hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($_REQUEST['hotpotatoesName']) : '';
  22. $is_allowedToEdit = api_is_allowed_to_edit(null, true);
  23. // document path
  24. $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
  25. // picture path
  26. $picturePath = $documentPath.'/images';
  27. // audio path
  28. $audioPath = $documentPath.'/audio';
  29. // Database table definitions
  30. if (!$is_allowedToEdit) {
  31. api_not_allowed(true);
  32. }
  33. if (api_is_in_gradebook()) {
  34. $interbreadcrumb[] = [
  35. 'url' => Category::getUrl(),
  36. 'name' => get_lang('ToolGradebook'),
  37. ];
  38. }
  39. $interbreadcrumb[] = [
  40. "url" => "exercise.php",
  41. "name" => get_lang('Exercises'),
  42. ];
  43. $nameTools = get_lang('adminHP');
  44. Display::display_header($nameTools, "Exercise");
  45. /** @todo probably wrong !!!! */
  46. require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
  47. ?>
  48. <h4>
  49. <?php echo $nameTools; ?>
  50. </h4>
  51. <?php
  52. if (isset($newName)) {
  53. if ($newName != "") {
  54. //alter database record for that test
  55. SetComment($hotpotatoesName, $newName);
  56. echo "<script> window.location='exercise.php'; </script>";
  57. }
  58. }
  59. echo "<form action=\"".api_get_self()."\" method='post' name='form1'>";
  60. echo "<input type=\"hidden\" name=\"hotpotatoesName\" value=\"$hotpotatoesName\">";
  61. echo "<input type=\"text\" name=\"newName\" value=\"";
  62. $lstrComment = '';
  63. $lstrComment = GetComment($hotpotatoesName);
  64. if ($lstrComment == '') {
  65. $lstrComment = GetQuizName($hotpotatoesName, $documentPath);
  66. }
  67. if ($lstrComment == '') {
  68. $lstrComment = basename($hotpotatoesName, $documentPath);
  69. }
  70. echo $lstrComment;
  71. echo "\" size=40>&nbsp;";
  72. echo "<button type=\"submit\" class=\"save\" name=\"submit\" value=\"".get_lang('Ok')."\">".get_lang('Ok')."</button>";
  73. echo "<button type=\"button\" class=\"cancel\" name=\"cancel\" value=\"".get_lang('Cancel')."\" onclick=\"javascript:document.form1.newName.value='';\">".get_lang('Cancel')."</button>";
  74. echo "</form>";
  75. Display::display_footer();