lp_header.php 2.9 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. // Flag to allow for anonymous user - needs to be set before global.inc.php.
  9. $use_anonymous = true;
  10. // name of the language file that needs to be included
  11. $language_file[] = 'scormdocument';
  12. require_once 'back_compat.inc.php';
  13. require_once 'learnpath.class.php';
  14. require_once 'scorm.class.php';
  15. require_once 'aicc.class.php';
  16. if (isset($_SESSION['lpobject'])) {
  17. $temp = $_SESSION['lpobject'];
  18. $_SESSION['oLP'] = unserialize($temp);
  19. }
  20. $path_name = $_SESSION['oLP']->get_name();
  21. $path_id = $_SESSION['oLP']->get_id();
  22. // Use the flag set in lp_view.php to check if this script has been loaded
  23. // as a frame of lp_view.php. Otherwise, redirect to lp_controller.
  24. if (!$_SESSION['loaded_lp_view']) {
  25. header('location: lp_controller.php?'.api_get_cidreq().'&action=view&item_id='.$path_id);
  26. }
  27. // Unset the flag as it has been used already.
  28. $_SESSION['loaded_lp_view'] = false;
  29. // Check if the learnpaths list should be accessible to the user.
  30. $show_link = true;
  31. if (!api_is_allowed_to_edit()) { // If the user has no edit permission (simple user).
  32. $course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
  33. $result = Database::query("SELECT * FROM $course_tool_table WHERE name='learnpath'");
  34. if (Database::num_rows($result) > 0) {
  35. $row = Database::fetch_array($result);
  36. if ($row['visibility'] == '0') { // If the tool is *not* visible.
  37. $show_link = false;
  38. }
  39. } else {
  40. $show_link = false;
  41. }
  42. }
  43. if (isset($_SESSION['gradebook'])){
  44. $gradebook = $_SESSION['gradebook'];
  45. }
  46. if (!empty($gradebook) && $gradebook == 'view') {
  47. $interbreadcrumb[] = array (
  48. 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
  49. 'name' => get_lang('ToolGradebook')
  50. );
  51. }
  52. if ($show_link) {
  53. $interbreadcrumb[] = array('url' => './lp_controller.php?action=list', 'name' => get_lang(ucfirst(TOOL_LEARNPATH)));
  54. }
  55. // Else we don't display get_lang(ucfirst(TOOL_LEARNPATH)) in the breadcrumb since the learner accessed it directly from the course homepage.
  56. $interbreadcrumb[] = array('url' => './lp_controller.php?action=view&lp_id='.$path_id, 'name' => $path_name);
  57. $noPHP_SELF = true;
  58. $lp_theme_css = $_SESSION['oLP']->get_theme();
  59. include '../inc/reduced_header.inc.php';
  60. echo '<div style="font-size:14px;padding-left: 17px;">';
  61. echo '<table ><tr><td>';
  62. echo '<a href="./lp_controller.php?action=return_to_course_homepage" target="_self" onclick="javascript: window.parent.API.save_asset();">';
  63. echo '<img src="../img/lp_arrow.gif">';
  64. echo '<a>';
  65. echo '</td><td>';
  66. 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>';
  67. echo '</td></tr><table>';
  68. echo '</div>';
  69. ?>
  70. </body>
  71. </html>