adminhp.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. // name of the language file that needs to be included
  10. $language_file='exercice';
  11. require_once '../inc/global.inc.php';
  12. $this_section=SECTION_COURSES;
  13. if (isset($_REQUEST["cancel"])) {
  14. if ($_REQUEST["cancel"]==get_lang('Cancel')) {
  15. header("Location: exercice.php");
  16. }
  17. }
  18. //$is_courseAdmin = $_SESSION['is_courseAdmin'];
  19. $newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
  20. $hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_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 (isset($_SESSION['gradebook'])) {
  33. $gradebook= $_SESSION['gradebook'];
  34. }
  35. if (!empty($gradebook) && $gradebook=='view') {
  36. $interbreadcrumb[]= array (
  37. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  38. 'name' => get_lang('ToolGradebook')
  39. );
  40. }
  41. $interbreadcrumb[]=array("url" => "exercice.php","name" => get_lang('Exercices'));
  42. $nameTools = get_lang('adminHP');
  43. Display::display_header($nameTools,"Exercise");
  44. /** @todo probably wrong !!!! */
  45. require_once(api_get_path(SYS_CODE_PATH).'/exercice/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 language='Javascript' type='text/javascript'> window.location='exercice.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();