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

Source for file lp_admin_view.php

Documentation is available at lp_admin_view.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. $language_file "learnpath";
  59.  
  60. /*
  61. -----------------------------------------------------------
  62.     Constants and variables
  63. -----------------------------------------------------------
  64. */ 
  65. $is_allowed_to_edit api_is_allowed_to_edit();
  66.  
  67. $tbl_lp Database::get_course_table('lp');
  68. $tbl_lp_item Database::get_course_table('lp_item');
  69. $tbl_lp_view Database::get_course_table('lp_view');
  70.  
  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_editor ($isStudentView) )
  98. {
  99.     error_log('New LP - User not authorized in lp_admin_view.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.  
  104. $sql_query "SELECT * FROM $tbl_lp WHERE id = $learnpath_id"
  105. $result=api_sql_query($sql_query);
  106. $therow=Database::fetch_array($result)
  107.  
  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.  
  120.  
  121. /*==================================================
  122.     prerequisites setting end
  123.  ==================================================*/          
  124.  
  125. $interbreadcrumb[]array ("url"=>"lp_controller.php?action=list""name"=> get_lang("_learning_path"));
  126.  
  127. $interbreadcrumb[]array ("url"=>api_get_self()."?action=admin_view&lp_id=$learnpath_id""name" => stripslashes("{$therow['name']}"));
  128.  
  129. //Theme calls
  130. $show_learn_path=true;
  131. $lp_theme_css=$_SESSION['oLP']->get_theme()
  132. Display::display_header(null,'Path');
  133. //api_display_tool_title($therow['name']);
  134.  
  135. $suredel trim(get_lang('AreYouSureToDelete'));
  136. //$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
  137. ?>
  138. <script type='text/javascript'>
  139. /* <![CDATA[ */
  140. function stripslashes(str) {
  141.     str=str.replace(/\\'/g,'\'');
  142.     str=str.replace(/\\"/g,'"');
  143.     str=str.replace(/\\\\/g,'\\');
  144.     str=str.replace(/\\0/g,'\0');
  145.     return str;
  146. }
  147. function confirmation(name)
  148. {
  149.     name=stripslashes(name);    
  150.     if (confirm("<?php echo $suredel?> " + name + " ?"))
  151.     {
  152.         return true;
  153.     }
  154.     else
  155.     {
  156.         return false;
  157.     }    
  158. }
  159. </script>
  160. <?php
  161.  
  162. /*
  163. -----------------------------------------------------------
  164.     DISPLAY SECTION
  165. -----------------------------------------------------------
  166. */
  167.  
  168. switch($_GET['action'])
  169. {
  170.     case 'edit_item':
  171.         
  172.         if(isset($is_success&& $is_success === true)
  173.         {
  174.             echo '<div class="lp_message">';
  175.             
  176.                 echo get_lang("_learnpath_item_edited");
  177.             
  178.             echo '</div>';
  179.         }
  180.         else
  181.         {
  182.             echo $_SESSION['oLP']->display_edit_item($_GET['id']);
  183.         }
  184.         
  185.         break;
  186.     
  187.     case 'delete_item':
  188.         
  189.         if(isset($is_success&& $is_success === true)
  190.         {
  191.             echo '<div class="lp_message">';
  192.             
  193.                 echo get_lang("_learnpath_item_deleted");
  194.             
  195.             echo '</div>';
  196.         }
  197.         
  198.         break;
  199. }
  200.  
  201. echo $_SESSION['oLP']->overview();
  202.  
  203. /*
  204. ==============================================================================
  205.         FOOTER 
  206. ==============================================================================
  207. */ 
  208. ?>

Documentation generated on Thu, 12 Jun 2008 14:01:40 -0500 by phpDocumentor 1.4.1