lp_edit_item_prereq.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use ChamiloSession as Session;
  4. /**
  5. * This is a learning path creation and player tool in Chamilo - previously learnpath_handler.php.
  6. *
  7. * @author Patrick Cool
  8. * @author Denes Nagy
  9. * @author Roan Embrechts, refactoring and code cleaning
  10. * @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
  11. *
  12. * @package chamilo.learnpath
  13. */
  14. $this_section = SECTION_COURSES;
  15. api_protect_course_script();
  16. /* Constants and variables */
  17. $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
  18. $isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
  19. $learnpath_id = isset($_REQUEST['lp_id']) ? (int) $_REQUEST['lp_id'] : null;
  20. $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
  21. /* MAIN CODE */
  22. if (!$is_allowed_to_edit || $isStudentView) {
  23. header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  24. exit;
  25. }
  26. // Theme calls.
  27. $show_learn_path = true;
  28. /** @var learnpath $lp */
  29. $lp = Session::read('oLP');
  30. $lp_theme_css = $lp->get_theme();
  31. if (api_is_in_gradebook()) {
  32. $interbreadcrumb[] = [
  33. 'url' => Category::getUrl(),
  34. 'name' => get_lang('Assessments'),
  35. ];
  36. }
  37. $interbreadcrumb[] = [
  38. 'url' => 'lp_controller.php?action=list',
  39. 'name' => get_lang('Learning paths'),
  40. ];
  41. $interbreadcrumb[] = [
  42. 'url' => api_get_self()."?action=build&lp_id=$learnpath_id",
  43. 'name' => $lp->getNameNoTags(),
  44. ];
  45. $interbreadcrumb[] = [
  46. 'url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id&".api_get_cidreq(),
  47. 'name' => get_lang('Add learning object or activity'),
  48. ];
  49. Display::display_header(get_lang('Prerequisites'), 'Path');
  50. $suredel = trim(get_lang('Are you sure to delete'));
  51. ?>
  52. <script>
  53. function stripslashes(str) {
  54. str=str.replace(/\\'/g,'\'');
  55. str=str.replace(/\\"/g,'"');
  56. str=str.replace(/\\\\/g,'\\');
  57. str=str.replace(/\\0/g,'\0');
  58. return str;
  59. }
  60. function confirmation(name) {
  61. name=stripslashes(name);
  62. if (confirm("<?php echo $suredel; ?> " + name + " ?")) {
  63. return true;
  64. } else {
  65. return false;
  66. }
  67. }
  68. </script>
  69. <?php
  70. /* DISPLAY SECTION */
  71. echo $lp->build_action_menu();
  72. echo '<div class="row">';
  73. echo '<div class="col-md-3">';
  74. echo $lp->return_new_tree();
  75. echo '</div>';
  76. echo '<div class="col-md-9">';
  77. echo '<div class="prerequisites">';
  78. $lpItem = new learnpathItem($_GET['id']);
  79. if (isset($is_success) && $is_success == true) {
  80. echo $lp->display_manipulate($_GET['id'], $lpItem->get_type());
  81. echo Display::return_message(get_lang('Prerequisites to the current learning object have been added.'));
  82. } else {
  83. echo $lp->display_manipulate($_GET['id'], $lpItem->get_type());
  84. echo $lp->display_item_prerequisites_form($_GET['id']);
  85. }
  86. echo '</div>';
  87. echo '</div>';
  88. Display::display_footer();