kevin_lp_add.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. /*
  63. -----------------------------------------------------------
  64. Constants and variables
  65. -----------------------------------------------------------
  66. */
  67. $is_allowed_to_edit = api_is_allowed_to_edit();
  68. $tbl_lp = Database::get_course_table('lp');
  69. $tbl_lp_item = Database::get_course_table('lp_item');
  70. $tbl_lp_view = Database::get_course_table('lp_view');
  71. $isStudentView = (int) $_REQUEST['isStudentView'];
  72. $learnpath_id = (int) $_REQUEST['lp_id'];
  73. $submit = $_POST['submit_button'];
  74. /*
  75. $chapter_id = $_GET['chapter_id'];
  76. $title = $_POST['title'];
  77. $description = $_POST['description'];
  78. $Submititem = $_POST['Submititem'];
  79. $action = $_REQUEST['action'];
  80. $id = (int) $_REQUEST['id'];
  81. $type = $_REQUEST['type'];
  82. $direction = $_REQUEST['direction'];
  83. $moduleid = $_REQUEST['moduleid'];
  84. $prereq = $_REQUEST['prereq'];
  85. $type = $_REQUEST['type'];
  86. */
  87. /*
  88. ==============================================================================
  89. MAIN CODE
  90. ==============================================================================
  91. */
  92. // using the resource linker as a tool for adding resources to the learning path
  93. if ($action=="add" and $type=="learnpathitem")
  94. {
  95. $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>";
  96. }
  97. if ( (! $is_allowed_to_edit) or ($isStudentView) )
  98. {
  99. error_log('New LP - User not authorized in lp_add.php');
  100. header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  101. }
  102. //from here on, we are admin because of the previous condition, so don't check anymore
  103. $sql_query = "SELECT * FROM $tbl_lp WHERE id = $learnpath_id";
  104. $result=api_sql_query($sql_query);
  105. $therow=Database::fetch_array($result);
  106. //$admin_output = '';
  107. /*
  108. -----------------------------------------------------------
  109. Course admin section
  110. - all the functions not available for students - always available in this case (page only shown to admin)
  111. -----------------------------------------------------------
  112. */
  113. /*==================================================
  114. SHOWING THE ADMIN TOOLS
  115. ==================================================*/
  116. /*==================================================
  117. prerequisites setting end
  118. ==================================================*/
  119. $interbreadcrumb[]= array ("url"=>"lp_controller.php?action=list", "name"=> get_lang("_learning_path"));
  120. Display::display_header(null,'Path');
  121. //api_display_tool_title($therow['name']);
  122. //echo $admin_output;
  123. /*
  124. -----------------------------------------------------------
  125. DISPLAY SECTION
  126. -----------------------------------------------------------
  127. */
  128. echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
  129. echo '<tr>';
  130. echo '<td class="tree">';
  131. echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"><strong style="color:#999999">Basic overview</strong></p>';
  132. //links for adding a module, chapter or step
  133. echo '<div class="lp_actions">';
  134. echo '<p class="lp_action">';
  135. echo '<img align="left" alt="New module" src="img/lp_dokeos_module_add.png" title="New module" /><strong style="color:#999999">New module</strong>';
  136. echo '</p>';
  137. echo '<p class="lp_action">';
  138. echo '<img align="left" alt="New chapter" src="img/lp_dokeos_chapter_add.png" title="New chapter" /><strong style="color:#999999">New chapter</strong>';
  139. echo '</p>';
  140. echo '<p class="lp_action">';
  141. echo '<img align="left" alt="New step" src="img/lp_dokeos_step_add.png" title="New step" /><strong style="color:#999999">New step</strong>';
  142. echo '</p>';
  143. echo '</div>';
  144. echo '</td>';
  145. echo '<td class="workspace">';
  146. Display::display_normal_message('<strong>Welcome</strong> to Dokeos Learning path authoring tool.<br />
  147. You will be able to create your learning path step by step. The structure of your learning path will appear in a menu on the left.');
  148. echo '<div style="background:#F8F8F8; border:1px solid #999999; margin:15px auto; padding:10px; width:400px;">';
  149. echo '<p style="font-weight:bold">To start, give a title to your learning path:</p>';
  150. echo '<form method="post">';
  151. echo '<label for="idTitle" style="margin-right:10px;">Title:</label><input id="idTitle" name="learnpath_name" type="text" />';
  152. echo '<p><input style="background:#FFFFFF; border:1px solid #999999; font-family:Arial, Verdana, Helvetica, sans-serif; font-size:12px; padding:1px 2px; width:75px;" type="submit" value="OK" /></p>';
  153. echo '<input name="post_time" type="hidden" value="' . time() . '" />';
  154. echo '</form>';
  155. echo '</div>';
  156. echo '</td>';
  157. echo '</tr>';
  158. echo '</table>';
  159. /*
  160. ==============================================================================
  161. FOOTER
  162. ==============================================================================
  163. */
  164. Display::display_footer();
  165. ?>