adminhp.php 2.6 KB

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