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

Source for file lp_edit_item.php

Documentation is available at lp_edit_item.php

  1. <?php
  2. /*
  3. ============================================================================== 
  4.     Dokeos - elearning and course management software
  5.     
  6.     Copyright (c) 2004-2008 Dokeos SPRL
  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 address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  24.     Mail: info@dokeos.com
  25. ============================================================================== 
  26. */
  27. /**
  28. ============================================================================== 
  29. * This is a learning path creation and player tool in Dokeos - previously learnpath_handler.php
  30. *
  31. @author Patrick Cool
  32. @author Denes Nagy
  33. @author Roan Embrechts, refactoring and code cleaning
  34. @author Yannick Warnier <ywarnier@beeznest.org> - cleaning and update for new SCORM tool
  35. @author Julio Montoya  - Improving the list of templates
  36. @package dokeos.learnpath
  37. ============================================================================== 
  38. */
  39.  
  40. /*
  41. ==============================================================================
  42.         INIT SECTION
  43. ==============================================================================
  44. */ 
  45. $this_section=SECTION_COURSES;
  46.  
  47.  
  48. /*
  49. -----------------------------------------------------------
  50.     Libraries
  51. -----------------------------------------------------------
  52. */ 
  53. //the main_api.lib.php, database.lib.php and display.lib.php
  54. //libraries are included by default
  55.  
  56. include('learnpath_functions.inc.php');
  57. //include('../resourcelinker/resourcelinker.inc.php');
  58. include('resourcelinker.inc.php');
  59. //rewrite the language file, sadly overwritten by resourcelinker.inc.php
  60. // name of the language file that needs to be included 
  61. $language_file "learnpath";
  62.  
  63. /*
  64. -----------------------------------------------------------
  65.     Header and action code
  66. -----------------------------------------------------------
  67. */ 
  68. $htmlHeadXtra['
  69. <script type="text/javascript">
  70.     
  71. function FCKeditor_OnComplete( editorInstance )
  72. {    
  73.     document.getElementById(\'frmModel\').innerHTML = "<iframe height=890px; width=230px; frameborder=0 src=\''.api_get_path(WEB_LIBRARY_PATH).'fckeditor/editor/fckdialogframe.html \'>";    
  74. }    
  75.     
  76. function InnerDialogLoaded()
  77. {    
  78.     if (document.all)
  79.     {            
  80.         // if is iexplorer
  81.         var B=new window.frames.content_lp___Frame.FCKToolbarButton(\'Templates\',window.content_lp___Frame.FCKLang.Templates);        
  82.     }
  83.     else
  84.     {        
  85.         var B=new window.frames[0].FCKToolbarButton(\'Templates\',window.frames[0].FCKLang.Templates);    
  86.     }            
  87.     return B.ClickFrame();
  88. };    
  89.  
  90. </script>';
  91. $htmlHeadXtra[$_SESSION['oLP']->create_js();
  92. /*
  93. -----------------------------------------------------------
  94.     Constants and variables
  95. -----------------------------------------------------------
  96. */ 
  97. $is_allowed_to_edit api_is_allowed_to_edit();
  98.  
  99. $tbl_lp Database::get_course_table('lp');
  100. $tbl_lp_item Database::get_course_table('lp_item');
  101. $tbl_lp_view Database::get_course_table('lp_view');
  102.  
  103. $isStudentView  = (int) $_REQUEST['isStudentView'];
  104. $learnpath_id   = (int) $_REQUEST['lp_id'];
  105. $submit            $_POST['submit_button'];
  106. /*
  107. $chapter_id     = $_GET['chapter_id'];
  108. $title          = $_POST['title'];
  109. $description   = $_POST['description'];
  110. $Submititem     = $_POST['Submititem'];
  111. $action         = $_REQUEST['action'];
  112. $id             = (int) $_REQUEST['id'];
  113. $type           = $_REQUEST['type'];
  114. $direction      = $_REQUEST['direction'];
  115. $moduleid       = $_REQUEST['moduleid'];
  116. $prereq         = $_REQUEST['prereq'];
  117. $type           = $_REQUEST['type'];
  118. */
  119. /*
  120. ==============================================================================
  121.         MAIN CODE
  122. ==============================================================================
  123. */
  124. // using the resource linker as a tool for adding resources to the learning path
  125. if ($action=="add" and $type=="learnpathitem")
  126. {
  127.      $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>";
  128. }
  129. if ( ($is_allowed_to_editor ($isStudentView) )
  130. {
  131.     error_log('New LP - User not authorized in lp_add_item.php');
  132.     header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  133. }
  134. //from here on, we are admin because of the previous condition, so don't check anymore
  135.  
  136. $sql_query "SELECT * FROM $tbl_lp WHERE id = $learnpath_id"
  137. $result=api_sql_query($sql_query);
  138. $therow=Database::fetch_array($result)
  139.  
  140. //$admin_output = '';
  141. /*
  142. -----------------------------------------------------------
  143.     Course admin section
  144.     - all the functions not available for students - always available in this case (page only shown to admin)
  145. -----------------------------------------------------------
  146. */ 
  147. /*==================================================
  148.             SHOWING THE ADMIN TOOLS
  149.  ==================================================*/
  150.  
  151.  
  152.  
  153. /*==================================================
  154.     prerequisites setting end
  155.  ==================================================*/          
  156.  
  157. $interbreadcrumb[]array ("url"=>"lp_controller.php?action=list""name"=> get_lang("_learning_path"));
  158.  
  159. $interbreadcrumb[]array ("url"=>api_get_self()."?action=build&lp_id=$learnpath_id""name" => stripslashes("{$therow['name']}"));
  160. //Theme calls
  161. $show_learn_path=true;
  162. $lp_theme_css=$_SESSION['oLP']->get_theme();
  163.  
  164. Display::display_header(null,'Path');
  165. //api_display_tool_title($therow['name']);
  166.  
  167. $suredel trim(get_lang('AreYouSureToDelete'));
  168. //$suredelstep = trim(get_lang('AreYouSureToDeleteSteps'));
  169. ?>
  170. <script type='text/javascript'>
  171. /* <![CDATA[ */
  172. function stripslashes(str) {
  173.     str=str.replace(/\\'/g,'\'');
  174.     str=str.replace(/\\"/g,'"');
  175.     str=str.replace(/\\\\/g,'\\');
  176.     str=str.replace(/\\0/g,'\0');
  177.     return str;
  178. }
  179. function confirmation(name)
  180. {
  181.     name=stripslashes(name);    
  182.     if (confirm("<?php echo $suredel?> " + name + " ?"))
  183.     {
  184.         return true;
  185.     }
  186.     else
  187.     {
  188.         return false;
  189.     }    
  190. }
  191. </script>
  192. <?php
  193.  
  194. //echo $admin_output;
  195. /*
  196. -----------------------------------------------------------
  197.     DISPLAY SECTION
  198. -----------------------------------------------------------
  199. */
  200. echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
  201.  
  202.     echo '<tr>';
  203.             
  204.         echo '<td class="tree">';
  205.         
  206.             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>';
  207.             
  208.             //links for adding a module, chapter or step
  209.             echo '<div class="lp_actions">';
  210.                 
  211.                 echo '<p class="lp_action">';
  212.                 
  213.                     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>';
  214.                         
  215.                 echo '</p>';
  216.                 echo '<p class="lp_action">';
  217.                 
  218.                     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>';
  219.                 
  220.                 echo '</p>';
  221.                 
  222.             echo '</div>';
  223.             
  224.             echo '<div class="lp_tree" style="height:90%" >';                    
  225.                 //build the tree with the menu items in it
  226.                 echo $_SESSION['oLP']->build_tree();            
  227.             echo '</div>';
  228.             
  229.             // show the template list 
  230.             echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"></p>'//line                
  231.             echo '<br>';                
  232.             echo '<div id="frmModel" style="display:block; height:890px;width:100px; position:relative;"></div>';                
  233.                     
  234.         echo '</td>';
  235.         
  236.         echo '<td class="workspace">';
  237.             
  238.             if(isset($is_success&& $is_success === true)
  239.             {
  240.                 $msg '<div class="lp_message" style="margin-bottom:10px;">';
  241.             
  242.                     $msg .= 'The item has been edited.';
  243.             
  244.                 $msg .= '</div>';
  245.                 
  246.                 echo $_SESSION['oLP']->display_item($_GET['id']$msg);
  247.             }
  248.             else
  249.             {
  250.                 echo $_SESSION['oLP']->display_edit_item($_GET['id']);
  251.             }        
  252.         echo '</td>';            
  253.     echo '</tr>';        
  254. echo '</table>';
  255.  
  256. /*
  257. ==============================================================================
  258.         FOOTER 
  259. ==============================================================================
  260. */ 
  261. ?>

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