lp_header.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php //$id: $
  2. /**
  3. * Script that displays the header frame for lp_view.php
  4. * @package dokeos.learnpath
  5. * @author Yannick Warnier <ywarnier@beeznest.org>
  6. */
  7. /**
  8. * Script
  9. */
  10. //flag to allow for anonymous user - needs to be set before global.inc.php
  11. $use_anonymous = true;
  12. // name of the language file that needs to be included
  13. $language_file[] = "scormdocument";
  14. require_once('back_compat.inc.php');
  15. require_once('learnpath.class.php');
  16. require_once('scorm.class.php');
  17. require_once('aicc.class.php');
  18. if(isset($_SESSION['lpobject'])){
  19. $temp = $_SESSION['lpobject'];
  20. $_SESSION['oLP'] = unserialize($temp);
  21. }
  22. $path_name = $_SESSION['oLP']->get_name();
  23. $path_id = $_SESSION['oLP']->get_id();
  24. // use the flag set in lp_view.php to check if this script has been loaded
  25. // as a frame of lp_view.php. Otherwise, redirect to lp_controller
  26. if(!isset($_SESSION['loaded_lp_view']) || $_SESSION['loaded_lp_view']==false)
  27. {
  28. header('location: lp_controller.php?'.api_get_cidreq().'&action=view&item_id='.$path_id);
  29. }
  30. //unset the flag as it has been used already
  31. $_SESSION['loaded_lp_view'] = false;
  32. // Check if the learnpaths list should be accessible to the user
  33. $show_link = true;
  34. if(!api_is_allowed_to_edit()) //if the user has no edit permission (simple user)
  35. {
  36. $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  37. $result = api_sql_query("SELECT * FROM $course_tool_table WHERE name='learnpath'",__FILE__,__LINE__);
  38. if(Database::num_rows($result)>0)
  39. {
  40. $row = Database::fetch_array($result);
  41. if($row['visibility'] == '0') //if the tool is *not* visible
  42. {
  43. $show_link = false;
  44. }
  45. }
  46. else
  47. {
  48. $show_link = false;
  49. }
  50. }
  51. $header_hide_main_div = true;
  52. if($show_link)
  53. {
  54. $interbreadcrumb[]= array ("url"=>"./lp_controller.php?action=list", "name"=> get_lang(ucfirst(TOOL_LEARNPATH)));
  55. }
  56. // else we don't display get_lang(ucfirst(TOOL_LEARNPATH)) in the breadcrumb since the learner accessed it directly from the course homepage
  57. $interbreadcrumb[] = array("url"=>"./lp_controller.php?action=view&lp_id=".$path_id,'name'=>$path_name);
  58. $noPHP_SELF = true;
  59. $lp_theme_css=$_SESSION['oLP']->get_theme();
  60. include('../inc/reduced_header.inc.php');
  61. echo '<a class="link" href="./lp_controller.php?action=return_to_course_homepage" target="_top" onclick="window.parent.API.save_asset();">'.get_lang('CourseHomepageLink').'</a>';
  62. ?>
  63. </body>
  64. </html>