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. if (isset($_REQUEST["cancel"])) {
  12. if ($_REQUEST["cancel"]==get_lang('Cancel')) {
  13. header("Location: exercise.php");
  14. }
  15. }
  16. //$is_courseAdmin = $_SESSION['is_courseAdmin'];
  17. $newName = (!empty($_REQUEST['newName'])?$_REQUEST['newName']:'');
  18. $hotpotatoesName = (!empty($_REQUEST['hotpotatoesName'])?$_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();