kevin_lp_move_item.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. // setting the language file
  38. //$langFile = "learnpath";
  39. //require_once('back_compat.inc.php');
  40. $this_section=SECTION_COURSES;
  41. api_protect_course_script();
  42. /*
  43. -----------------------------------------------------------
  44. Libraries
  45. -----------------------------------------------------------
  46. */
  47. //the main_api.lib.php, database.lib.php and display.lib.php
  48. //libraries are included by default
  49. include('learnpath_functions.inc.php');
  50. //include('../resourcelinker/resourcelinker.inc.php');
  51. include('resourcelinker.inc.php');
  52. //rewrite the language file, sadly overwritten by resourcelinker.inc.php
  53. $langFile = "learnpath";
  54. /*
  55. -----------------------------------------------------------
  56. Header and action code
  57. -----------------------------------------------------------
  58. */
  59. $htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='../css/learnpath.css' />";
  60. $htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='learnpath.css' />"; //will be a merged with original learnpath.css
  61. $htmlHeadXtra[] = "<link rel='stylesheet' type='text/css' href='dtree.css' />"; //will be moved
  62. $htmlHeadXtra[] = "<script src='dtree.js' type='text/javascript'></script>"; //will be moved
  63. $htmlHeadXtra[] = $_SESSION['oLP']->create_js();
  64. /*
  65. -----------------------------------------------------------
  66. Constants and variables
  67. -----------------------------------------------------------
  68. */
  69. $is_allowed_to_edit = api_is_allowed_to_edit();
  70. $tbl_lp = Database::get_course_table('lp');
  71. $tbl_lp_item = Database::get_course_table('lp_item');
  72. $tbl_lp_view = Database::get_course_table('lp_view');
  73. $isStudentView = (int) $_REQUEST['isStudentView'];
  74. $learnpath_id = (int) $_REQUEST['lp_id'];
  75. $submit = $_POST['submit_button'];
  76. /*
  77. $chapter_id = $_GET['chapter_id'];
  78. $title = $_POST['title'];
  79. $description = $_POST['description'];
  80. $Submititem = $_POST['Submititem'];
  81. $action = $_REQUEST['action'];
  82. $id = (int) $_REQUEST['id'];
  83. $type = $_REQUEST['type'];
  84. $direction = $_REQUEST['direction'];
  85. $moduleid = $_REQUEST['moduleid'];
  86. $prereq = $_REQUEST['prereq'];
  87. $type = $_REQUEST['type'];
  88. */
  89. /*
  90. ==============================================================================
  91. MAIN CODE
  92. ==============================================================================
  93. */
  94. // using the resource linker as a tool for adding resources to the learning path
  95. if ($action=="add" and $type=="learnpathitem")
  96. {
  97. $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>";
  98. }
  99. if ( (! $is_allowed_to_edit) or ($isStudentView) )
  100. {
  101. error_log('New LP - User not authorized in lp_add_item.php');
  102. header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  103. }
  104. //from here on, we are admin because of the previous condition, so don't check anymore
  105. $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
  106. $result=api_sql_query($sql_query);
  107. $therow=Database::fetch_array($result);
  108. //$admin_output = '';
  109. /*
  110. -----------------------------------------------------------
  111. Course admin section
  112. - all the functions not available for students - always available in this case (page only shown to admin)
  113. -----------------------------------------------------------
  114. */
  115. /*==================================================
  116. SHOWING THE ADMIN TOOLS
  117. ==================================================*/
  118. /*==================================================
  119. prerequisites setting end
  120. ==================================================*/
  121. $interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path"));
  122. $interbreadcrumb[]= array ("url"=>$_SERVER['PHP_SELF']."?action=admin_view&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
  123. Display::display_header(null,'Path');
  124. //api_display_tool_title($therow['name']);
  125. $suredel = get_lang('AreYouSureToDelete');
  126. $suredelstep = get_lang('AreYouSureToDeleteSteps');
  127. ?>
  128. <script type='text/javascript'>
  129. /* <![CDATA[ */
  130. function confirmation (name)
  131. {
  132. if (name!='Users' && name!='Assignments' && name!='Document' && name!='Forum' && name!='Agenda' && name!='Groups' && name!='Link _self' && name!='Dropbox' && name!='Course_description' && name!='Exercise' && name!='Introduction_text')
  133. {
  134. if (confirm("<?php echo $suredel; ?> "+ name + " <?php echo $suredelstep;?>?"))
  135. {return true;}
  136. else
  137. {return false;}
  138. }
  139. else
  140. {
  141. if (confirm("<?php echo $suredel; ?> "+ name + "?"))
  142. {return true;}
  143. else
  144. {return false;}
  145. }
  146. }
  147. </script>
  148. <?php
  149. //echo $admin_output;
  150. /*
  151. -----------------------------------------------------------
  152. DISPLAY SECTION
  153. -----------------------------------------------------------
  154. */
  155. echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
  156. echo '<tr>';
  157. echo '<td class="tree">';
  158. echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"><a href="' . $_SERVER['PHP_SELF'] . '?cidReq=' . $_GET['cidReq'] . '&amp;action=admin_view&amp;lp_id=' . $_SESSION['oLP']->lp_id . '">Basic overview</a></p>';
  159. //links for adding a module, chapter or step
  160. echo '<div class="lp_actions">';
  161. echo '<p class="lp_action">';
  162. echo '<a href="' . $_SERVER['PHP_SELF'] . '?cidReq=' . $_GET['cidReq'] . '&amp;action=add_item&amp;type=module&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="New module"><img align="left" alt="New module" src="img/lp_dokeos_module_add.png" title="New module" />New module</a>';
  163. echo '</p>';
  164. echo '<p class="lp_action">';
  165. echo '<a href="' . $_SERVER['PHP_SELF'] . '?cidReq=' . $_GET['cidReq'] . '&amp;action=add_item&amp;type=chapter&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="New chapter"><img align="left" alt="New chapter" src="img/lp_dokeos_chapter_add.png" title="New chapter" />New chapter</a>';
  166. echo '</p>';
  167. echo '<p class="lp_action">';
  168. echo '<a href="' . $_SERVER['PHP_SELF'] . '?cidReq=' . $_GET['cidReq'] . '&amp;action=add_item&amp;type=step&amp;lp_id=' . $_SESSION['oLP']->lp_id . '" title="New step"><img align="left" alt="New step" src="img/lp_dokeos_step_add.png" title="New step" />New step</a>';
  169. echo '</p>';
  170. echo '</div>';
  171. echo '<div class="lp_tree">';
  172. //build the tree with the menu items in it
  173. echo $_SESSION['oLP']->build_tree();
  174. echo '</div>';
  175. echo '</td>';
  176. echo '<td class="workspace">';
  177. if(isset($is_success) && $is_success === true)
  178. {
  179. $msg = '<div class="lp_message" style="margin-bottom:10px;">';
  180. $msg .= 'The item has been moved.';
  181. $msg .= '</div>';
  182. echo $_SESSION['oLP']->display_item($_GET['id'], $msg);
  183. }
  184. else
  185. {
  186. echo $_SESSION['oLP']->display_move_item($_GET['id']);
  187. }
  188. echo '</td>';
  189. echo '</tr>';
  190. echo '</table>';
  191. /*
  192. ==============================================================================
  193. FOOTER
  194. ==============================================================================
  195. */
  196. Display::display_footer();
  197. ?>