lp_header.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Script that displays the header frame for lp_view.php
  5. * @package chamilo.learnpath
  6. * @author Yannick Warnier <ywarnier@beeznest.org>
  7. */
  8. /**
  9. * Code
  10. */
  11. // Flag to allow for anonymous user - needs to be set before global.inc.php.
  12. $use_anonymous = true;
  13. // name of the language file that needs to be included
  14. $language_file[] = 'scormdocument';
  15. require_once 'back_compat.inc.php';
  16. require_once 'learnpath.class.php';
  17. require_once 'scorm.class.php';
  18. require_once 'aicc.class.php';
  19. if (isset($_SESSION['lpobject'])) {
  20. $temp = $_SESSION['lpobject'];
  21. $_SESSION['oLP'] = unserialize($temp);
  22. }
  23. $path_name = $_SESSION['oLP']->get_name();
  24. $path_id = $_SESSION['oLP']->get_id();
  25. // Use the flag set in lp_view.php to check if this script has been loaded
  26. // as a frame of lp_view.php. Otherwise, redirect to lp_controller.
  27. if (!$_SESSION['loaded_lp_view']) {
  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. $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  36. $result = Database::query("SELECT * FROM $course_tool_table WHERE name='learnpath'");
  37. if (Database::num_rows($result) > 0) {
  38. $row = Database::fetch_array($result);
  39. if ($row['visibility'] == '0') { // If the tool is *not* visible.
  40. $show_link = false;
  41. }
  42. } else {
  43. $show_link = false;
  44. }
  45. }
  46. if (isset($_SESSION['gradebook'])){
  47. $gradebook = $_SESSION['gradebook'];
  48. }
  49. if (!empty($gradebook) && $gradebook == 'view') {
  50. $interbreadcrumb[] = array (
  51. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  52. 'name' => get_lang('ToolGradebook')
  53. );
  54. }
  55. if ($show_link) {
  56. $interbreadcrumb[] = array('url' => './lp_controller.php?action=list', 'name' => get_lang(ucfirst(TOOL_LEARNPATH)));
  57. }
  58. // Else we don't display get_lang(ucfirst(TOOL_LEARNPATH)) in the breadcrumb since the learner accessed it directly from the course homepage.
  59. $interbreadcrumb[] = array('url' => './lp_controller.php?action=view&lp_id='.$path_id, 'name' => $path_name);
  60. $noPHP_SELF = true;
  61. $lp_theme_css = $_SESSION['oLP']->get_theme();
  62. include '../inc/reduced_header.inc.php';
  63. echo '<div style="font-size:14px;padding-left: 17px;">';
  64. echo '<table ><tr><td>';
  65. echo '<a href="./lp_controller.php?action=return_to_course_homepage" target="_self" onclick="javascript: window.parent.API.save_asset();">';
  66. echo '<img src="../img/lp_arrow.gif">';
  67. echo '<a>';
  68. echo '</td><td>';
  69. echo '<a class="link" href="./lp_controller.php?action=return_to_course_homepage" target="_self" onclick="javascript: window.parent.API.save_asset();">'.get_lang('CourseHomepageLink').'</a>';
  70. echo '</td></tr><table>';
  71. echo '</div>';
  72. ?>
  73. </body>
  74. </html>