adminhp.php 2.8 KB

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