lp_nav.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. ?>
  46. <script>
  47. $(function() {
  48. jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer();
  49. });
  50. </script>
  51. <?php
  52. }
  53. }
  54. session_write_close();