lp_nav.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Script opened in an iframe and containing the
  5. * learning path's navigation and progress bar.
  6. *
  7. * @package chamilo.learnpath
  8. *
  9. * @author Yannick Warnier <ywarnier@beeznest.org>
  10. */
  11. // Flag to allow for anonymous user - needs to be set before global.inc.php.
  12. $use_anonymous = true;
  13. require_once __DIR__.'/../inc/global.inc.php';
  14. $htmlHeadXtra[] = '<script>
  15. var chamilo_xajax_handler = window.parent.oxajax;
  16. </script>';
  17. $lpItemId = isset($_REQUEST['lp_item']) ? (int) $_REQUEST['lp_item'] : 0;
  18. $lpId = isset($_REQUEST['lp_id']) ? (int) $_REQUEST['lp_id'] : 0;
  19. if (!$lpItemId) {
  20. echo '';
  21. exit;
  22. }
  23. $progress_bar = '';
  24. $navigation_bar = '';
  25. $autostart = 'true';
  26. $myLP = learnpath::getLpFromSession(api_get_course_id(), $lpId, api_get_user_id());
  27. if ($myLP) {
  28. $lp_theme_css = $myLP->get_theme();
  29. $my_style = api_get_visual_theme();
  30. // Setting up the CSS theme if exists
  31. $myCourseLpTheme = null;
  32. if (api_get_setting('allow_course_theme') === 'true') {
  33. $myCourseLpTheme = api_get_course_setting('allow_learning_path_theme');
  34. }
  35. if (!empty($lp_theme_css) && !empty($myCourseLpTheme) && $myCourseLpTheme != -1 && $myCourseLpTheme == 1) {
  36. global $lp_theme_css;
  37. } else {
  38. $lp_theme_css = $my_style;
  39. }
  40. $progress_bar = $myLP->getProgressBar();
  41. $navigation_bar = $myLP->get_navigation_bar();
  42. $mediaplayer = $myLP->get_mediaplayer($lpItemId, $autostart);
  43. if ($mediaplayer) {
  44. echo $mediaplayer;
  45. echo "<script>
  46. $(function() {
  47. jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer();
  48. });
  49. </script>";
  50. }
  51. }
  52. session_write_close();