dokeos-learnpath
[ class tree: dokeos-learnpath ] [ index: dokeos-learnpath ] [ all elements ]

Source for file lp_edit_item_prereq.php

Documentation is available at lp_edit_item_prereq.php

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

Documentation generated on Thu, 12 Jun 2008 14:02:46 -0500 by phpDocumentor 1.4.1