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

Source for file lp_move_item.php

Documentation is available at lp_move_item.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.     Header and action code
  64. -----------------------------------------------------------
  65. */ 
  66. $htmlHeadXtra[$_SESSION['oLP']->create_js();
  67. /*
  68. -----------------------------------------------------------
  69.     Constants and variables
  70. -----------------------------------------------------------
  71. */ 
  72. $is_allowed_to_edit api_is_allowed_to_edit();
  73.  
  74. $tbl_lp Database::get_course_table('lp');
  75. $tbl_lp_item Database::get_course_table('lp_item');
  76. $tbl_lp_view Database::get_course_table('lp_view');
  77.  
  78. $isStudentView  = (int) $_REQUEST['isStudentView'];
  79. $learnpath_id   = (int) $_REQUEST['lp_id'];
  80. $submit            $_POST['submit_button'];
  81. /*
  82. $chapter_id     = $_GET['chapter_id'];
  83. $title          = $_POST['title'];
  84. $description   = $_POST['description'];
  85. $Submititem     = $_POST['Submititem'];
  86. $action         = $_REQUEST['action'];
  87. $id             = (int) $_REQUEST['id'];
  88. $type           = $_REQUEST['type'];
  89. $direction      = $_REQUEST['direction'];
  90. $moduleid       = $_REQUEST['moduleid'];
  91. $prereq         = $_REQUEST['prereq'];
  92. $type           = $_REQUEST['type'];
  93. */
  94. /*
  95. ==============================================================================
  96.         MAIN CODE
  97. ==============================================================================
  98. */
  99. // using the resource linker as a tool for adding resources to the learning path
  100. if ($action=="add" and $type=="learnpathitem")
  101. {
  102.      $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>";
  103. }
  104. if ( ($is_allowed_to_editor ($isStudentView) )
  105. {
  106.     error_log('New LP - User not authorized in lp_add_item.php');
  107.     header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  108. }
  109. //from here on, we are admin because of the previous condition, so don't check anymore
  110.  
  111. $sql_query "SELECT * FROM $tbl_lp WHERE id = $learnpath_id"
  112. $result=api_sql_query($sql_query);
  113. $therow=Database::fetch_array($result)
  114.  
  115. //$admin_output = '';
  116. /*
  117. -----------------------------------------------------------
  118.     Course admin section
  119.     - all the functions not available for students - always available in this case (page only shown to admin)
  120. -----------------------------------------------------------
  121. */ 
  122. /*==================================================
  123.             SHOWING THE ADMIN TOOLS
  124.  ==================================================*/
  125.  
  126.  
  127.  
  128. /*==================================================
  129.     prerequisites setting end
  130.  ==================================================*/          
  131.  
  132. $interbreadcrumb[]array ("url"=>"lp_controller.php?action=list""name"=> get_lang("_learning_path"));
  133.  
  134. $interbreadcrumb[]array ("url"=>api_get_self()."?action=build&lp_id=$learnpath_id""name" => stripslashes("{$therow['name']}"));
  135.  
  136. //Theme calls
  137. $show_learn_path=true;
  138. $lp_theme_css=$_SESSION['oLP']->get_theme();
  139.  
  140. Display::display_header(null,'Path');
  141. //api_display_tool_title($therow['name']);
  142.  
  143. $suredel trim(get_lang('AreYouSureToDelete'));
  144. //$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
  145. ?>
  146. <script type='text/javascript'>
  147. /* <![CDATA[ */
  148. function stripslashes(str) {
  149.     str=str.replace(/\\'/g,'\'');
  150.     str=str.replace(/\\"/g,'"');
  151.     str=str.replace(/\\\\/g,'\\');
  152.     str=str.replace(/\\0/g,'\0');
  153.     return str;
  154. }
  155. function confirmation(name)
  156. {
  157.     name=stripslashes(name);    
  158.     if (confirm("<?php echo $suredel?> " + name + " ?"))
  159.     {
  160.         return true;
  161.     }
  162.     else
  163.     {
  164.         return false;
  165.     }    
  166. }
  167. </script>
  168. <?php
  169.  
  170. //echo $admin_output;
  171.  
  172. /*
  173. -----------------------------------------------------------
  174.     DISPLAY SECTION
  175. -----------------------------------------------------------
  176. */
  177. echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
  178.  
  179.     echo '<tr>';
  180.             
  181.         echo '<td class="tree">';
  182.         
  183.             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>';
  184.             
  185.             //links for adding a module, chapter or step
  186.             echo '<div class="lp_actions">';
  187.  
  188.                 echo '<p class="lp_action">';
  189.                 
  190.                     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>';
  191.                         
  192.                 echo '</p>';
  193.                 echo '<p class="lp_action">';
  194.                 
  195.                     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>';
  196.                 
  197.                 echo '</p>';
  198.                 
  199.             echo '</div>';
  200.             
  201.             echo '<div class="lp_tree">';
  202.                     
  203.                 //build the tree with the menu items in it
  204.                 echo $_SESSION['oLP']->build_tree();
  205.             
  206.             echo '</div>';
  207.                     
  208.         echo '</td>';
  209.         echo '<td class="workspace">';
  210.             
  211.             if(isset($is_success&& $is_success === true)
  212.             {
  213.                 $msg '<div class="lp_message" style="margin-bottom:10px;">';
  214.             
  215.                     $msg .= 'The item has been moved.';
  216.             
  217.                 $msg .= '</div>';
  218.                 
  219.                 echo $_SESSION['oLP']->display_item($_GET['id']$msg);
  220.             }
  221.             else
  222.             {
  223.                 echo $_SESSION['oLP']->display_move_item($_GET['id']);
  224.             }
  225.         
  226.         echo '</td>';
  227.             
  228.     echo '</tr>';
  229.         
  230. echo '</table>';
  231.  
  232. /*
  233. ==============================================================================
  234.         FOOTER 
  235. ==============================================================================
  236. */ 
  237. ?>

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