lp_admin_view.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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. $language_file = "learnpath";
  51. /*
  52. -----------------------------------------------------------
  53. Constants and variables
  54. -----------------------------------------------------------
  55. */
  56. $is_allowed_to_edit = api_is_allowed_to_edit();
  57. $tbl_lp = Database::get_course_table('lp');
  58. $tbl_lp_item = Database::get_course_table('lp_item');
  59. $tbl_lp_view = Database::get_course_table('lp_view');
  60. $isStudentView = (int) $_REQUEST['isStudentView'];
  61. $learnpath_id = (int) $_REQUEST['lp_id'];
  62. $submit = $_POST['submit_button'];
  63. /*
  64. $chapter_id = $_GET['chapter_id'];
  65. $title = $_POST['title'];
  66. $description = $_POST['description'];
  67. $Submititem = $_POST['Submititem'];
  68. $action = $_REQUEST['action'];
  69. $id = (int) $_REQUEST['id'];
  70. $type = $_REQUEST['type'];
  71. $direction = $_REQUEST['direction'];
  72. $moduleid = $_REQUEST['moduleid'];
  73. $prereq = $_REQUEST['prereq'];
  74. $type = $_REQUEST['type'];
  75. */
  76. /*
  77. ==============================================================================
  78. MAIN CODE
  79. ==============================================================================
  80. */
  81. // using the resource linker as a tool for adding resources to the learning path
  82. if ($action=="add" and $type=="learnpathitem")
  83. {
  84. $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>";
  85. }
  86. if ( (! $is_allowed_to_edit) or ($isStudentView) )
  87. {
  88. error_log('New LP - User not authorized in lp_admin_view.php');
  89. header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  90. }
  91. //from here on, we are admin because of the previous condition, so don't check anymore
  92. $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
  93. $result=api_sql_query($sql_query);
  94. $therow=Database::fetch_array($result);
  95. //$admin_output = '';
  96. /*
  97. -----------------------------------------------------------
  98. Course admin section
  99. - all the functions not available for students - always available in this case (page only shown to admin)
  100. -----------------------------------------------------------
  101. */
  102. /*==================================================
  103. SHOWING THE ADMIN TOOLS
  104. ==================================================*/
  105. /*==================================================
  106. prerequisites setting end
  107. ==================================================*/
  108. $interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path"));
  109. $interbreadcrumb[]= array ("url"=>api_get_self()."?action=admin_view&lp_id=$learnpath_id", "name" => stripslashes("{$therow['name']}"));
  110. //Theme calls
  111. $show_learn_path=true;
  112. $lp_theme_css=$_SESSION['oLP']->get_theme();
  113. Display::display_header(null,'Path');
  114. //api_display_tool_title($therow['name']);
  115. $suredel = get_lang('AreYouSureToDelete');
  116. $suredelstep = get_lang('AreYouSureToDeleteSteps');
  117. ?>
  118. <script type='text/javascript'>
  119. /* <![CDATA[ */
  120. function confirmation (name)
  121. {
  122. 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')
  123. {
  124. if (confirm("<?php echo $suredel; ?> "+ name + " <?php echo $suredelstep;?>?"))
  125. {return true;}
  126. else
  127. {return false;}
  128. }
  129. else
  130. {
  131. if (confirm("<?php echo $suredel; ?> "+ name + "?"))
  132. {return true;}
  133. else
  134. {return false;}
  135. }
  136. }
  137. </script>
  138. <?php
  139. /*
  140. -----------------------------------------------------------
  141. DISPLAY SECTION
  142. -----------------------------------------------------------
  143. */
  144. switch($_GET['action'])
  145. {
  146. case 'edit_item':
  147. if(isset($is_success) && $is_success === true)
  148. {
  149. echo '<div class="lp_message">';
  150. echo get_lang("_learnpath_item_edited");
  151. echo '</div>';
  152. }
  153. else
  154. {
  155. echo $_SESSION['oLP']->display_edit_item($_GET['id']);
  156. }
  157. break;
  158. case 'delete_item':
  159. if(isset($is_success) && $is_success === true)
  160. {
  161. echo '<div class="lp_message">';
  162. echo get_lang("_learnpath_item_deleted");
  163. echo '</div>';
  164. }
  165. break;
  166. }
  167. echo $_SESSION['oLP']->overview();
  168. /*
  169. ==============================================================================
  170. FOOTER
  171. ==============================================================================
  172. */
  173. Display::display_footer();
  174. ?>