adminhp.php 2.4 KB

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