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

Source for file lp_add.php

Documentation is available at lp_add.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. $currentstyle api_get_setting('stylesheets');
  67. $htmlHeadXtra['<link rel="stylesheet" type="text/css" href="'.api_get_path(WEB_CODE_PATH).'css/'.$currentstyle.'/learnpath.css"/>';
  68. $htmlHeadXtra['<link rel="stylesheet" type="text/css" href="learnpath.css" />'//will be a merged with original learnpath.css
  69. $htmlHeadXtra['<link rel="stylesheet" type="text/css" href="dtree.css" />'//will be moved
  70. /*
  71. -----------------------------------------------------------
  72.     Constants and variables
  73. -----------------------------------------------------------
  74. */ 
  75. $is_allowed_to_edit api_is_allowed_to_edit();
  76.  
  77. $tbl_lp Database::get_course_table('lp');
  78. $tbl_lp_item Database::get_course_table('lp_item');
  79. $tbl_lp_view Database::get_course_table('lp_view');
  80.  
  81. $isStudentView  = (int) $_REQUEST['isStudentView'];
  82. $learnpath_id   = (int) $_REQUEST['lp_id'];
  83. $submit            $_POST['submit_button'];
  84.  
  85. /*
  86. ==============================================================================
  87.         MAIN CODE
  88. ==============================================================================
  89. */
  90. // using the resource linker as a tool for adding resources to the learning path
  91. if ($action=="add" and $type=="learnpathitem")
  92. {
  93.      $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>";
  94. }
  95. if ( ($is_allowed_to_editor ($isStudentView) )
  96. {
  97.     error_log('New LP - User not authorized in lp_add.php');
  98.     header('location:lp_controller.php?action=view&lp_id='.$learnpath_id);
  99. }
  100. //from here on, we are admin because of the previous condition, so don't check anymore
  101.  
  102. $sql_query "SELECT * FROM $tbl_lp WHERE id = $learnpath_id"
  103. $result=api_sql_query($sql_query);
  104. $therow=Database::fetch_array($result)
  105.  
  106. /*
  107. -----------------------------------------------------------
  108.     Course admin section
  109.     - all the functions not available for students - always available in this case (page only shown to admin)
  110. -----------------------------------------------------------
  111. */ 
  112. $interbreadcrumb[]array ("url"=>"lp_controller.php?action=list""name"=> get_lang("_learning_path"));
  113. $interbreadcrumb[]array ("url"=>"#""name"=> get_lang("_add_learnpath"));
  114.  
  115. Display::display_header(null,'Path');
  116.  
  117. /*
  118. -----------------------------------------------------------
  119.     DISPLAY SECTION
  120. -----------------------------------------------------------
  121. */
  122. echo '<table cellpadding="0" cellspacing="0" class="lp_build">';
  123.     echo '<tr>';
  124.         echo '<td class="tree">';
  125.             echo '<p style="border-bottom:1px solid #999999; margin:0; padding:2px;"><strong style="color:#999999">'.get_lang("BasicOverview").'</strong>&nbsp;<strong style="color:#999999">'.get_lang("Display").'</strong></p>';
  126.             //links for adding a module, chapter or step
  127.             echo '<div class="lp_actions">';
  128.                 echo '<p class="lp_action">';
  129.                     echo '<img align="left" alt="'.get_lang("NewChapter").'" src="../img/lp_dokeos_chapter_add.png" title="'.get_lang("NewChapter").'" /><strong style="color:#999999">'.get_lang("NewChapter").'</strong>';
  130.                 echo '</p>';
  131.                 echo '<p class="lp_action">';
  132.                     echo '<img align="left" alt="'.get_lang("NewStep").'" src="../img/lp_dokeos_step_add.png" title="'.get_lang("NewStep").'" /><strong style="color:#999999">'.get_lang("NewStep").'</strong>';
  133.                 echo '</p>';
  134.             echo '</div>';
  135.         echo '</td>';
  136.         echo '<td class="workspace">';
  137.             Display::display_normal_message(get_lang('AddLpIntro'),false);
  138.             echo '<div style="background:#F8F8F8; border:1px solid #999999; margin:10px; padding:10px; width:490px;">';
  139.                 echo '<p style="font-weight:bold">'.get_lang('AddLpToStart').' :</p>';
  140.                 echo '<form method="post">';
  141.                     echo '<label for="idTitle" style="margin-right:10px;">'.get_lang('Title').' :</label><input id="idTitle" name="learnpath_name" type="text" class="input_titles" />';
  142.                     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="'.get_lang('Ok').'" /></p>';
  143.                     echo '<input name="post_time" type="hidden" value="' time('" />';
  144.                 echo '</form>';
  145.             echo '</div>';
  146.         echo '</td>';
  147.     echo '</tr>';        
  148. echo '</table>';
  149.  
  150. /*
  151. ==============================================================================
  152.         FOOTER 
  153. ==============================================================================
  154. */ 
  155. ?>

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