Issues (2128)

main/lp/lp_nav.php (1 issue)

Severity
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
/**
5
 * Script opened in an iframe and containing the
6
 * learning path's navigation and progress bar.
7
 *
8
 * @author Yannick Warnier <[email protected]>
9
 */
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
15
$htmlHeadXtra[] = '<script>
16
    var chamilo_xajax_handler = window.parent.oxajax;
17
</script>';
18
19
$lpItemId = isset($_REQUEST['lp_item']) ? (int) $_REQUEST['lp_item'] : 0;
20
$lpId = isset($_REQUEST['lp_id']) ? (int) $_REQUEST['lp_id'] : 0;
21
22
if (!$lpItemId) {
23
    echo '';
24
    exit;
25
}
26
27
$progress_bar = '';
28
$navigation_bar = '';
29
$autostart = 'true';
30
31
$myLP = learnpath::getLpFromSession(api_get_course_id(), $lpId, api_get_user_id());
32
33
if ($myLP) {
0 ignored issues
show
$myLP is of type learnpath, thus it always evaluated to true.
Loading history...
34
    $lp_theme_css = $myLP->get_theme();
35
    $my_style = api_get_visual_theme();
36
37
    // Setting up the CSS theme if exists
38
    $myCourseLpTheme = null;
39
    if ('true' === api_get_setting('allow_course_theme')) {
40
        $myCourseLpTheme = api_get_course_setting('allow_learning_path_theme');
41
    }
42
43
    if (!empty($lp_theme_css) && !empty($myCourseLpTheme) && -1 != $myCourseLpTheme && 1 == $myCourseLpTheme) {
44
        global $lp_theme_css;
45
    } else {
46
        $lp_theme_css = $my_style;
47
    }
48
    $progress_bar = $myLP->getProgressBar();
49
    $navigation_bar = $myLP->get_navigation_bar();
50
    $mediaplayer = $myLP->get_mediaplayer($lpItemId, $autostart);
51
52
    if ($mediaplayer) {
53
        echo $mediaplayer;
54
        echo "<script>
55
            $(function() {
56
                jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer();
57
            });
58
        </script>";
59
    }
60
}
61
session_write_close();
62