lp_move_item.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Patrick Cool
  9. Copyright (c) Denes Nagy
  10. Copyright (c) Yannick Warnier
  11. For a full list of contributors, see "credits.txt".
  12. The full license can be read in "license.txt".
  13. This program is free software; you can redistribute it and/or
  14. modify it under the terms of the GNU General Public License
  15. as published by the Free Software Foundation; either version 2
  16. of the License, or (at your option) any later version.
  17. See the GNU General Public License for more details.
  18. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  19. ==============================================================================
  20. */
  21. /**
  22. ==============================================================================
  23. * This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
  24. *
  25. * @author Patrick Cool
  26. * @author Denes Nagy
  27. * @author Roan Embrechts, refactoring and code cleaning
  28. * @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
  29. * @package dokeos.learnpath
  30. ==============================================================================
  31. */
  32. /*
  33. ==============================================================================
  34. INIT SECTION
  35. ==============================================================================
  36. */
  37. $this_section=SECTION_COURSES;
  38. api_protect_course_script();
  39. /*
  40. -----------------------------------------------------------
  41. Libraries
  42. -----------------------------------------------------------
  43. */
  44. //the main_api.lib.php, database.lib.php and display.lib.php
  45. //libraries are included by default
  46. include('learnpath_functions.inc.php');
  47. //include('../resourcelinker/resourcelinker.inc.php');
  48. include('resourcelinker.inc.php');
  49. //rewrite the language file, sadly overwritten by resourcelinker.inc.php
  50. // name of the language file that needs to be included
  51. $language_file = "learnpath";
  52. /*
  53. -----------------------------------------------------------
  54. Header and action code
  55. -----------------------------------------------------------
  56. */
  57. $htmlHeadXtra[] = $_SESSION['oLP']->create_js();
  58. /*
  59. -----------------------------------------------------------
  60. Constants and variables
  61. -----------------------------------------------------------
  62. */
  63. $is_allowed_to_edit = api_is_allowed_to_edit();
  64. $tbl_lp = Database::get_course_table('lp');
  65. $tbl_lp_item = Database::get_course_table('lp_item');
  66. $tbl_lp_view = Database::get_course_table('lp_view');
  67. $isStudentView = (int) $_REQUEST['isStudentView'];
  68. $learnpath_id = (int) $_REQUEST['lp_id'];
  69. $submit = $_POST['submit_button'];
  70. /*
  71. $chapter_id = $_GET['chapter_id'];
  72. $title = $_POST['title'];
  73. $description = $_POST['description'];
  74. $Submititem = $_POST['Submititem'];
  75. $action = $_REQUEST['action'];
  76. $id = (int) $_REQUEST['id'];
  77. $type = $_REQUEST['type'];
  78. $direction = $_REQUEST['direction'];
  79. $moduleid = $_REQUEST['moduleid'];
  80. $prereq = $_REQUEST['prereq'];
  81. $type = $_REQUEST['type'];
  82. */
  83. /*
  84. ==============================================================================
  85. MAIN CODE
  86. ==============================================================================
  87. */
  88. // using the resource linker as a tool for adding resources to the learning path
  89. if ($action=="add" and $type=="learnpathitem")
  90. {
  91. $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>";
  92. }
  93. if ( (! $is_allowed_to_edit) or ($isStudentView) )
  94. {
  95. error_log('New LP - User not authorized in lp_add_item.php');
  96. header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  97. }
  98. //from here on, we are admin because of the previous condition, so don't check anymore
  99. $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
  100. $result=api_sql_query($sql_query);
  101. $therow=Database::fetch_array($result);
  102. //$admin_output = '';
  103. /*
  104. -----------------------------------------------------------
  105. Course admin section
  106. - all the functions not available for students - always available in this case (page only shown to admin)
  107. -----------------------------------------------------------
  108. */
  109. /*==================================================
  110. SHOWING THE ADMIN TOOLS
  111. ==================================================*/
  112. /*==================================================
  113. prerequisites setting end
  114. ==================================================*/
  115. if (isset($_SESSION['gradebook'])){
  116. $gradebook= $_SESSION['gradebook'];
  117. }
  118. if (!empty($gradebook) && $gradebook=='view') {
  119. $interbreadcrumb[]= array (
  120. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  121. 'name' => get_lang('Gradebook')
  122. );
  123. }
  124. $interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path"));
  125. $interbreadcrumb[]= array ("url"=>api_get_self()."?action=build&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
  126. //Theme calls
  127. $show_learn_path=true;
  128. $lp_theme_css=$_SESSION['oLP']->get_theme();
  129. Display::display_header(null,'Path');
  130. //api_display_tool_title($therow['name']);
  131. $suredel = trim(get_lang('AreYouSureToDelete'));
  132. //$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
  133. ?>
  134. <script type='text/javascript'>
  135. /* <![CDATA[ */
  136. function stripslashes(str) {
  137. str=str.replace(/\\'/g,'\'');
  138. str=str.replace(/\\"/g,'"');
  139. str=str.replace(/\\\\/g,'\\');
  140. str=str.replace(/\\0/g,'\0');
  141. return str;
  142. }
  143. function confirmation(name)
  144. {
  145. name=stripslashes(name);
  146. if (confirm("<?php echo $suredel; ?> " + name + " ?"))
  147. {
  148. return true;
  149. }
  150. else
  151. {
  152. return false;
  153. }
  154. }
  155. </script>
  156. <?php
  157. //echo $admin_output;
  158. /*
  159. -----------------------------------------------------------
  160. DISPLAY SECTION
  161. -----------------------------------------------------------
  162. */
  163. echo $_SESSION['oLP']->build_action_menu();
  164. echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
  165. echo '<tr>';
  166. echo '<td class="tree">';
  167. echo '<div class="lp_tree">';
  168. //build the tree with the menu items in it
  169. echo $_SESSION['oLP']->build_tree();
  170. echo '</div>';
  171. echo '</td>';
  172. echo '<td class="workspace">';
  173. if(isset($is_success) && $is_success === true) {
  174. $msg = '<div class="lp_message" style="margin-bottom:10px;">';
  175. $msg .= 'The item has been moved.';
  176. $msg .= '</div>';
  177. echo $_SESSION['oLP']->display_item($_GET['id'], $msg);
  178. } else {
  179. echo $_SESSION['oLP']->display_move_item($_GET['id']);
  180. }
  181. echo '</td>';
  182. echo '</tr>';
  183. echo '</table>';
  184. /*
  185. ==============================================================================
  186. FOOTER
  187. ==============================================================================
  188. */
  189. Display::display_footer();
  190. ?>