adminhp.php 2.6 KB

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