adminhp.php 2.8 KB

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