lp_edit_item_prereq.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php
  5. *
  6. * @author Patrick Cool
  7. * @author Denes Nagy
  8. * @author Roan Embrechts, refactoring and code cleaning
  9. * @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
  10. * @package chamilo.learnpath
  11. */
  12. $this_section = SECTION_COURSES;
  13. api_protect_course_script();
  14. /* Libraries */
  15. include 'learnpath_functions.inc.php';
  16. //include '../resourcelinker/resourcelinker.inc.php';
  17. include 'resourcelinker.inc.php';
  18. // Rewrite the language file, sadly overwritten by resourcelinker.inc.php.
  19. // Name of the language file that needs to be included.
  20. $language_file = 'learnpath';
  21. /* Constants and variables */
  22. $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
  23. $tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
  24. $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
  25. $tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW);
  26. $isStudentView = (int) $_REQUEST['isStudentView'];
  27. $learnpath_id = (int) $_REQUEST['lp_id'];
  28. $submit = $_POST['submit_button'];
  29. /* MAIN CODE */
  30. // Using the resource linker as a tool for adding resources to the learning path.
  31. if ($action == 'add' and $type == 'learnpathitem') {
  32. $htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
  33. }
  34. if ((! $is_allowed_to_edit) || ($isStudentView)) {
  35. error_log('New LP - User not authorized in lp_edit_item_prereq.php');
  36. header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  37. }
  38. $course_id = api_get_course_int_id();
  39. $sql_query = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND id = $learnpath_id";
  40. $result = Database::query($sql_query);
  41. $therow = Database::fetch_array($result);
  42. /* SHOWING THE ADMIN TOOLS */
  43. if (isset($_SESSION['gradebook'])){
  44. $gradebook = $_SESSION['gradebook'];
  45. }
  46. if (!empty($gradebook) && $gradebook == 'view') {
  47. $interbreadcrumb[] = array (
  48. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  49. 'name' => get_lang('ToolGradebook')
  50. );
  51. }
  52. $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
  53. $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}"));
  54. // Theme calls.
  55. $show_learn_path = true;
  56. $lp_theme_css = $_SESSION['oLP']->get_theme();
  57. Display::display_header(null,'Path');
  58. //api_display_tool_title($therow['name']);
  59. $suredel = trim(get_lang('AreYouSureToDelete'));
  60. //$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
  61. ?>
  62. <script type='text/javascript'>
  63. /* <![CDATA[ */
  64. function stripslashes(str) {
  65. str=str.replace(/\\'/g,'\'');
  66. str=str.replace(/\\"/g,'"');
  67. str=str.replace(/\\\\/g,'\\');
  68. str=str.replace(/\\0/g,'\0');
  69. return str;
  70. }
  71. function confirmation(name)
  72. {
  73. name=stripslashes(name);
  74. if (confirm("<?php echo $suredel; ?> " + name + " ?"))
  75. {
  76. return true;
  77. }
  78. else
  79. {
  80. return false;
  81. }
  82. }
  83. </script>
  84. <?php
  85. //echo $admin_output;
  86. /* DISPLAY SECTION */
  87. echo $_SESSION['oLP']->build_action_menu();
  88. echo '<div class="row-fluid">';
  89. echo '<div class="span3">';
  90. echo '<div class="lp_tree">';
  91. // Build the tree with the menu items in it.
  92. echo $_SESSION['oLP']->build_tree();
  93. echo '</div>';
  94. echo '</div>';
  95. echo '<div class="span9">';
  96. if (isset($is_success) && $is_success === true) {
  97. echo '<div class="lp_message" style="margin:3px 10px;">';
  98. echo get_lang("PrerequisitesAdded");
  99. echo '</div>';
  100. } else {
  101. echo $_SESSION['oLP']->display_manipulate($_GET['id'], null);
  102. echo $_SESSION['oLP']->display_item_prerequisites_form($_GET['id']);
  103. }
  104. echo '</div>';
  105. /* FOOTER */
  106. Display::display_footer();