| 
                    1
                 | 
                                    
                                                     | 
                
                 | 
                <?php  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    3
                 | 
                                    
                                                     | 
                
                 | 
                /* For licensing terms, see /license.txt */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    4
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    5
                 | 
                                    
                                                     | 
                
                 | 
                /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    6
                 | 
                                    
                                                     | 
                
                 | 
                 * Class IndexManager.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    7
                 | 
                                    
                                                     | 
                
                 | 
                 */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    8
                 | 
                                    
                                                     | 
                
                 | 
                class IndexManager  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    9
                 | 
                                    
                                                     | 
                
                 | 
                { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    10
                 | 
                                    
                                                     | 
                
                 | 
                    public const VIEW_BY_DEFAULT = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    11
                 | 
                                    
                                                     | 
                
                 | 
                    public const VIEW_BY_SESSION = 1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    12
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    13
                 | 
                                    
                                                     | 
                
                 | 
                    // An instance of the template engine  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    14
                 | 
                                    
                                                     | 
                
                 | 
                    // No need to initialize because IndexManager is not static,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    15
                 | 
                                    
                                                     | 
                
                 | 
                    // and the constructor immediately instantiates a Template  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    16
                 | 
                                    
                                                     | 
                
                 | 
                    public $tpl;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    17
                 | 
                                    
                                                     | 
                
                 | 
                    public $name = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    18
                 | 
                                    
                                                     | 
                
                 | 
                    public $home = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    19
                 | 
                                    
                                                     | 
                
                 | 
                    public $default_home = 'home/';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    20
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    21
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    22
                 | 
                                    
                                                     | 
                
                 | 
                     * Construct.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    23
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    24
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $title  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    25
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    26
                 | 
                                    
                                                     | 
                
                 | 
                    public function __construct($title)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    27
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    28
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl = new Template($title);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    29
                 | 
                                    
                                                     | 
                
                 | 
                        $this->home = api_get_home_path();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    30
                 | 
                                    
                                                     | 
                
                 | 
                        $this->user_id = api_get_user_id();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    31
                 | 
                                    
                                                     | 
                
                 | 
                        $this->load_directories_preview = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    32
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    33
                 | 
                                    
                                                     | 
                
                 | 
                        // Load footer plugins systematically  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    34
                 | 
                                    
                                                     | 
                
                 | 
                        /*$config = api_get_settings_params(array('subkey = ? ' => 'customfooter', ' AND category = ? ' => 'Plugins')); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    35
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($config)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    36
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($config as $fooid => $configrecord) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    37
                 | 
                                    
                                                     | 
                
                 | 
                                $canonic = preg_replace('/^customfooter_/', '', $configrecord['variable']); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    38
                 | 
                                    
                                                     | 
                
                 | 
                                $footerconfig->$canonic = $configrecord['selected_value'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    39
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    40
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($footerconfig->footer_left)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    41
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('plugin_footer_left', $footerconfig->footer_left); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    42
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    43
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($footerconfig->footer_right)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    44
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('plugin_footer_right', $footerconfig->footer_right); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    45
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    46
                 | 
                                    
                                                     | 
                
                 | 
                        }*/  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    47
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    48
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('show_documents_preview') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    49
                 | 
                                    
                                                     | 
                
                 | 
                            $this->load_directories_preview = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    50
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    51
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    52
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    53
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    54
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $listA  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    55
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $listB  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    56
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    57
                 | 
                                    
                                                     | 
                
                 | 
                     * @return int  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    58
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    59
                 | 
                                    
                                                     | 
                
                 | 
                    public static function compareListUserCategory($listA, $listB)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    60
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    61
                 | 
                                    
                                                     | 
                
                 | 
                        if ($listA['title'] == $listB['title']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    62
                 | 
                                    
                                                     | 
                
                 | 
                            return 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    63
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    64
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    65
                 | 
                                    
                                                     | 
                
                 | 
                        if ($listA['title'] > $listB['title']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    66
                 | 
                                    
                                                     | 
                
                 | 
                            return 1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    67
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    68
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    69
                 | 
                                    
                                                     | 
                
                 | 
                        return -1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    70
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    71
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    72
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    73
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $view  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    74
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $userId  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    75
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    76
                 | 
                                    
                                                     | 
                
                 | 
                    public static function setDefaultMyCourseView($view, $userId)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    77
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    78
                 | 
                                    
                                                     | 
                
                 | 
                        api_set_cookie('defaultMyCourseView'.$userId, $view); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    79
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    80
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    81
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    82
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool $setLoginForm  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    83
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    84
                 | 
                                    
                                                     | 
                
                 | 
                    public function set_login_form($setLoginForm = true)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    85
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    86
                 | 
                                    
                                                     | 
                
                 | 
                        global $loginFailed;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    87
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl->setLoginForm($setLoginForm);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    88
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    89
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    90
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    91
                 | 
                                    
                                                     | 
                
                 | 
                     * @param array $personal_course_list  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    92
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    93
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_exercise_block($personal_course_list)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    94
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    95
                 | 
                                    
                                                     | 
                
                 | 
                        $exercise_list = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    96
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($personal_course_list)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    97
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($personal_course_list as $course_item) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    98
                 | 
                                    
                                                     | 
                
                 | 
                                $course_code = $course_item['c'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    99
                 | 
                                    
                                                     | 
                
                 | 
                                $session_id = $course_item['id_session'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    100
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    101
                 | 
                                    
                                                     | 
                
                 | 
                                $exercises = ExerciseLib::get_exercises_to_be_taken(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    102
                 | 
                                    
                                                     | 
                
                 | 
                                    $course_code,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    103
                 | 
                                    
                                                     | 
                
                 | 
                                    $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    104
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    105
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    106
                 | 
                                    
                                                     | 
                
                 | 
                                foreach ($exercises as $exercise_item) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    107
                 | 
                                    
                                                     | 
                
                 | 
                                    $exercise_item['course_code'] = $course_code;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    108
                 | 
                                    
                                                     | 
                
                 | 
                                    $exercise_item['session_id'] = $session_id;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    109
                 | 
                                    
                                                     | 
                
                 | 
                                    $exercise_item['tms'] = api_strtotime($exercise_item['end_time'], 'UTC');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    110
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    111
                 | 
                                    
                                                     | 
                
                 | 
                                    $exercise_list[] = $exercise_item;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    112
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    113
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    114
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($exercise_list)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    115
                 | 
                                    
                                                     | 
                
                 | 
                                $exercise_list = msort($exercise_list, 'tms');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    116
                 | 
                                    
                                                     | 
                
                 | 
                                $my_exercise = $exercise_list[0];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    117
                 | 
                                    
                                                     | 
                
                 | 
                                $url = Display::url(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    118
                 | 
                                    
                                                     | 
                
                 | 
                                    $my_exercise['title'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    119
                 | 
                                    
                                                     | 
                
                 | 
                                    api_get_path(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    120
                 | 
                                    
                                                     | 
                
                 | 
                                        WEB_CODE_PATH  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    121
                 | 
                                    
                                                     | 
                
                 | 
                                    ).'exercise/overview.php?exerciseId='.$my_exercise['id'].'&cidReq='.$my_exercise['course_code'].'&id_session='.$my_exercise['session_id']  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    122
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    123
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('exercise_url', $url); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    124
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    125
                 | 
                                    
                                                     | 
                
                 | 
                                    'exercise_end_date',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    126
                 | 
                                    
                                                     | 
                
                 | 
                                    api_convert_and_format_date($my_exercise['end_time'], DATE_FORMAT_SHORT)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    127
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    128
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    129
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    130
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    131
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    132
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    133
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool $show_slide  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    134
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    135
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string|null  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    136
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    137
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_announcements($show_slide = true)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    138
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    139
                 | 
                                    
                                                     | 
                
                 | 
                        $hideAnnouncements = api_get_setting('hide_global_announcements_when_not_connected'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    140
                 | 
                                    
                                                     | 
                
                 | 
                        $currentUserId = api_get_user_id();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    141
                 | 
                                    
                                                     | 
                
                 | 
                        if ($hideAnnouncements === 'true' && empty($currentUserId)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    142
                 | 
                                    
                                                     | 
                
                 | 
                            return null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    143
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    144
                 | 
                                    
                                                     | 
                
                 | 
                        $announcement = isset($_GET['announcement']) ? $_GET['announcement'] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    145
                 | 
                                    
                                                     | 
                
                 | 
                        $announcement = (int) $announcement;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    146
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    147
                 | 
                                    
                                                     | 
                
                 | 
                        if (!api_is_anonymous() && $this->user_id) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    148
                 | 
                                    
                                                     | 
                
                 | 
                            $visibility = SystemAnnouncementManager::getCurrentUserVisibility();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    149
                 | 
                                    
                                                     | 
                
                 | 
                            if ($show_slide) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    150
                 | 
                                    
                                                     | 
                
                 | 
                                $announcements = SystemAnnouncementManager::displayAnnouncementsSlider(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    151
                 | 
                                    
                                                     | 
                
                 | 
                                    $visibility,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    152
                 | 
                                    
                                                     | 
                
                 | 
                                    $announcement  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    153
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    154
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    155
                 | 
                                    
                                                     | 
                
                 | 
                                $announcements = SystemAnnouncementManager::displayAllAnnouncements(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    156
                 | 
                                    
                                                     | 
                
                 | 
                                    $visibility,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    157
                 | 
                                    
                                                     | 
                
                 | 
                                    $announcement  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    158
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    159
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    160
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    161
                 | 
                                    
                                                     | 
                
                 | 
                            if ($show_slide) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    162
                 | 
                                    
                                                     | 
                
                 | 
                                $announcements = SystemAnnouncementManager::displayAnnouncementsSlider(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    163
                 | 
                                    
                                                     | 
                
                 | 
                                    SystemAnnouncementManager::VISIBLE_GUEST,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    164
                 | 
                                    
                                                     | 
                
                 | 
                                    $announcement  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    165
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    166
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    167
                 | 
                                    
                                                     | 
                
                 | 
                                $announcements = SystemAnnouncementManager::displayAllAnnouncements(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    168
                 | 
                                    
                                                     | 
                
                 | 
                                    SystemAnnouncementManager::VISIBLE_GUEST,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    169
                 | 
                                    
                                                     | 
                
                 | 
                                    $announcement  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    170
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    171
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    172
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    173
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    174
                 | 
                                    
                                                     | 
                
                 | 
                        return $announcements;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    175
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    176
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    177
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    178
                 | 
                                    
                                                     | 
                
                 | 
                     * Alias for the online_logout() function.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    179
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    180
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool  $redirect   Whether to ask online_logout to redirect to index.php or not  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    181
                 | 
                                    
                                                     | 
                
                 | 
                     * @param array $logoutInfo Information stored by local.inc.php before new context ['uid'=> x, 'cid'=>y, 'sid'=>z]  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    182
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    183
                 | 
                                    
                                                     | 
                
                 | 
                    public function logout($redirect = true, $logoutInfo = [])  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    184
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    185
                 | 
                                    
                                                     | 
                
                 | 
                        online_logout($this->user_id, true);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    186
                 | 
                                    
                                                     | 
                
                 | 
                        Event::courseLogout($logoutInfo);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    187
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    188
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    189
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    190
                 | 
                                    
                                                     | 
                
                 | 
                     * Includes a created page.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    191
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    192
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool $getIncludedFile Whether to include a file as provided in URL GET or simply the homepage  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    193
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    194
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    195
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    196
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_home_page($getIncludedFile = false)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    197
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    198
                 | 
                                    
                                                     | 
                
                 | 
                        $userId = api_get_user_id();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    199
                 | 
                                    
                                                     | 
                
                 | 
                        // Including the page for the news  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    200
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    201
                 | 
                                    
                                                     | 
                
                 | 
                        if ($getIncludedFile === true) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    202
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['include'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    203
                 | 
                                    
                                                     | 
                
                 | 
                                $open = @(string) file_get_contents($this->home.$_GET['include']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    204
                 | 
                                    
                                                     | 
                
                 | 
                                $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    205
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    206
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    207
                 | 
                                    
                                                     | 
                
                 | 
                            // Hiding home top when user not connected.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    208
                 | 
                                    
                                                     | 
                
                 | 
                            $hideTop = api_get_setting('hide_home_top_when_connected'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    209
                 | 
                                    
                                                     | 
                
                 | 
                            if ($hideTop == 'true' && !empty($userId)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    210
                 | 
                                    
                                                     | 
                
                 | 
                                return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    211
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    212
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    213
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($_SESSION['user_language_choice'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    214
                 | 
                                    
                                                     | 
                
                 | 
                                $user_selected_language = $_SESSION['user_language_choice'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    215
                 | 
                                    
                                                     | 
                
                 | 
                            } elseif (!empty($_SESSION['_user']['language'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    216
                 | 
                                    
                                                     | 
                
                 | 
                                $user_selected_language = $_SESSION['_user']['language'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    217
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    218
                 | 
                                    
                                                     | 
                
                 | 
                                $user_selected_language = api_get_setting('platformLanguage'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    219
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    220
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    221
                 | 
                                    
                                                     | 
                
                 | 
                            $home_top_temp = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    222
                 | 
                                    
                                                     | 
                
                 | 
                            // Try language specific home  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    223
                 | 
                                    
                                                     | 
                
                 | 
                            if (file_exists($this->home.'home_top_'.$user_selected_language.'.html')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    224
                 | 
                                    
                                                     | 
                
                 | 
                                $home_top_temp = file_get_contents($this->home.'home_top_'.$user_selected_language.'.html');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    225
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    226
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    227
                 | 
                                    
                                                     | 
                
                 | 
                            // Try default language home  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    228
                 | 
                                    
                                                     | 
                
                 | 
                            if (empty($home_top_temp)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    229
                 | 
                                    
                                                     | 
                
                 | 
                                if (file_exists($this->home.'home_top.html')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    230
                 | 
                                    
                                                     | 
                
                 | 
                                    $home_top_temp = file_get_contents($this->home.'home_top.html');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    231
                 | 
                                    
                                                     | 
                
                 | 
                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    232
                 | 
                                    
                                                     | 
                
                 | 
                                    if (file_exists($this->default_home.'home_top.html')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    233
                 | 
                                    
                                                     | 
                
                 | 
                                        $home_top_temp = file_get_contents($this->default_home.'home_top.html');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    234
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    235
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    236
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    237
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    238
                 | 
                                    
                                                     | 
                
                 | 
                            if (trim($home_top_temp) == '' && api_is_platform_admin()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    239
                 | 
                                    
                                                     | 
                
                 | 
                                $home_top_temp = get_lang('PortalHomepageDefaultIntroduction'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    240
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    241
                 | 
                                    
                                                     | 
                
                 | 
                            $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    242
                 | 
                                    
                                                     | 
                
                 | 
                            $html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    243
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    244
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    245
                 | 
                                    
                                                     | 
                
                 | 
                        return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    246
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    247
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    248
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    249
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    250
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    251
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_notice()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    252
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    253
                 | 
                                    
                                                     | 
                
                 | 
                        $user_selected_language = api_get_interface_language();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    254
                 | 
                                    
                                                     | 
                
                 | 
                        // Notice  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    255
                 | 
                                    
                                                     | 
                
                 | 
                        $home_notice = @(string) file_get_contents($this->home.'home_notice_'.$user_selected_language.'.html');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    256
                 | 
                                    
                                                     | 
                
                 | 
                        if (empty($home_notice)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    257
                 | 
                                    
                                                     | 
                
                 | 
                            $home_notice = @(string) file_get_contents($this->home.'home_notice.html');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    258
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    259
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($home_notice)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    260
                 | 
                                    
                                                     | 
                
                 | 
                            $home_notice = api_to_system_encoding($home_notice, api_detect_encoding(strip_tags($home_notice)));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    261
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    262
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    263
                 | 
                                    
                                                     | 
                
                 | 
                        return $home_notice;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    264
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    265
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    266
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    267
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    268
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    269
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_help()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    270
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    271
                 | 
                                    
                                                     | 
                
                 | 
                        $user_selected_language = api_get_interface_language();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    272
                 | 
                                    
                                                     | 
                
                 | 
                        $platformLanguage = api_get_setting('platformLanguage'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    273
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    274
                 | 
                                    
                                                     | 
                
                 | 
                        // Help section.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    275
                 | 
                                    
                                                     | 
                
                 | 
                        /* Hide right menu "general" and other parts on anonymous right menu. */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    276
                 | 
                                    
                                                     | 
                
                 | 
                        if (!isset($user_selected_language)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    277
                 | 
                                    
                                                     | 
                
                 | 
                            $user_selected_language = $platformLanguage;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    278
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    279
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    280
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    281
                 | 
                                    
                                                     | 
                
                 | 
                        $home_menu = @(string) file_get_contents($this->home.'home_menu_'.$user_selected_language.'.html');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    282
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($home_menu)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    283
                 | 
                                    
                                                     | 
                
                 | 
                            $html = api_to_system_encoding($home_menu, api_detect_encoding(strip_tags($home_menu)));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    284
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    285
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    286
                 | 
                                    
                                                     | 
                
                 | 
                        return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    287
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    288
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    289
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    290
                 | 
                                    
                                                     | 
                
                 | 
                     * Generate the block for show a panel with links to My Certificates and Certificates Search pages.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    291
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    292
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array The HTML code for the panel  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    293
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    294
                 | 
                                    
                                                     | 
                
                 | 
                    public function returnSkillLinks()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    295
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    296
                 | 
                                    
                                                     | 
                
                 | 
                        $items = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    297
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    298
                 | 
                                    
                                                     | 
                
                 | 
                        if (!api_is_anonymous() &&  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    299
                 | 
                                    
                                                     | 
                
                 | 
                            api_get_configuration_value('hide_my_certificate_link') === false | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    300
                 | 
                                    
                                                     | 
                
                 | 
                        ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    301
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    302
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('graduation.png', get_lang('MyCertificates')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    303
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'gradebook/my_certificates.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    304
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('MyCertificates'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    305
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    306
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    307
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('allow_public_certificates') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    308
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    309
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('search_graduation.png', get_lang('Search')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    310
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'gradebook/search.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    311
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('Search'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    312
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    313
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    314
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    315
                 | 
                                    
                                                     | 
                
                 | 
                        $myCertificate = GradebookUtils::get_certificate_by_user_id(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    316
                 | 
                                    
                                                     | 
                
                 | 
                            +0,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    317
                 | 
                                    
                                                     | 
                
                 | 
                            $this->user_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    318
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    319
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    320
                 | 
                                    
                                                     | 
                
                 | 
                        if ($myCertificate) { | 
            
                            
                    | 
                        
                     | 
                     | 
                     | 
                    
                                                                                                    
                        
                         
                                                                                        
                                                                                     
                     | 
                
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    321
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    322
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    323
                 | 
                                    
                                                     | 
                
                 | 
                                    'skill-badges.png',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    324
                 | 
                                    
                                                     | 
                
                 | 
                                    get_lang('MyGeneralCertificate'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    325
                 | 
                                    
                                                     | 
                
                 | 
                                    null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    326
                 | 
                                    
                                                     | 
                
                 | 
                                    ICON_SIZE_SMALL  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    327
                 | 
                                    
                                                     | 
                
                 | 
                                ),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    328
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'social/my_skills_report.php?a=generate_custom_skill',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    329
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('MyGeneralCertificate'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    330
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    331
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    332
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    333
                 | 
                                    
                                                     | 
                
                 | 
                        if (Skill::isAllowed(api_get_user_id(), false)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    334
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    335
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('skill-badges.png', get_lang('MySkills')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    336
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'social/my_skills_report.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    337
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('MySkills'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    338
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    339
                 | 
                                    
                                                     | 
                
                 | 
                            $allowSkillsManagement = api_get_setting('allow_hr_skills_management') == 'true'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    340
                 | 
                                    
                                                     | 
                
                 | 
                            if (($allowSkillsManagement && api_is_drh()) || api_is_platform_admin()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    341
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    342
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('edit-skill.png', get_lang('MySkills')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    343
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'admin/skills_wheel.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    344
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('ManageSkills'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    345
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    346
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    347
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    348
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    349
                 | 
                                    
                                                     | 
                
                 | 
                        return $items;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    350
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    351
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    352
                 | 
                                    
                                                     | 
                
                 | 
                    public static function studentPublicationBlock()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    353
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    354
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_anonymous()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    355
                 | 
                                    
                                                     | 
                
                 | 
                            return [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    356
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    357
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    358
                 | 
                                    
                                                     | 
                
                 | 
                        $allow = api_get_configuration_value('allow_my_student_publication_page'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    359
                 | 
                                    
                                                     | 
                
                 | 
                        $items = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    360
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    361
                 | 
                                    
                                                     | 
                
                 | 
                        if ($allow) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    362
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    363
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('lp_student_publication.png', get_lang('StudentPublications')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    364
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'work/publications.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    365
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('MyStudentPublications'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    366
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    367
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    368
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    369
                 | 
                                    
                                                     | 
                
                 | 
                        return $items;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    370
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    371
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    372
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    373
                 | 
                                    
                                                     | 
                
                 | 
                     * Reacts on a failed login:  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    374
                 | 
                                    
                                                     | 
                
                 | 
                     * Displays an explanation with a link to the registration form.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    375
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    376
                 | 
                                    
                                                     | 
                
                 | 
                     * @version 1.0.1  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    377
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    378
                 | 
                                    
                                                     | 
                
                 | 
                    public function handle_login_failed()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    379
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    380
                 | 
                                    
                                                     | 
                
                 | 
                        return $this->tpl->handleLoginFailed();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    381
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    382
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    383
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    384
                 | 
                                    
                                                     | 
                
                 | 
                     * Display list of courses in a category.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    385
                 | 
                                    
                                                     | 
                
                 | 
                     * (for anonymous users).  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    386
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    387
                 | 
                                    
                                                     | 
                
                 | 
                     * @version 1.1  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    388
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    389
                 | 
                                    
                                                     | 
                
                 | 
                     * @author  Patrick Cool <[email protected]>, Ghent University - refactoring and code cleaning  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    390
                 | 
                                    
                                                     | 
                
                 | 
                     * @author  Julio Montoya <[email protected]>, Beeznest template modifs  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    391
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    392
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_courses_in_categories()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    393
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    394
                 | 
                                    
                                                     | 
                
                 | 
                        $result = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    395
                 | 
                                    
                                                     | 
                
                 | 
                        $stok = Security::get_token();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    396
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    397
                 | 
                                    
                                                     | 
                
                 | 
                        // Initialization.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    398
                 | 
                                    
                                                     | 
                
                 | 
                        $user_identified = (api_get_user_id() > 0 && !api_is_anonymous());  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    399
                 | 
                                    
                                                     | 
                
                 | 
                        $web_course_path = api_get_path(WEB_COURSE_PATH);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    400
                 | 
                                    
                                                     | 
                
                 | 
                        $category = isset($_GET['category']) ? Database::escape_string($_GET['category']) : '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    401
                 | 
                                    
                                                     | 
                
                 | 
                        $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    402
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    403
                 | 
                                    
                                                     | 
                
                 | 
                        // Database table definitions.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    404
                 | 
                                    
                                                     | 
                
                 | 
                        $main_course_table = Database::get_main_table(TABLE_MAIN_COURSE);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    405
                 | 
                                    
                                                     | 
                
                 | 
                        $main_category_table = Database::get_main_table(TABLE_MAIN_CATEGORY);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    406
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    407
                 | 
                                    
                                                     | 
                
                 | 
                        // Get list of courses in category $category.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    408
                 | 
                                    
                                                     | 
                
                 | 
                        $sql = "SELECT * FROM $main_course_table cours  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    409
                 | 
                                    
                                                     | 
                
                 | 
                                WHERE category_code = '".$category."'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    410
                 | 
                                    
                                                     | 
                
                 | 
                                ORDER BY title, UPPER(visual_code)";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    411
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    412
                 | 
                                    
                                                     | 
                
                 | 
                        // Showing only the courses of the current access_url_id.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    413
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_multiple_url_enabled()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    414
                 | 
                                    
                                                     | 
                
                 | 
                            $url_access_id = api_get_current_access_url_id();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    415
                 | 
                                    
                                                     | 
                
                 | 
                            if ($url_access_id != -1) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    416
                 | 
                                    
                                                     | 
                
                 | 
                                $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    417
                 | 
                                    
                                                     | 
                
                 | 
                                $sql = "SELECT * FROM $main_course_table as course  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    418
                 | 
                                    
                                                     | 
                
                 | 
                                        INNER JOIN $tbl_url_rel_course as url_rel_course  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    419
                 | 
                                    
                                                     | 
                
                 | 
                                        ON (url_rel_course.c_id = course.id)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    420
                 | 
                                    
                                                     | 
                
                 | 
                                        WHERE  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    421
                 | 
                                    
                                                     | 
                
                 | 
                                            access_url_id = $url_access_id AND  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    422
                 | 
                                    
                                                     | 
                
                 | 
                                            category_code = '".$category."'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    423
                 | 
                                    
                                                     | 
                
                 | 
                                        ORDER BY title, UPPER(visual_code)";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    424
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    425
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    426
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    427
                 | 
                                    
                                                     | 
                
                 | 
                        // Removed: AND cours.visibility='".COURSE_VISIBILITY_OPEN_WORLD."'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    428
                 | 
                                    
                                                     | 
                
                 | 
                        $queryResult = Database::query($sql);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    429
                 | 
                                    
                                                     | 
                
                 | 
                        while ($course_result = Database::fetch_array($queryResult)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    430
                 | 
                                    
                                                     | 
                
                 | 
                            $course_list[] = $course_result;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    431
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    432
                 | 
                                    
                                                     | 
                
                 | 
                        $numRows = Database::num_rows($queryResult);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    433
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    434
                 | 
                                    
                                                     | 
                
                 | 
                        // $setting_show_also_closed_courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    435
                 | 
                                    
                                                     | 
                
                 | 
                        if ($user_identified) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    436
                 | 
                                    
                                                     | 
                
                 | 
                            if ($setting_show_also_closed_courses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    437
                 | 
                                    
                                                     | 
                
                 | 
                                $platform_visible_courses = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    438
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    439
                 | 
                                    
                                                     | 
                
                 | 
                                $platform_visible_courses = "  AND (t3.visibility='".COURSE_VISIBILITY_OPEN_WORLD."' OR t3.visibility='".COURSE_VISIBILITY_OPEN_PLATFORM."' )";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    440
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    441
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    442
                 | 
                                    
                                                     | 
                
                 | 
                            if ($setting_show_also_closed_courses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    443
                 | 
                                    
                                                     | 
                
                 | 
                                $platform_visible_courses = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    444
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    445
                 | 
                                    
                                                     | 
                
                 | 
                                $platform_visible_courses = "  AND (t3.visibility='".COURSE_VISIBILITY_OPEN_WORLD."' )";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    446
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    447
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    448
                 | 
                                    
                                                     | 
                
                 | 
                        $sqlGetSubCatList = "  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    449
                 | 
                                    
                                                     | 
                
                 | 
                                    SELECT  t1.name,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    450
                 | 
                                    
                                                     | 
                
                 | 
                                            t1.code,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    451
                 | 
                                    
                                                     | 
                
                 | 
                                            t1.parent_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    452
                 | 
                                    
                                                     | 
                
                 | 
                                            t1.children_count,COUNT(DISTINCT t3.code) AS nbCourse  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    453
                 | 
                                    
                                                     | 
                
                 | 
                                    FROM $main_category_table t1  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    454
                 | 
                                    
                                                     | 
                
                 | 
                                    LEFT JOIN $main_category_table t2  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    455
                 | 
                                    
                                                     | 
                
                 | 
                                    ON t1.code=t2.parent_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    456
                 | 
                                    
                                                     | 
                
                 | 
                                    LEFT JOIN $main_course_table t3  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    457
                 | 
                                    
                                                     | 
                
                 | 
                                    ON (t3.category_code = t1.code $platform_visible_courses)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    458
                 | 
                                    
                                                     | 
                
                 | 
                                    WHERE t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")."  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    459
                 | 
                                    
                                                     | 
                
                 | 
                                    GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    460
                 | 
                                    
                                                     | 
                
                 | 
                                    ORDER BY t1.tree_pos, t1.name";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    461
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    462
                 | 
                                    
                                                     | 
                
                 | 
                        // Showing only the category of courses of the current access_url_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    463
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_multiple_url_enabled()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    464
                 | 
                                    
                                                     | 
                
                 | 
                            $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    465
                 | 
                                    
                                                     | 
                
                 | 
                            $courseCategoryCondition = " INNER JOIN $table a ON (t1.id = a.course_category_id)";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    466
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    467
                 | 
                                    
                                                     | 
                
                 | 
                            $url_access_id = api_get_current_access_url_id();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    468
                 | 
                                    
                                                     | 
                
                 | 
                            if ($url_access_id != -1) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    469
                 | 
                                    
                                                     | 
                
                 | 
                                $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    470
                 | 
                                    
                                                     | 
                
                 | 
                                $sqlGetSubCatList = "  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    471
                 | 
                                    
                                                     | 
                
                 | 
                                    SELECT t1.name,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    472
                 | 
                                    
                                                     | 
                
                 | 
                                            t1.code,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    473
                 | 
                                    
                                                     | 
                
                 | 
                                            t1.parent_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    474
                 | 
                                    
                                                     | 
                
                 | 
                                            t1.children_count,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    475
                 | 
                                    
                                                     | 
                
                 | 
                                            COUNT(DISTINCT t3.code) AS nbCourse  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    476
                 | 
                                    
                                                     | 
                
                 | 
                                    FROM $main_category_table t1  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    477
                 | 
                                    
                                                     | 
                
                 | 
                                    $courseCategoryCondition  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    478
                 | 
                                    
                                                     | 
                
                 | 
                                    LEFT JOIN $main_category_table t2 ON t1.code = t2.parent_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    479
                 | 
                                    
                                                     | 
                
                 | 
                                    LEFT JOIN $main_course_table t3 ON (t3.category_code = t1.code $platform_visible_courses)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    480
                 | 
                                    
                                                     | 
                
                 | 
                                    INNER JOIN $tbl_url_rel_course as url_rel_course  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    481
                 | 
                                    
                                                     | 
                
                 | 
                                    ON (url_rel_course.c_id = t3.id)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    482
                 | 
                                    
                                                     | 
                
                 | 
                                    WHERE  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    483
                 | 
                                    
                                                     | 
                
                 | 
                                        url_rel_course.access_url_id = $url_access_id AND  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    484
                 | 
                                    
                                                     | 
                
                 | 
                                        t1.parent_id ".(empty($category) ? "IS NULL" : "='$category'")."  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    485
                 | 
                                    
                                                     | 
                
                 | 
                                    GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    486
                 | 
                                    
                                                     | 
                
                 | 
                                    ORDER BY t1.tree_pos, t1.name";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    487
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    488
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    489
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    490
                 | 
                                    
                                                     | 
                
                 | 
                        $resCats = Database::query($sqlGetSubCatList);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    491
                 | 
                                    
                                                     | 
                
                 | 
                        $thereIsSubCat = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    492
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    493
                 | 
                                    
                                                     | 
                
                 | 
                        $htmlTitre = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    494
                 | 
                                    
                                                     | 
                
                 | 
                        $htmlListCat = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    495
                 | 
                                    
                                                     | 
                
                 | 
                        if (Database::num_rows($resCats) > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    496
                 | 
                                    
                                                     | 
                
                 | 
                            $htmlListCat = Display::page_header(get_lang('CatList')); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    497
                 | 
                                    
                                                     | 
                
                 | 
                            $htmlListCat .= '<ul>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    498
                 | 
                                    
                                                     | 
                
                 | 
                            while ($catLine = Database::fetch_array($resCats)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    499
                 | 
                                    
                                                     | 
                
                 | 
                                $category_has_open_courses = self::category_has_open_courses($catLine['code']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    500
                 | 
                                    
                                                     | 
                
                 | 
                                if ($category_has_open_courses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    501
                 | 
                                    
                                                     | 
                
                 | 
                                    // The category contains courses accessible to anonymous visitors.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    502
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= '<li>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    503
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= '<a href="'.api_get_self(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    504
                 | 
                                    
                                                     | 
                
                 | 
                                        ).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    505
                 | 
                                    
                                                     | 
                
                 | 
                                    if (api_get_setting('show_number_of_courses') == 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    506
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlListCat .= ' ('.$catLine['nbCourse'].' '.get_lang('Courses').')'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    507
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    508
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= "</li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    509
                 | 
                                    
                                                     | 
                
                 | 
                                    $thereIsSubCat = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    510
                 | 
                                    
                                                     | 
                
                 | 
                                } elseif ($catLine['children_count'] > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    511
                 | 
                                    
                                                     | 
                
                 | 
                                    // The category has children, subcategories.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    512
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= '<li>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    513
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= '<a href="'.api_get_self(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    514
                 | 
                                    
                                                     | 
                
                 | 
                                        ).'?category='.$catLine['code'].'">'.$catLine['name'].'</a>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    515
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= "</li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    516
                 | 
                                    
                                                     | 
                
                 | 
                                    $thereIsSubCat = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    517
                 | 
                                    
                                                     | 
                
                 | 
                                } elseif (api_get_setting('show_empty_course_categories') == 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    518
                 | 
                                    
                                                     | 
                
                 | 
                                    /* End changed code to eliminate the (0 courses) after empty categories. */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    519
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= '<li>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    520
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= $catLine['name'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    521
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlListCat .= "</li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    522
                 | 
                                    
                                                     | 
                
                 | 
                                    $thereIsSubCat = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    523
                 | 
                                    
                                                     | 
                
                 | 
                                } // Else don't set thereIsSubCat to true to avoid printing things if not requested.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    524
                 | 
                                    
                                                     | 
                
                 | 
                                // TODO: deprecate this useless feature - this includes removing system variable  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    525
                 | 
                                    
                                                     | 
                
                 | 
                                if (empty($htmlTitre)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    526
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlTitre = '<p>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    527
                 | 
                                    
                                                     | 
                
                 | 
                                    if (api_get_setting('show_back_link_on_top_of_tree') == 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    528
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlTitre .= '<a href="'.api_get_self().'"><< '.get_lang('BackToHomePage').'</a>'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    529
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    530
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlTitre .= "</p>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    531
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    532
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    533
                 | 
                                    
                                                     | 
                
                 | 
                            $htmlListCat .= "</ul>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    534
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    535
                 | 
                                    
                                                     | 
                
                 | 
                        $result .= $htmlTitre;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    536
                 | 
                                    
                                                     | 
                
                 | 
                        if ($thereIsSubCat) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    537
                 | 
                                    
                                                     | 
                
                 | 
                            $result .= $htmlListCat;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    538
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    539
                 | 
                                    
                                                     | 
                
                 | 
                        while ($categoryName = Database::fetch_array($resCats)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    540
                 | 
                                    
                                                     | 
                
                 | 
                            $result .= '<h3>'.$categoryName['name']."</h3>\n";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    541
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    542
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    543
                 | 
                                    
                                                     | 
                
                 | 
                        $courses_list_string = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    544
                 | 
                                    
                                                     | 
                
                 | 
                        $courses_shown = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    545
                 | 
                                    
                                                     | 
                
                 | 
                        if ($numRows > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    546
                 | 
                                    
                                                     | 
                
                 | 
                            $courses_list_string .= Display::page_header(get_lang('CourseList')); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    547
                 | 
                                    
                                                     | 
                
                 | 
                            $courses_list_string .= "<ul>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    548
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_user_id()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    549
                 | 
                                    
                                                     | 
                
                 | 
                                $courses_of_user = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    550
                 | 
                                    
                                                     | 
                
                 | 
                                $coursesByUserCategory = CourseManager::getCoursesByUserCourseCategory(api_get_user_id());  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    551
                 | 
                                    
                                                     | 
                
                 | 
                                if (!empty($coursesByUserCategory)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    552
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($coursesByUserCategory as $courseItem) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    553
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_of_user[$courseItem['code']] = $courseItem;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    554
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    555
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    556
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    557
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($course_list as $course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    558
                 | 
                                    
                                                     | 
                
                 | 
                                // $setting_show_also_closed_courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    559
                 | 
                                    
                                                     | 
                
                 | 
                                if ($course['visibility'] == COURSE_VISIBILITY_HIDDEN) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    560
                 | 
                                    
                                                     | 
                
                 | 
                                    continue;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    561
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    562
                 | 
                                    
                                                     | 
                
                 | 
                                if (!$setting_show_also_closed_courses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    563
                 | 
                                    
                                                     | 
                
                 | 
                                    // If we do not show the closed courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    564
                 | 
                                    
                                                     | 
                
                 | 
                                    // we only show the courses that are open to the world (to everybody)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    565
                 | 
                                    
                                                     | 
                
                 | 
                                    // and the courses that are open to the platform (if the current user is a registered user.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    566
                 | 
                                    
                                                     | 
                
                 | 
                                    if (($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM) ||  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    567
                 | 
                                    
                                                     | 
                
                 | 
                                        ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    568
                 | 
                                    
                                                     | 
                
                 | 
                                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    569
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_shown++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    570
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_list_string .= "<li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    571
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">'.$course['title'].'</a><br />';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    572
                 | 
                                    
                                                     | 
                
                 | 
                                        $course_details = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    573
                 | 
                                    
                                                     | 
                
                 | 
                                        if (api_get_setting('display_coursecode_in_courselist') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    574
                 | 
                                    
                                                     | 
                
                 | 
                                            $course_details[] = '('.$course['visual_code'].')'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    575
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    576
                 | 
                                    
                                                     | 
                
                 | 
                                        if (api_get_setting('display_teacher_in_courselist') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    577
                 | 
                                    
                                                     | 
                
                 | 
                                            $course_details[] = CourseManager::getTeacherListFromCourseCodeToString($course['code']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    578
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    579
                 | 
                                    
                                                     | 
                
                 | 
                                        if (api_get_setting('show_different_course_language') === 'true' && | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    580
                 | 
                                    
                                                     | 
                
                 | 
                                            $course['course_language'] != api_get_setting('platformLanguage') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    581
                 | 
                                    
                                                     | 
                
                 | 
                                        ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    582
                 | 
                                    
                                                     | 
                
                 | 
                                            $course_details[] = $course['course_language'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    583
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    584
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_list_string .= implode(' - ', $course_details); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    585
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_list_string .= "</li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    586
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    587
                 | 
                                    
                                                     | 
                
                 | 
                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    588
                 | 
                                    
                                                     | 
                
                 | 
                                    // We DO show the closed courses.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    589
                 | 
                                    
                                                     | 
                
                 | 
                                    // The course is accessible if (link to the course homepage):  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    590
                 | 
                                    
                                                     | 
                
                 | 
                                    // 1. the course is open to the world (doesn't matter if the user is logged in or not): $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    591
                 | 
                                    
                                                     | 
                
                 | 
                                    // 2. the user is logged in and the course is open to the world or open to the platform: ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    592
                 | 
                                    
                                                     | 
                
                 | 
                                    // 3. the user is logged in and the user is subscribed to the course and the course visibility is not COURSE_VISIBILITY_CLOSED;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    593
                 | 
                                    
                                                     | 
                
                 | 
                                    // 4. the user is logged in and the user is course admin of te course (regardless of the course visibility setting);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    594
                 | 
                                    
                                                     | 
                
                 | 
                                    // 5. the user is the platform admin api_is_platform_admin().  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    595
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    596
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses_shown++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    597
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses_list_string .= "<li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    598
                 | 
                                    
                                                     | 
                
                 | 
                                    if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    599
                 | 
                                    
                                                     | 
                
                 | 
                                        || ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    600
                 | 
                                    
                                                     | 
                
                 | 
                                        || ($user_identified && array_key_exists($course['code'], $courses_of_user)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    601
                 | 
                                    
                                                     | 
                
                 | 
                                            && $course['visibility'] != COURSE_VISIBILITY_CLOSED)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    602
                 | 
                                    
                                                     | 
                
                 | 
                                        || $courses_of_user[$course['code']]['status'] == '1'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    603
                 | 
                                    
                                                     | 
                
                 | 
                                        || api_is_platform_admin()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    604
                 | 
                                    
                                                     | 
                
                 | 
                                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    605
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_list_string .= '<a href="'.$web_course_path.$course['directory'].'/">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    606
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    607
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses_list_string .= $course['title'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    608
                 | 
                                    
                                                     | 
                
                 | 
                                    if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    609
                 | 
                                    
                                                     | 
                
                 | 
                                        || ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    610
                 | 
                                    
                                                     | 
                
                 | 
                                        || ($user_identified && array_key_exists($course['code'], $courses_of_user)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    611
                 | 
                                    
                                                     | 
                
                 | 
                                            && $course['visibility'] != COURSE_VISIBILITY_CLOSED)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    612
                 | 
                                    
                                                     | 
                
                 | 
                                        || $courses_of_user[$course['code']]['status'] == '1'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    613
                 | 
                                    
                                                     | 
                
                 | 
                                        || api_is_platform_admin()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    614
                 | 
                                    
                                                     | 
                
                 | 
                                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    615
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses_list_string .= '</a><br />';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    616
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    617
                 | 
                                    
                                                     | 
                
                 | 
                                    $course_details = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    618
                 | 
                                    
                                                     | 
                
                 | 
                                    if (api_get_setting('display_coursecode_in_courselist') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    619
                 | 
                                    
                                                     | 
                
                 | 
                                        $course_details[] = '('.$course['visual_code'].')'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    620
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    621
                 | 
                                    
                                                     | 
                
                 | 
                                    if (api_get_setting('display_teacher_in_courselist') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    622
                 | 
                                    
                                                     | 
                
                 | 
                                        if (!empty($course['tutor_name'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    623
                 | 
                                    
                                                     | 
                
                 | 
                                            $course_details[] = $course['tutor_name'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    624
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    625
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    626
                 | 
                                    
                                                     | 
                
                 | 
                                    if (api_get_setting('show_different_course_language') == 'true' && | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    627
                 | 
                                    
                                                     | 
                
                 | 
                                        $course['course_language'] != api_get_setting('platformLanguage') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    628
                 | 
                                    
                                                     | 
                
                 | 
                                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    629
                 | 
                                    
                                                     | 
                
                 | 
                                        $course_details[] = $course['course_language'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    630
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    631
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    632
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses_list_string .= implode(' - ', $course_details); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    633
                 | 
                                    
                                                     | 
                
                 | 
                                    // We display a subscription link if:  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    634
                 | 
                                    
                                                     | 
                
                 | 
                                    // 1. it is allowed to register for the course and if the course is not already in  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    635
                 | 
                                    
                                                     | 
                
                 | 
                                    // the courselist of the user and if the user is identified  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    636
                 | 
                                    
                                                     | 
                
                 | 
                                    // 2.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    637
                 | 
                                    
                                                     | 
                
                 | 
                                    if ($user_identified && !array_key_exists($course['code'], $courses_of_user)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    638
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($course['subscribe'] == '1') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    639
                 | 
                                    
                                                     | 
                
                 | 
                                            $courses_list_string .= ' <a class="btn btn-primary" href="main/auth/courses.php?action=subscribe_course&sec_token='.$stok.'&course_code='.$course['code'].'&category_code='.Security::remove_XSS(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    640
                 | 
                                    
                                                     | 
                
                 | 
                                                    $_GET['category']  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    641
                 | 
                                    
                                                     | 
                
                 | 
                                                ).'">'.get_lang('Subscribe').'</a><br />'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    642
                 | 
                                    
                                                     | 
                
                 | 
                                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    643
                 | 
                                    
                                                     | 
                
                 | 
                                            $courses_list_string .= '<br />'.get_lang('SubscribingNotAllowed'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    644
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    645
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    646
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses_list_string .= "</li>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    647
                 | 
                                    
                                                     | 
                
                 | 
                                } //end else  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    648
                 | 
                                    
                                                     | 
                
                 | 
                            } // end foreach  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    649
                 | 
                                    
                                                     | 
                
                 | 
                            $courses_list_string .= "</ul>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    650
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    651
                 | 
                                    
                                                     | 
                
                 | 
                        if ($courses_shown > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    652
                 | 
                                    
                                                     | 
                
                 | 
                            // Only display the list of courses and categories if there was more than  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    653
                 | 
                                    
                                                     | 
                
                 | 
                            // 0 courses visible to the world (we're in the anonymous list here).  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    654
                 | 
                                    
                                                     | 
                
                 | 
                            $result .= $courses_list_string;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    655
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    656
                 | 
                                    
                                                     | 
                
                 | 
                        if ($category != '') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    657
                 | 
                                    
                                                     | 
                
                 | 
                            $result .= '<p><a href="'.api_get_self().'">'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    658
                 | 
                                    
                                                     | 
                
                 | 
                                .Display::return_icon('back.png', get_lang('BackToHomePage')) | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    659
                 | 
                                    
                                                     | 
                
                 | 
                                .get_lang('BackToHomePage').'</a></p>'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    660
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    661
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    662
                 | 
                                    
                                                     | 
                
                 | 
                        return $result;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    663
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    664
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    665
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    666
                 | 
                                    
                                                     | 
                
                 | 
                     * This function checks if there are courses that are open to the world in the platform course categories  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    667
                 | 
                                    
                                                     | 
                
                 | 
                     * (=faculties).  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    668
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    669
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    670
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    671
                 | 
                                    
                                                     | 
                
                 | 
                     * @return bool  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    672
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    673
                 | 
                                    
                                                     | 
                
                 | 
                    public function category_has_open_courses($category)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    674
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    675
                 | 
                                    
                                                     | 
                
                 | 
                        $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    676
                 | 
                                    
                                                     | 
                
                 | 
                        $main_course_table = Database::get_main_table(TABLE_MAIN_COURSE);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    677
                 | 
                                    
                                                     | 
                
                 | 
                        $category = Database::escape_string($category);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    678
                 | 
                                    
                                                     | 
                
                 | 
                        $sql_query = "SELECT * FROM $main_course_table WHERE category_code='$category'";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    679
                 | 
                                    
                                                     | 
                
                 | 
                        $sql_result = Database::query($sql_query);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    680
                 | 
                                    
                                                     | 
                
                 | 
                        while ($course = Database::fetch_array($sql_result)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    681
                 | 
                                    
                                                     | 
                
                 | 
                            if (!$setting_show_also_closed_courses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    682
                 | 
                                    
                                                     | 
                
                 | 
                                if ((api_get_user_id() > 0 && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM) ||  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    683
                 | 
                                    
                                                     | 
                
                 | 
                                    ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    684
                 | 
                                    
                                                     | 
                
                 | 
                                ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    685
                 | 
                                    
                                                     | 
                
                 | 
                                    return true; //at least one open course  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    686
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    687
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    688
                 | 
                                    
                                                     | 
                
                 | 
                                if (isset($course['visibility'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    689
                 | 
                                    
                                                     | 
                
                 | 
                                    return true; // At least one course (it does not matter weither it's open or not because $setting_show_also_closed_courses = true).  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    690
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    691
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    692
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    693
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    694
                 | 
                                    
                                                     | 
                
                 | 
                        return false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    695
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    696
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    697
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    698
                 | 
                                    
                                                     | 
                
                 | 
                     * Adds a form to let users login.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    699
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    700
                 | 
                                    
                                                     | 
                
                 | 
                     * @version 1.1  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    701
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    702
                 | 
                                    
                                                     | 
                
                 | 
                    public function display_login_form()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    703
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    704
                 | 
                                    
                                                     | 
                
                 | 
                        return $this->tpl->displayLoginForm();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    705
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    706
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    707
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    708
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    709
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    710
                 | 
                                    
                                                     | 
                
                 | 
                     * @todo use FormValidator  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    711
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    712
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_search_block()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    713
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    714
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    715
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('search_enabled') == 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    716
                 | 
                                    
                                                     | 
                
                 | 
                            $search_btn = get_lang('Search'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    717
                 | 
                                    
                                                     | 
                
                 | 
                            $search_content = '<form action="main/search/" method="post">  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    718
                 | 
                                    
                                                     | 
                
                 | 
                                <div class="form-group">  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    719
                 | 
                                    
                                                     | 
                
                 | 
                                <input type="text" id="query" class="form-control" name="query" value="" />  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    720
                 | 
                                    
                                                     | 
                
                 | 
                                <button class="btn btn-default" type="submit" name="submit" value="'.$search_btn.'" />'.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    721
                 | 
                                    
                                                     | 
                
                 | 
                                $search_btn.' </button>  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    722
                 | 
                                    
                                                     | 
                
                 | 
                                </div></form>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    723
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= $this->showRightBlock(get_lang('Search'), $search_content, 'search_block'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    724
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    725
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    726
                 | 
                                    
                                                     | 
                
                 | 
                        return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    727
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    728
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    729
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    730
                 | 
                                    
                                                     | 
                
                 | 
                     * @param        $title  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    731
                 | 
                                    
                                                     | 
                
                 | 
                     * @param        $content  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    732
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    733
                 | 
                                    
                                                     | 
                
                 | 
                     * @param array  $params  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    734
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $idAccordion  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    735
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $idCollapse  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    736
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    737
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    738
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    739
                 | 
                                    
                                                     | 
                
                 | 
                     * @todo use the template system  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    740
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    741
                 | 
                                    
                                                     | 
                
                 | 
                    public function showRightBlock(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    742
                 | 
                                    
                                                     | 
                
                 | 
                        $title,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    743
                 | 
                                    
                                                     | 
                
                 | 
                        $content,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    744
                 | 
                                    
                                                     | 
                
                 | 
                        $id = '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    745
                 | 
                                    
                                                     | 
                
                 | 
                        $params = [],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    746
                 | 
                                    
                                                     | 
                
                 | 
                        $idAccordion = '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    747
                 | 
                                    
                                                     | 
                
                 | 
                        $idCollapse = ''  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    748
                 | 
                                    
                                                     | 
                
                 | 
                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    749
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    750
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($idAccordion)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    751
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<div class="panel-group" id="'.$idAccordion.'" role="tablist" aria-multiselectable="true">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    752
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<div class="panel panel-default" id="'.$id.'">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    753
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<div class="panel-heading" role="tab"><h4 class="panel-title">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    754
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<a role="button" data-toggle="collapse" data-parent="#'.$idAccordion.'" href="#'.$idCollapse.'" aria-expanded="true" aria-controls="'.$idCollapse.'">'.$title.'</a>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    755
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '</h4></div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    756
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<div id="'.$idCollapse.'" class="panel-collapse collapse in" role="tabpanel">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    757
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<div class="panel-body">'.$content.'</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    758
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '</div></div></div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    759
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    760
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($id)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    761
                 | 
                                    
                                                     | 
                
                 | 
                                $params['id'] = $id;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    762
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    763
                 | 
                                    
                                                     | 
                
                 | 
                            $params['class'] = 'panel panel-default';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    764
                 | 
                                    
                                                     | 
                
                 | 
                            $html = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    765
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($title)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    766
                 | 
                                    
                                                     | 
                
                 | 
                                $html .= '<div class="panel-heading">'.$title.'</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    767
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    768
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= '<div class="panel-body">'.$content.'</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    769
                 | 
                                    
                                                     | 
                
                 | 
                            $html = Display::div($html, $params);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    770
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    771
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    772
                 | 
                                    
                                                     | 
                
                 | 
                        return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    773
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    774
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    775
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    776
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    777
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    778
                 | 
                                    
                                                     | 
                
                 | 
                    public function returnClassesBlock()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    779
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    780
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('show_groups_to_users') !== 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    781
                 | 
                                    
                                                     | 
                
                 | 
                            return '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    782
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    783
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    784
                 | 
                                    
                                                     | 
                
                 | 
                        $items = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    785
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    786
                 | 
                                    
                                                     | 
                
                 | 
                        $usergroup = new UserGroup();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    787
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_platform_admin()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    788
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    789
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'admin/usergroups.php?action=add',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    790
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('AddClasses'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    791
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    792
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    793
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_is_teacher() && $usergroup->allowTeachers()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    794
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    795
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'admin/usergroups.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    796
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('ClassList'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    797
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    798
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    799
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    800
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    801
                 | 
                                    
                                                     | 
                
                 | 
                        $usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    802
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($usergroup_list)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    803
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($usergroup_list as $group_id) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    804
                 | 
                                    
                                                     | 
                
                 | 
                                $data = $usergroup->get($group_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    805
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    806
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'user/classes.php?id='.$data['id'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    807
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => $data['name'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    808
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    809
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    810
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    811
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    812
                 | 
                                    
                                                     | 
                
                 | 
                        $html = $this->showRightBlock(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    813
                 | 
                                    
                                                     | 
                
                 | 
                            get_lang('Classes'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    814
                 | 
                                    
                                                     | 
                
                 | 
                            self::returnRightBlockItems($items),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    815
                 | 
                                    
                                                     | 
                
                 | 
                            'classes_block'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    816
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    817
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    818
                 | 
                                    
                                                     | 
                
                 | 
                        return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    819
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    820
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    821
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    822
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    823
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    824
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_user_image_block()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    825
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    826
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    827
                 | 
                                    
                                                     | 
                
                 | 
                        if (!api_is_anonymous()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    828
                 | 
                                    
                                                     | 
                
                 | 
                            $userPicture = UserManager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_ORIGINAL);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    829
                 | 
                                    
                                                     | 
                
                 | 
                            $content = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    830
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    831
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_setting('allow_social_tool') == 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    832
                 | 
                                    
                                                     | 
                
                 | 
                                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_CODE_PATH).'social/home.php">  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    833
                 | 
                                    
                                                     | 
                
                 | 
                                <img class="img-circle" src="'.$userPicture.'"></a>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    834
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    835
                 | 
                                    
                                                     | 
                
                 | 
                                $content .= '<a style="text-align:center" href="'.api_get_path(WEB_CODE_PATH).'auth/profile.php">  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    836
                 | 
                                    
                                                     | 
                
                 | 
                                <img class="img-circle" title="'.get_lang('EditProfile').'" src="'.$userPicture.'"></a>'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    837
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    838
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    839
                 | 
                                    
                                                     | 
                
                 | 
                            $html = $this->showRightBlock(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    840
                 | 
                                    
                                                     | 
                
                 | 
                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    841
                 | 
                                    
                                                     | 
                
                 | 
                                $content,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    842
                 | 
                                    
                                                     | 
                
                 | 
                                'user_image_block',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    843
                 | 
                                    
                                                     | 
                
                 | 
                                ['style' => 'text-align:center;']  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    844
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    845
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    846
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    847
                 | 
                                    
                                                     | 
                
                 | 
                        return $html;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    848
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    849
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    850
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    851
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    852
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    853
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_profile_block()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    854
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    855
                 | 
                                    
                                                     | 
                
                 | 
                        $userInfo = api_get_user_info();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    856
                 | 
                                    
                                                     | 
                
                 | 
                        $userId = api_get_user_id();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    857
                 | 
                                    
                                                     | 
                
                 | 
                        if (empty($userId)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    858
                 | 
                                    
                                                     | 
                
                 | 
                            return;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    859
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    860
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    861
                 | 
                                    
                                                     | 
                
                 | 
                        $items = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    862
                 | 
                                    
                                                     | 
                
                 | 
                        $userGroup = new UserGroup();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    863
                 | 
                                    
                                                     | 
                
                 | 
                        //  @todo Add a platform setting to add the user image.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    864
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('allow_message_tool') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    865
                 | 
                                    
                                                     | 
                
                 | 
                            // New messages.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    866
                 | 
                                    
                                                     | 
                
                 | 
                            $number_of_new_messages = MessageManager::getCountNewMessages();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    867
                 | 
                                    
                                                     | 
                
                 | 
                            // New contact invitations.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    868
                 | 
                                    
                                                     | 
                
                 | 
                            $number_of_new_messages_of_friend = SocialManager::get_message_number_invitation_by_user_id(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    869
                 | 
                                    
                                                     | 
                
                 | 
                                $userId  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    870
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    871
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    872
                 | 
                                    
                                                     | 
                
                 | 
                            // New group invitations sent by a moderator.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    873
                 | 
                                    
                                                     | 
                
                 | 
                            $group_pending_invitations = $userGroup->get_groups_by_user(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    874
                 | 
                                    
                                                     | 
                
                 | 
                                $userId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    875
                 | 
                                    
                                                     | 
                
                 | 
                                GROUP_USER_PERMISSION_PENDING_INVITATION,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    876
                 | 
                                    
                                                     | 
                
                 | 
                                false  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    877
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    878
                 | 
                                    
                                                     | 
                
                 | 
                            $group_pending_invitations = count($group_pending_invitations);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    879
                 | 
                                    
                                                     | 
                
                 | 
                            $total_invitations = $number_of_new_messages_of_friend + $group_pending_invitations;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    880
                 | 
                                    
                                                     | 
                
                 | 
                            $cant_msg = Display::badge($number_of_new_messages);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    881
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    882
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    883
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'inbox-message-social',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    884
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('inbox.png', get_lang('Inbox')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    885
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'messages/inbox.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    886
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('Inbox').$cant_msg, | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    887
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    888
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    889
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    890
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'new-message-social',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    891
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('new-message.png', get_lang('Compose')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    892
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'messages/new_message.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    893
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('Compose'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    894
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    895
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    896
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_setting('allow_social_tool') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    897
                 | 
                                    
                                                     | 
                
                 | 
                                $total_invitations = Display::badge($total_invitations);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    898
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    899
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'invitations-social',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    900
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('invitations.png', get_lang('PendingInvitations')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    901
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'social/invitations.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    902
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('PendingInvitations').$total_invitations, | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    903
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    904
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    905
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    906
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    907
                 | 
                                    
                                                     | 
                
                 | 
                        $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    908
                 | 
                                    
                                                     | 
                
                 | 
                            'class' => 'personal-data',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    909
                 | 
                                    
                                                     | 
                
                 | 
                            'icon' => Display::return_icon('database.png', get_lang('PersonalDataReport')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    910
                 | 
                                    
                                                     | 
                
                 | 
                            'link' => api_get_path(WEB_CODE_PATH).'social/personal_data.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    911
                 | 
                                    
                                                     | 
                
                 | 
                            'title' => get_lang('PersonalDataReport'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    912
                 | 
                                    
                                                     | 
                
                 | 
                        ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    913
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    914
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_configuration_value('allow_my_files_link_in_homepage')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    915
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_setting('allow_my_files') !== 'false') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    916
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    917
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'myfiles-social',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    918
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('sn-files.png', get_lang('Files')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    919
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'social/myfiles.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    920
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('MyFiles'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    921
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    922
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    923
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    924
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    925
                 | 
                                    
                                                     | 
                
                 | 
                        $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    926
                 | 
                                    
                                                     | 
                
                 | 
                            'class' => 'profile-social',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    927
                 | 
                                    
                                                     | 
                
                 | 
                            'icon' => Display::return_icon('edit-profile.png', get_lang('EditProfile')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    928
                 | 
                                    
                                                     | 
                
                 | 
                            'link' => Display::getProfileEditionLink($userId),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    929
                 | 
                                    
                                                     | 
                
                 | 
                            'title' => get_lang('EditProfile'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    930
                 | 
                                    
                                                     | 
                
                 | 
                        ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    931
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    932
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_configuration_value('show_link_request_hrm_user') && | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    933
                 | 
                                    
                                                     | 
                
                 | 
                            api_is_drh()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    934
                 | 
                                    
                                                     | 
                
                 | 
                        ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    935
                 | 
                                    
                                                     | 
                
                 | 
                            $label = get_lang('RequestLinkingToUser'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    936
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    937
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('new_group.png', $label), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    938
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'social/require_user_linking.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    939
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => $label,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    940
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    941
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    942
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    943
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_configuration_value('show_my_lps_page')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    944
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    945
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('learnpath.png', get_lang('MyLps')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    946
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'lp/my_list.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    947
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('MyLps'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    948
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    949
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    950
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    951
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_configuration_value('show_all_my_gradebooks_page')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    952
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    953
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('gradebook.png', get_lang('GlobalGradebook')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    954
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'gradebook/all_my_gradebooks.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    955
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('GlobalGradebook'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    956
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    957
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    958
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    959
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_configuration_value('show_missing_signatures_page') && api_get_configuration_value('enable_sign_attendance_sheet')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    960
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    961
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('attendance.png', get_lang('MyMissingSignatures')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    962
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'attendance/my_missing_signatures.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    963
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('MyMissingSignatures'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    964
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    965
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    966
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    967
                 | 
                                    
                                                     | 
                
                 | 
                        if (bbb::showGlobalConferenceLink($userInfo)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    968
                 | 
                                    
                                                     | 
                
                 | 
                            $bbb = new bbb('', '', true, api_get_user_id()); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    969
                 | 
                                    
                                                     | 
                
                 | 
                            $url = $bbb->getListingUrl();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    970
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    971
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'video-conference',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    972
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    973
                 | 
                                    
                                                     | 
                
                 | 
                                    'bbb.png',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    974
                 | 
                                    
                                                     | 
                
                 | 
                                    get_lang('VideoConference') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    975
                 | 
                                    
                                                     | 
                
                 | 
                                ),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    976
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => $url,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    977
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('VideoConference'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    978
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    979
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    980
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    981
                 | 
                                    
                                                     | 
                
                 | 
                        if ('true' === api_get_plugin_setting('zoom', 'tool_enable')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    982
                 | 
                                    
                                                     | 
                
                 | 
                            $zoomPlugin = new ZoomPlugin();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    983
                 | 
                                    
                                                     | 
                
                 | 
                            $blocks = $zoomPlugin->getProfileBlockItems();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    984
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($blocks as $item) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    985
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = $item;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    986
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    987
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    988
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    989
                 | 
                                    
                                                     | 
                
                 | 
                        if (  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    990
                 | 
                                    
                                                     | 
                
                 | 
                            true === api_get_configuration_value('whispeak_auth_enabled') && | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    991
                 | 
                                    
                                                     | 
                
                 | 
                            !WhispeakAuthPlugin::checkUserIsEnrolled($userId)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    992
                 | 
                                    
                                                     | 
                
                 | 
                        ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    993
                 | 
                                    
                                                     | 
                
                 | 
                            $itemTitle = get_plugin_lang('EnrollmentTitle', WhispeakAuthPlugin::class); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    994
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    995
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    996
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'whispeak-enrollment',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    997
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('addworkuser.png', $itemTitle), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    998
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => WhispeakAuthPlugin::getEnrollmentUrl(),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    999
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => $itemTitle,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1000
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1001
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1002
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1003
                 | 
                                    
                                                     | 
                
                 | 
                        return $items;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1004
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1005
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1006
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1007
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1008
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1009
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_navigation_links()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1010
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1011
                 | 
                                    
                                                     | 
                
                 | 
                        $items = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1012
                 | 
                                    
                                                     | 
                
                 | 
                        // Deleting the myprofile link.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1013
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('allow_social_tool') == 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1014
                 | 
                                    
                                                     | 
                
                 | 
                            unset($this->tpl->menu_navigation['myprofile']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1015
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1016
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1017
                 | 
                                    
                                                     | 
                
                 | 
                        $hideMenu = api_get_configuration_value('hide_main_navigation_menu'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1018
                 | 
                                    
                                                     | 
                
                 | 
                        if ($hideMenu === true) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1019
                 | 
                                    
                                                     | 
                
                 | 
                            return '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1020
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1021
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1022
                 | 
                                    
                                                     | 
                
                 | 
                        // Main navigation section.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1023
                 | 
                                    
                                                     | 
                
                 | 
                        // Tabs that are deactivated are added here.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1024
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($this->tpl->menu_navigation)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1025
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($this->tpl->menu_navigation as $section => $navigation_info) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1026
                 | 
                                    
                                                     | 
                
                 | 
                                if (!empty($navigation_info)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1027
                 | 
                                    
                                                     | 
                
                 | 
                                    $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1028
                 | 
                                    
                                                     | 
                
                 | 
                                        'icon' => null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1029
                 | 
                                    
                                                     | 
                
                 | 
                                        'link' => $navigation_info['url'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1030
                 | 
                                    
                                                     | 
                
                 | 
                                        'title' => $navigation_info['title'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1031
                 | 
                                    
                                                     | 
                
                 | 
                                    ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1032
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1033
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1034
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1035
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1036
                 | 
                                    
                                                     | 
                
                 | 
                        return $items;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1037
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1038
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1039
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1040
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1041
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1042
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_course_block()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1043
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1044
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_configuration_value('hide_course_sidebar')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1045
                 | 
                                    
                                                     | 
                
                 | 
                            return '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1046
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1047
                 | 
                                    
                                                     | 
                
                 | 
                        $isHrm = api_is_drh();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1048
                 | 
                                    
                                                     | 
                
                 | 
                        $show_create_link = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1049
                 | 
                                    
                                                     | 
                
                 | 
                        $show_course_link = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1050
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_allowed_to_create_course()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1051
                 | 
                                    
                                                     | 
                
                 | 
                            $show_create_link = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1052
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1053
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1054
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_get_setting('allow_students_to_browse_courses') === 'true') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1055
                 | 
                                    
                                                     | 
                
                 | 
                            $show_course_link = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1056
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1057
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1058
                 | 
                                    
                                                     | 
                
                 | 
                        $items = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1059
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1060
                 | 
                                    
                                                     | 
                
                 | 
                        // My account section  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1061
                 | 
                                    
                                                     | 
                
                 | 
                        if ($show_create_link) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1062
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_setting('course_validation') === 'true' && !api_is_platform_admin()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1063
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1064
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'add-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1065
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('new-course.png', get_lang('CreateCourseRequest')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1066
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'create_course/add_course.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1067
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('CreateCourseRequest'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1068
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1069
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1070
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1071
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'add-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1072
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('new-course.png', get_lang('CourseCreate')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1073
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'create_course/add_course.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1074
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('CourseCreate'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1075
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1076
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1077
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1078
                 | 
                                    
                                                     | 
                
                 | 
                            if (SessionManager::allowToManageSessions()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1079
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1080
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'add-session',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1081
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('session.png', get_lang('AddSession')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1082
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'session/session_add.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1083
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('AddSession'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1084
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1085
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1086
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1087
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1088
                 | 
                                    
                                                     | 
                
                 | 
                        // Sort courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1089
                 | 
                                    
                                                     | 
                
                 | 
                        $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1090
                 | 
                                    
                                                     | 
                
                 | 
                            'class' => 'order-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1091
                 | 
                                    
                                                     | 
                
                 | 
                            'icon' => Display::return_icon('order-course.png', get_lang('SortMyCourses')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1092
                 | 
                                    
                                                     | 
                
                 | 
                            'link' => api_get_path(WEB_CODE_PATH).'auth/sort_my_courses.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1093
                 | 
                                    
                                                     | 
                
                 | 
                            'title' => get_lang('SortMyCourses'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1094
                 | 
                                    
                                                     | 
                
                 | 
                        ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1095
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1096
                 | 
                                    
                                                     | 
                
                 | 
                        // Session history  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1097
                 | 
                                    
                                                     | 
                
                 | 
                        if (isset($_GET['history']) && intval($_GET['history']) == 1) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1098
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1099
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'history-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1100
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('history-course.png', get_lang('DisplayTrainingList')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1101
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_PATH).'user_portal.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1102
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('DisplayTrainingList'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1103
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1104
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1105
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1106
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'history-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1107
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('history-course.png', get_lang('HistoryTrainingSessions')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1108
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_PATH).'user_portal.php?history=1',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1109
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('HistoryTrainingSessions'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1110
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1111
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1112
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1113
                 | 
                                    
                                                     | 
                
                 | 
                        if ($isHrm) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1114
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1115
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'list-followed-user-courses',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1116
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'auth/hrm_courses.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1117
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('HrmAssignedUsersCourseList'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1118
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1119
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1120
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1121
                 | 
                                    
                                                     | 
                
                 | 
                        // Course catalog  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1122
                 | 
                                    
                                                     | 
                
                 | 
                        if ($show_course_link) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1123
                 | 
                                    
                                                     | 
                
                 | 
                            if (!api_is_drh()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1124
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1125
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'list-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1126
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('catalog-course.png', get_lang('CourseCatalog')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1127
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'auth/courses.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1128
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('CourseCatalog'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1129
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1130
                 | 
                                    
                                                     | 
                
                 | 
                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1131
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1132
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'dashboard-page',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1133
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'dashboard/index.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1134
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('Dashboard'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1135
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1136
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1137
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1138
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1139
                 | 
                                    
                                                     | 
                
                 | 
                        if (!api_is_anonymous()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1140
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1141
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'last-visited-course',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1142
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('clock.png', get_lang('LastVisitedCourse')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1143
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'course_home/last_course.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1144
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('LastVisitedCourse'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1145
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1146
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1147
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'last-visited-lp',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1148
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('learnpath.png', get_lang('LastVisitedLp')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1149
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'course_home/last_lp.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1150
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('LastVisitedLp'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1151
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1152
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1153
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1154
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_teacher() || api_is_session_admin()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1155
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_configuration_value('my_courses_show_pending_work')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1156
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1157
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'list-pending-student-assignments',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1158
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('work.png', get_lang('StudentPublicationToCorrect')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1159
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'work/pending.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1160
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('StudentPublicationToCorrect'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1161
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1162
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1163
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1164
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_get_configuration_value('my_courses_show_pending_exercise_attempts')) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1165
                 | 
                                    
                                                     | 
                
                 | 
                                $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1166
                 | 
                                    
                                                     | 
                
                 | 
                                    'class' => 'list-pending-exercise-attempts',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1167
                 | 
                                    
                                                     | 
                
                 | 
                                    'icon' => Display::return_icon('quiz.png', get_lang('PendingAttempts')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1168
                 | 
                                    
                                                     | 
                
                 | 
                                    'link' => api_get_path(WEB_CODE_PATH).'exercise/pending.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1169
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => get_lang('PendingAttempts'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1170
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1171
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1172
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1173
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1174
                 | 
                                    
                                                     | 
                
                 | 
                        if (!api_is_student()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1175
                 | 
                                    
                                                     | 
                
                 | 
                            $items[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1176
                 | 
                                    
                                                     | 
                
                 | 
                                'class' => 'time-report',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1177
                 | 
                                    
                                                     | 
                
                 | 
                                'icon' => Display::return_icon('statistics.png', get_lang('TimeReport')), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1178
                 | 
                                    
                                                     | 
                
                 | 
                                'link' => api_get_path(WEB_CODE_PATH).'mySpace/time_report.php',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1179
                 | 
                                    
                                                     | 
                
                 | 
                                'title' => get_lang('TimeReport'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1180
                 | 
                                    
                                                     | 
                
                 | 
                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1181
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1182
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1183
                 | 
                                    
                                                     | 
                
                 | 
                        return $items;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1184
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1185
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1186
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1187
                 | 
                                    
                                                     | 
                
                 | 
                     * Shows a welcome message when the user doesn't have any content in the course list.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1188
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1189
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_welcome_to_course_block()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1190
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1191
                 | 
                                    
                                                     | 
                
                 | 
                        $count_courses = CourseManager::count_courses();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1192
                 | 
                                    
                                                     | 
                
                 | 
                        $tpl = $this->tpl->get_template('layout/welcome_to_course.tpl'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1193
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1194
                 | 
                                    
                                                     | 
                
                 | 
                        $course_catalog_url = api_get_path(WEB_CODE_PATH).'auth/courses.php';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1195
                 | 
                                    
                                                     | 
                
                 | 
                        $course_list_url = api_get_path(WEB_PATH).'user_portal.php';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1196
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1197
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl->assign('course_catalog_url', $course_catalog_url); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1198
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl->assign('course_list_url', $course_list_url); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1199
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl->assign('course_catalog_link', Display::url(get_lang('Here'), $course_catalog_url)); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1200
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl->assign('course_list_link', Display::url(get_lang('Here'), $course_list_url)); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1201
                 | 
                                    
                                                     | 
                
                 | 
                        $this->tpl->assign('count_courses', $count_courses); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1202
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1203
                 | 
                                    
                                                     | 
                
                 | 
                        return $this->tpl->fetch($tpl);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1204
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1205
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1206
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1207
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1208
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1209
                 | 
                                    
                                                     | 
                
                 | 
                    public function return_hot_courses()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1210
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1211
                 | 
                                    
                                                     | 
                
                 | 
                        return CourseManager::return_hot_courses(30, 6);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1212
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1213
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1214
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1215
                 | 
                                    
                                                     | 
                
                 | 
                     * UserPortal view for session, return the HTML of the course list.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1216
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1217
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $user_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1218
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1219
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1220
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1221
                 | 
                                    
                                                     | 
                
                 | 
                    public function returnCoursesAndSessionsViewBySession($user_id)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1222
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1223
                 | 
                                    
                                                     | 
                
                 | 
                        $sessionCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1224
                 | 
                                    
                                                     | 
                
                 | 
                        $courseCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1225
                 | 
                                    
                                                     | 
                
                 | 
                        $load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1226
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1227
                 | 
                                    
                                                     | 
                
                 | 
                        if ($load_history) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1228
                 | 
                                    
                                                     | 
                
                 | 
                            // Load sessions in category in *history*  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1229
                 | 
                                    
                                                     | 
                
                 | 
                            $session_categories = UserManager::get_sessions_by_category($user_id, true);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1230
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1231
                 | 
                                    
                                                     | 
                
                 | 
                            // Load sessions in category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1232
                 | 
                                    
                                                     | 
                
                 | 
                            $session_categories = UserManager::get_sessions_by_category($user_id, false);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1233
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1234
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1235
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1236
                 | 
                                    
                                                     | 
                
                 | 
                        $loadDirs = $this->load_directories_preview;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1237
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1238
                 | 
                                    
                                                     | 
                
                 | 
                        // If we're not in the history view...  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1239
                 | 
                                    
                                                     | 
                
                 | 
                        $listCoursesInfo = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1240
                 | 
                                    
                                                     | 
                
                 | 
                        if (!isset($_GET['history'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1241
                 | 
                                    
                                                     | 
                
                 | 
                            // Display special courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1242
                 | 
                                    
                                                     | 
                
                 | 
                            $specialCoursesResult = CourseManager::returnSpecialCourses(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1243
                 | 
                                    
                                                     | 
                
                 | 
                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1244
                 | 
                                    
                                                     | 
                
                 | 
                                $loadDirs  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1245
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1246
                 | 
                                    
                                                     | 
                
                 | 
                            $specialCourses = $specialCoursesResult;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1247
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1248
                 | 
                                    
                                                     | 
                
                 | 
                            if ($specialCourses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1249
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('courses', $specialCourses); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1250
                 | 
                                    
                                                     | 
                
                 | 
                                $html = $this->tpl->fetch(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1251
                 | 
                                    
                                                     | 
                
                 | 
                                    $this->tpl->get_template('/user_portal/classic_courses_without_category.tpl') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1252
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1253
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1254
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1255
                 | 
                                    
                                                     | 
                
                 | 
                            // Display courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1256
                 | 
                                    
                                                     | 
                
                 | 
                            // [code=>xxx, real_id=>000]  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1257
                 | 
                                    
                                                     | 
                
                 | 
                            $listCourses = CourseManager::get_courses_list_by_user_id(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1258
                 | 
                                    
                                                     | 
                
                 | 
                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1259
                 | 
                                    
                                                     | 
                
                 | 
                                false  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1260
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1261
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1262
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($listCourses as $i => $listCourseCodeId) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1263
                 | 
                                    
                                                     | 
                
                 | 
                                if (isset($listCourseCodeId['special_course'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1264
                 | 
                                    
                                                     | 
                
                 | 
                                    continue;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1265
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1266
                 | 
                                    
                                                     | 
                
                 | 
                                $courseCategory = CourseManager::getUserCourseCategoryForCourse(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1267
                 | 
                                    
                                                     | 
                
                 | 
                                    $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1268
                 | 
                                    
                                                     | 
                
                 | 
                                    $listCourseCodeId['real_id']  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1269
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1270
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1271
                 | 
                                    
                                                     | 
                
                 | 
                                $userCatTitle = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1272
                 | 
                                    
                                                     | 
                
                 | 
                                $userCategoryId = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1273
                 | 
                                    
                                                     | 
                
                 | 
                                if ($courseCategory) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1274
                 | 
                                    
                                                     | 
                
                 | 
                                    $userCategoryId = $courseCategory['user_course_cat'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1275
                 | 
                                    
                                                     | 
                
                 | 
                                    $userCatTitle = $courseCategory['title'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1276
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1277
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1278
                 | 
                                    
                                                     | 
                
                 | 
                                $listCourse = api_get_course_info_by_id($listCourseCodeId['real_id']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1279
                 | 
                                    
                                                     | 
                
                 | 
                                $listCoursesInfo[] = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1280
                 | 
                                    
                                                     | 
                
                 | 
                                    'course' => $listCourse,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1281
                 | 
                                    
                                                     | 
                
                 | 
                                    'code' => $listCourseCodeId['code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1282
                 | 
                                    
                                                     | 
                
                 | 
                                    'id' => $listCourseCodeId['real_id'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1283
                 | 
                                    
                                                     | 
                
                 | 
                                    'title' => $listCourse['title'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1284
                 | 
                                    
                                                     | 
                
                 | 
                                    'userCatId' => $userCategoryId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1285
                 | 
                                    
                                                     | 
                
                 | 
                                    'userCatTitle' => $userCatTitle,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1286
                 | 
                                    
                                                     | 
                
                 | 
                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1287
                 | 
                                    
                                                     | 
                
                 | 
                                $courseCount++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1288
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1289
                 | 
                                    
                                                     | 
                
                 | 
                            usort($listCoursesInfo, 'self::compareByCourse');  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1290
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1291
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1292
                 | 
                                    
                                                     | 
                
                 | 
                        $listCoursesInSession = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1293
                 | 
                                    
                                                     | 
                
                 | 
                        if (is_array($session_categories)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1294
                 | 
                                    
                                                     | 
                
                 | 
                            // all courses that are in a session  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1295
                 | 
                                    
                                                     | 
                
                 | 
                            $listCoursesInSession = SessionManager::getNamedSessionCourseForCoach($user_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1296
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1297
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1298
                 | 
                                    
                                                     | 
                
                 | 
                        // we got all courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1299
                 | 
                                    
                                                     | 
                
                 | 
                        // for each user category, sorted alphabetically, display courses  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1300
                 | 
                                    
                                                     | 
                
                 | 
                        $listUserCategories = CourseManager::get_user_course_categories($user_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1301
                 | 
                                    
                                                     | 
                
                 | 
                        $listCoursesAlreadyDisplayed = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1302
                 | 
                                    
                                                     | 
                
                 | 
                        uasort($listUserCategories, "self::compareListUserCategory");  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1303
                 | 
                                    
                                                     | 
                
                 | 
                        $listUserCategories[0] = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1304
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1305
                 | 
                                    
                                                     | 
                
                 | 
                        $html .= '<div class="session-view-block">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1306
                 | 
                                    
                                                     | 
                
                 | 
                        foreach ($listUserCategories as $userCategoryId => $userCat) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1307
                 | 
                                    
                                                     | 
                
                 | 
                            // add user category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1308
                 | 
                                    
                                                     | 
                
                 | 
                            $userCategoryHtml = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1309
                 | 
                                    
                                                     | 
                
                 | 
                            if ($userCategoryId != 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1310
                 | 
                                    
                                                     | 
                
                 | 
                                $userCategoryHtml = '<div class="session-view-well ">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1311
                 | 
                                    
                                                     | 
                
                 | 
                                $userCategoryHtml .= self::getHtmlForUserCategory($userCategoryId, $userCat['title']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1312
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1313
                 | 
                                    
                                                     | 
                
                 | 
                            // look for course in this userCat in session courses : $listCoursesInSession  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1314
                 | 
                                    
                                                     | 
                
                 | 
                            $htmlCategory = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1315
                 | 
                                    
                                                     | 
                
                 | 
                            if (isset($listCoursesInSession[$userCategoryId])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1316
                 | 
                                    
                                                     | 
                
                 | 
                                // list of courses in this user cat  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1317
                 | 
                                    
                                                     | 
                
                 | 
                                foreach ($listCoursesInSession[$userCategoryId]['courseInUserCatList'] as $i => $listCourse) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1318
                 | 
                                    
                                                     | 
                
                 | 
                                    // add course  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1319
                 | 
                                    
                                                     | 
                
                 | 
                                    $listCoursesAlreadyDisplayed[$listCourse['courseId']] = 1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1320
                 | 
                                    
                                                     | 
                
                 | 
                                    if ($userCategoryId == 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1321
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlCategory .= '<div class="panel panel-default">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1322
                 | 
                                    
                                                     | 
                
                 | 
                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1323
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlCategory .= '<div class="panel panel-default">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1324
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1325
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= '<div class="panel-body">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1326
                 | 
                                    
                                                     | 
                
                 | 
                                    $coursesInfo = $listCourse['course'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1327
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1328
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= self::getHtmlForCourse(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1329
                 | 
                                    
                                                     | 
                
                 | 
                                        $coursesInfo,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1330
                 | 
                                    
                                                     | 
                
                 | 
                                        $userCategoryId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1331
                 | 
                                    
                                                     | 
                
                 | 
                                        1,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1332
                 | 
                                    
                                                     | 
                
                 | 
                                        $loadDirs  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1333
                 | 
                                    
                                                     | 
                
                 | 
                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1334
                 | 
                                    
                                                     | 
                
                 | 
                                    // list of session category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1335
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlSessionCategory = '<div  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1336
                 | 
                                    
                                                     | 
                
                 | 
                                        class="session-view-row"  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1337
                 | 
                                    
                                                     | 
                
                 | 
                                        style="display:none;"  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1338
                 | 
                                    
                                                     | 
                
                 | 
                                        id="courseblock-'.$coursesInfo['real_id'].'"  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1339
                 | 
                                    
                                                     | 
                
                 | 
                                        >';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1340
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($listCourse['sessionCatList'] as $listCategorySession) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1341
                 | 
                                    
                                                     | 
                
                 | 
                                        $catSessionId = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1342
                 | 
                                    
                                                     | 
                
                 | 
                                        if (isset($listCategorySession['catSessionId'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1343
                 | 
                                    
                                                     | 
                
                 | 
                                            $catSessionId = $listCategorySession['catSessionId'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1344
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1345
                 | 
                                    
                                                     | 
                
                 | 
                                        // add session category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1346
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($catSessionId) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1347
                 | 
                                    
                                                     | 
                
                 | 
                                            $htmlSessionCategory .= self::getHtmlSessionCategory(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1348
                 | 
                                    
                                                     | 
                
                 | 
                                                $listCategorySession['catSessionId'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1349
                 | 
                                    
                                                     | 
                
                 | 
                                                $listCategorySession['catSessionName']  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1350
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1351
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1352
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1353
                 | 
                                    
                                                     | 
                
                 | 
                                        // list of session  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1354
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlSession = ''; // start  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1355
                 | 
                                    
                                                     | 
                
                 | 
                                        foreach ($listCategorySession['sessionList'] as $listSession) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1356
                 | 
                                    
                                                     | 
                
                 | 
                                            // add session  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1357
                 | 
                                    
                                                     | 
                
                 | 
                                            $htmlSession .= '<div class="session-view-row">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1358
                 | 
                                    
                                                     | 
                
                 | 
                                            $htmlSession .= self::getHtmlForSession(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1359
                 | 
                                    
                                                     | 
                
                 | 
                                                $listSession['sessionId'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1360
                 | 
                                    
                                                     | 
                
                 | 
                                                $listSession['sessionName'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1361
                 | 
                                    
                                                     | 
                
                 | 
                                                $catSessionId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1362
                 | 
                                    
                                                     | 
                
                 | 
                                                $coursesInfo  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1363
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1364
                 | 
                                    
                                                     | 
                
                 | 
                                            $htmlSession .= '</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1365
                 | 
                                    
                                                     | 
                
                 | 
                                            $sessionCount++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1366
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1367
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlSession .= ''; // end session block  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1368
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlSessionCategory .= $htmlSession;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1369
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1370
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlSessionCategory .= '</div>'; // end session cat block  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1371
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= $htmlSessionCategory.'</div></div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1372
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= ''; // end course block  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1373
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1374
                 | 
                                    
                                                     | 
                
                 | 
                                $userCategoryHtml .= $htmlCategory;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1375
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1376
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1377
                 | 
                                    
                                                     | 
                
                 | 
                            // look for courses in this userCat in not in session courses : $listCoursesInfo  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1378
                 | 
                                    
                                                     | 
                
                 | 
                            // if course not already added  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1379
                 | 
                                    
                                                     | 
                
                 | 
                            $htmlCategory = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1380
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($listCoursesInfo as $i => $listCourse) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1381
                 | 
                                    
                                                     | 
                
                 | 
                                if ($listCourse['userCatId'] == $userCategoryId &&  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1382
                 | 
                                    
                                                     | 
                
                 | 
                                    !isset($listCoursesAlreadyDisplayed[$listCourse['id']])  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1383
                 | 
                                    
                                                     | 
                
                 | 
                                ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1384
                 | 
                                    
                                                     | 
                
                 | 
                                    if ($userCategoryId != 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1385
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlCategory .= '<div class="panel panel-default">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1386
                 | 
                                    
                                                     | 
                
                 | 
                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1387
                 | 
                                    
                                                     | 
                
                 | 
                                        $htmlCategory .= '<div class="panel panel-default">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1388
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1389
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1390
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= '<div class="panel-body">';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1391
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= self::getHtmlForCourse(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1392
                 | 
                                    
                                                     | 
                
                 | 
                                        $listCourse['course'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1393
                 | 
                                    
                                                     | 
                
                 | 
                                        $userCategoryId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1394
                 | 
                                    
                                                     | 
                
                 | 
                                        0,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1395
                 | 
                                    
                                                     | 
                
                 | 
                                        $loadDirs  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1396
                 | 
                                    
                                                     | 
                
                 | 
                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1397
                 | 
                                    
                                                     | 
                
                 | 
                                    $htmlCategory .= '</div></div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1398
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1399
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1400
                 | 
                                    
                                                     | 
                
                 | 
                            $htmlCategory .= '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1401
                 | 
                                    
                                                     | 
                
                 | 
                            $userCategoryHtml .= $htmlCategory; // end user cat block  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1402
                 | 
                                    
                                                     | 
                
                 | 
                            if ($userCategoryId != 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1403
                 | 
                                    
                                                     | 
                
                 | 
                                $userCategoryHtml .= '</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1404
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1405
                 | 
                                    
                                                     | 
                
                 | 
                            $html .= $userCategoryHtml;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1406
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1407
                 | 
                                    
                                                     | 
                
                 | 
                        $html .= '</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1408
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1409
                 | 
                                    
                                                     | 
                
                 | 
                        return [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1410
                 | 
                                    
                                                     | 
                
                 | 
                            'html' => $html,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1411
                 | 
                                    
                                                     | 
                
                 | 
                            'sessions' => $session_categories,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1412
                 | 
                                    
                                                     | 
                
                 | 
                            'courses' => $listCoursesInfo,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1413
                 | 
                                    
                                                     | 
                
                 | 
                            'session_count' => $sessionCount,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1414
                 | 
                                    
                                                     | 
                
                 | 
                            'course_count' => $courseCount,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1415
                 | 
                                    
                                                     | 
                
                 | 
                        ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1416
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1417
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1418
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1419
                 | 
                                    
                                                     | 
                
                 | 
                     * @param int $userId  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1420
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1421
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1422
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1423
                 | 
                                    
                                                     | 
                
                 | 
                    public function returnCourseCategoryListFromUser($userId)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1424
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1425
                 | 
                                    
                                                     | 
                
                 | 
                        $sessionCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1426
                 | 
                                    
                                                     | 
                
                 | 
                        $courseList = CourseManager::get_courses_list_by_user_id($userId);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1427
                 | 
                                    
                                                     | 
                
                 | 
                        $categoryCodes = CourseManager::getCourseCategoriesFromCourseList($courseList);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1428
                 | 
                                    
                                                     | 
                
                 | 
                        $categories = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1429
                 | 
                                    
                                                     | 
                
                 | 
                        foreach ($categoryCodes as $categoryCode) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1430
                 | 
                                    
                                                     | 
                
                 | 
                            $categories[] = CourseCategory::getCategory($categoryCode);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1431
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1432
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1433
                 | 
                                    
                                                     | 
                
                 | 
                        $template = new Template('', false, false, false, true, false, false); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1434
                 | 
                                    
                                                     | 
                
                 | 
                        $layout = $template->get_template('user_portal/course_categories.tpl'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1435
                 | 
                                    
                                                     | 
                
                 | 
                        $template->assign('course_categories', $categories); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1436
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1437
                 | 
                                    
                                                     | 
                
                 | 
                        return [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1438
                 | 
                                    
                                                     | 
                
                 | 
                            'courses' => $courseList,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1439
                 | 
                                    
                                                     | 
                
                 | 
                            'html' => $template->fetch($layout),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1440
                 | 
                                    
                                                     | 
                
                 | 
                            'course_count' => count($courseList),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1441
                 | 
                                    
                                                     | 
                
                 | 
                            'session_count' => $sessionCount,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1442
                 | 
                                    
                                                     | 
                
                 | 
                        ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1443
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1444
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1445
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1446
                 | 
                                    
                                                     | 
                
                 | 
                     * Set grade book dependency progress bar see BT#13099.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1447
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1448
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $userId  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1449
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1450
                 | 
                                    
                                                     | 
                
                 | 
                     * @return bool  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1451
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1452
                 | 
                                    
                                                     | 
                
                 | 
                    public function setGradeBookDependencyBar($userId)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1453
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1454
                 | 
                                    
                                                     | 
                
                 | 
                        $allow = api_get_configuration_value('gradebook_dependency'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1455
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1456
                 | 
                                    
                                                     | 
                
                 | 
                        if (api_is_anonymous()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1457
                 | 
                                    
                                                     | 
                
                 | 
                            return false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1458
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1459
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1460
                 | 
                                    
                                                     | 
                
                 | 
                        if ($allow) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1461
                 | 
                                    
                                                     | 
                
                 | 
                            $courseAndSessions = $this->returnCoursesAndSessions(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1462
                 | 
                                    
                                                     | 
                
                 | 
                                $userId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1463
                 | 
                                    
                                                     | 
                
                 | 
                                false,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1464
                 | 
                                    
                                                     | 
                
                 | 
                                '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1465
                 | 
                                    
                                                     | 
                
                 | 
                                false,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1466
                 | 
                                    
                                                     | 
                
                 | 
                                false  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1467
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1468
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1469
                 | 
                                    
                                                     | 
                
                 | 
                            $courseList = api_get_configuration_value('gradebook_dependency_mandatory_courses'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1470
                 | 
                                    
                                                     | 
                
                 | 
                            $courseList = isset($courseList['courses']) ? $courseList['courses'] : [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1471
                 | 
                                    
                                                     | 
                
                 | 
                            $mandatoryCourse = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1472
                 | 
                                    
                                                     | 
                
                 | 
                            if (!empty($courseList)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1473
                 | 
                                    
                                                     | 
                
                 | 
                                foreach ($courseList as $courseId) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1474
                 | 
                                    
                                                     | 
                
                 | 
                                    $courseInfo = api_get_course_info_by_id($courseId);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1475
                 | 
                                    
                                                     | 
                
                 | 
                                    $mandatoryCourse[] = $courseInfo['code'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1476
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1477
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1478
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1479
                 | 
                                    
                                                     | 
                
                 | 
                            // @todo improve calls of course info  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1480
                 | 
                                    
                                                     | 
                
                 | 
                            $subscribedCourses = !empty($courseAndSessions['courses']) ? $courseAndSessions['courses'] : [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1481
                 | 
                                    
                                                     | 
                
                 | 
                            $mainCategoryList = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1482
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($subscribedCourses as $courseInfo) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1483
                 | 
                                    
                                                     | 
                
                 | 
                                $courseCode = $courseInfo['code'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1484
                 | 
                                    
                                                     | 
                
                 | 
                                $categories = Category::load(null, null, $courseCode);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1485
                 | 
                                    
                                                     | 
                
                 | 
                                /** @var Category $category */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1486
                 | 
                                    
                                                     | 
                
                 | 
                                $category = !empty($categories[0]) ? $categories[0] : [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1487
                 | 
                                    
                                                     | 
                
                 | 
                                if (!empty($category)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1488
                 | 
                                    
                                                     | 
                
                 | 
                                    $mainCategoryList[] = $category;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1489
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1490
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1491
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1492
                 | 
                                    
                                                     | 
                
                 | 
                            $result20 = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1493
                 | 
                                    
                                                     | 
                
                 | 
                            $result80 = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1494
                 | 
                                    
                                                     | 
                
                 | 
                            $countCoursesPassedNoDependency = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1495
                 | 
                                    
                                                     | 
                
                 | 
                            /** @var Category $category */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1496
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($mainCategoryList as $category) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1497
                 | 
                                    
                                                     | 
                
                 | 
                                $userFinished = Category::userFinishedCourse(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1498
                 | 
                                    
                                                     | 
                
                 | 
                                    $userId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1499
                 | 
                                    
                                                     | 
                
                 | 
                                    $category,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1500
                 | 
                                    
                                                     | 
                
                 | 
                                    true  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1501
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1502
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1503
                 | 
                                    
                                                     | 
                
                 | 
                                if ($userFinished) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1504
                 | 
                                    
                                                     | 
                
                 | 
                                    if (in_array($category->get_course_code(), $mandatoryCourse)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1505
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($result20 < 20) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1506
                 | 
                                    
                                                     | 
                
                 | 
                                            $result20 += 10;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1507
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1508
                 | 
                                    
                                                     | 
                
                 | 
                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1509
                 | 
                                    
                                                     | 
                
                 | 
                                        $countCoursesPassedNoDependency++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1510
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($result80 < 80) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1511
                 | 
                                    
                                                     | 
                
                 | 
                                            $result80 += 10;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1512
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1513
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1514
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1515
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1516
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1517
                 | 
                                    
                                                     | 
                
                 | 
                            $finalResult = $result20 + $result80;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1518
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1519
                 | 
                                    
                                                     | 
                
                 | 
                            $gradeBookList = api_get_configuration_value('gradebook_badge_sidebar'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1520
                 | 
                                    
                                                     | 
                
                 | 
                            $gradeBookList = isset($gradeBookList['gradebooks']) ? $gradeBookList['gradebooks'] : [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1521
                 | 
                                    
                                                     | 
                
                 | 
                            $badgeList = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1522
                 | 
                                    
                                                     | 
                
                 | 
                            foreach ($gradeBookList as $id) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1523
                 | 
                                    
                                                     | 
                
                 | 
                                $categories = Category::load($id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1524
                 | 
                                    
                                                     | 
                
                 | 
                                /** @var Category $category */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1525
                 | 
                                    
                                                     | 
                
                 | 
                                $category = !empty($categories[0]) ? $categories[0] : [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1526
                 | 
                                    
                                                     | 
                
                 | 
                                $badgeList[$id]['name'] = $category->get_name();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1527
                 | 
                                    
                                                     | 
                
                 | 
                                $badgeList[$id]['finished'] = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1528
                 | 
                                    
                                                     | 
                
                 | 
                                $badgeList[$id]['skills'] = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1529
                 | 
                                    
                                                     | 
                
                 | 
                                if (!empty($category)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1530
                 | 
                                    
                                                     | 
                
                 | 
                                    $minToValidate = $category->getMinimumToValidate();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1531
                 | 
                                    
                                                     | 
                
                 | 
                                    $dependencies = $category->getCourseListDependency();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1532
                 | 
                                    
                                                     | 
                
                 | 
                                    $gradeBooksToValidateInDependence = $category->getGradeBooksToValidateInDependence();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1533
                 | 
                                    
                                                     | 
                
                 | 
                                    $countDependenciesPassed = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1534
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($dependencies as $courseId) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1535
                 | 
                                    
                                                     | 
                
                 | 
                                        $courseInfo = api_get_course_info_by_id($courseId);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1536
                 | 
                                    
                                                     | 
                
                 | 
                                        $courseCode = $courseInfo['code'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1537
                 | 
                                    
                                                     | 
                
                 | 
                                        $categories = Category::load(null, null, $courseCode);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1538
                 | 
                                    
                                                     | 
                
                 | 
                                        $subCategory = !empty($categories[0]) ? $categories[0] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1539
                 | 
                                    
                                                     | 
                
                 | 
                                        if (!empty($subCategory)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1540
                 | 
                                    
                                                     | 
                
                 | 
                                            $score = Category::userFinishedCourse(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1541
                 | 
                                    
                                                     | 
                
                 | 
                                                $userId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1542
                 | 
                                    
                                                     | 
                
                 | 
                                                $subCategory,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1543
                 | 
                                    
                                                     | 
                
                 | 
                                                true  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1544
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1545
                 | 
                                    
                                                     | 
                
                 | 
                                            if ($score) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1546
                 | 
                                    
                                                     | 
                
                 | 
                                                $countDependenciesPassed++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1547
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1548
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1549
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1550
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1551
                 | 
                                    
                                                     | 
                
                 | 
                                    $userFinished =  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1552
                 | 
                                    
                                                     | 
                
                 | 
                                        $countDependenciesPassed >= $gradeBooksToValidateInDependence &&  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1553
                 | 
                                    
                                                     | 
                
                 | 
                                        $countCoursesPassedNoDependency >= $minToValidate;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1554
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1555
                 | 
                                    
                                                     | 
                
                 | 
                                    if ($userFinished) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1556
                 | 
                                    
                                                     | 
                
                 | 
                                        $badgeList[$id]['finished'] = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1557
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1558
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1559
                 | 
                                    
                                                     | 
                
                 | 
                                    $objSkill = new Skill();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1560
                 | 
                                    
                                                     | 
                
                 | 
                                    $skills = $category->get_skills();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1561
                 | 
                                    
                                                     | 
                
                 | 
                                    $skillList = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1562
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($skills as $skill) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1563
                 | 
                                    
                                                     | 
                
                 | 
                                        $skillList[] = $objSkill->get($skill['id']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1564
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1565
                 | 
                                    
                                                     | 
                
                 | 
                                    $badgeList[$id]['skills'] = $skillList;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1566
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1567
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1568
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1569
                 | 
                                    
                                                     | 
                
                 | 
                            $this->tpl->assign(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1570
                 | 
                                    
                                                     | 
                
                 | 
                                'grade_book_sidebar',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1571
                 | 
                                    
                                                     | 
                
                 | 
                                true  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1572
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1573
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1574
                 | 
                                    
                                                     | 
                
                 | 
                            $this->tpl->assign(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1575
                 | 
                                    
                                                     | 
                
                 | 
                                'grade_book_progress',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1576
                 | 
                                    
                                                     | 
                
                 | 
                                $finalResult  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1577
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1578
                 | 
                                    
                                                     | 
                
                 | 
                            $this->tpl->assign('grade_book_badge_list', $badgeList); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1579
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1580
                 | 
                                    
                                                     | 
                
                 | 
                            return true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1581
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1582
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1583
                 | 
                                    
                                                     | 
                
                 | 
                        return false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1584
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1585
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1586
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1587
                 | 
                                    
                                                     | 
                
                 | 
                     * Prints the session and course list (user_portal.php).  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1588
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1589
                 | 
                                    
                                                     | 
                
                 | 
                     * @param int    $user_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1590
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool   $showSessions  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1591
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $categoryCodeFilter  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1592
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool   $useUserLanguageFilterIfAvailable  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1593
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool   $loadHistory  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1594
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1595
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1596
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1597
                 | 
                                    
                                                     | 
                
                 | 
                    public function returnCoursesAndSessions(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1598
                 | 
                                    
                                                     | 
                
                 | 
                        $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1599
                 | 
                                    
                                                     | 
                
                 | 
                        $showSessions = true,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1600
                 | 
                                    
                                                     | 
                
                 | 
                        $categoryCodeFilter = '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1601
                 | 
                                    
                                                     | 
                
                 | 
                        $useUserLanguageFilterIfAvailable = true,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1602
                 | 
                                    
                                                     | 
                
                 | 
                        $loadHistory = false  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1603
                 | 
                                    
                                                     | 
                
                 | 
                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1604
                 | 
                                    
                                                     | 
                
                 | 
                        $gameModeIsActive = api_get_setting('gamification_mode'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1605
                 | 
                                    
                                                     | 
                
                 | 
                        $viewGridCourses = api_get_configuration_value('view_grid_courses'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1606
                 | 
                                    
                                                     | 
                
                 | 
                        $showSimpleSessionInfo = api_get_configuration_value('show_simple_session_info'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1607
                 | 
                                    
                                                     | 
                
                 | 
                        $coursesWithoutCategoryTemplate = '/user_portal/classic_courses_without_category.tpl';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1608
                 | 
                                    
                                                     | 
                
                 | 
                        $coursesWithCategoryTemplate = '/user_portal/classic_courses_with_category.tpl';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1609
                 | 
                                    
                                                     | 
                
                 | 
                        $showAllSessions = api_get_configuration_value('show_all_sessions_on_my_course_page') === true; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1610
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1611
                 | 
                                    
                                                     | 
                
                 | 
                        if ($loadHistory) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1612
                 | 
                                    
                                                     | 
                
                 | 
                            // Load sessions in category in *history*  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1613
                 | 
                                    
                                                     | 
                
                 | 
                            $session_categories = UserManager::get_sessions_by_category($user_id, true);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1614
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1615
                 | 
                                    
                                                     | 
                
                 | 
                            // Load sessions in category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1616
                 | 
                                    
                                                     | 
                
                 | 
                            $session_categories = UserManager::get_sessions_by_category($user_id, false);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1617
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1618
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1619
                 | 
                                    
                                                     | 
                
                 | 
                        $sessionCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1620
                 | 
                                    
                                                     | 
                
                 | 
                        $courseCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1621
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1622
                 | 
                                    
                                                     | 
                
                 | 
                        // Student info code check (shows student progress information on  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1623
                 | 
                                    
                                                     | 
                
                 | 
                        // courses list  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1624
                 | 
                                    
                                                     | 
                
                 | 
                        $studentInfo = api_get_configuration_value('course_student_info'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1625
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1626
                 | 
                                    
                                                     | 
                
                 | 
                        $studentInfoProgress = !empty($studentInfo['progress']) && $studentInfo['progress'] === true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1627
                 | 
                                    
                                                     | 
                
                 | 
                        $studentInfoScore = !empty($studentInfo['score']) && $studentInfo['score'] === true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1628
                 | 
                                    
                                                     | 
                
                 | 
                        $studentInfoCertificate = !empty($studentInfo['certificate']) && $studentInfo['certificate'] === true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1629
                 | 
                                    
                                                     | 
                
                 | 
                        $courseCompleteList = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1630
                 | 
                                    
                                                     | 
                
                 | 
                        $coursesInCategoryCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1631
                 | 
                                    
                                                     | 
                
                 | 
                        $coursesNotInCategoryCount = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1632
                 | 
                                    
                                                     | 
                
                 | 
                        $listCourse = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1633
                 | 
                                    
                                                     | 
                
                 | 
                        $specialCourseList = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1634
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1635
                 | 
                                    
                                                     | 
                
                 | 
                        // If we're not in the history view...  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1636
                 | 
                                    
                                                     | 
                
                 | 
                        if ($loadHistory === false) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1637
                 | 
                                    
                                                     | 
                
                 | 
                            // Display special courses.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1638
                 | 
                                    
                                                     | 
                
                 | 
                            $specialCourses = CourseManager::returnSpecialCourses(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1639
                 | 
                                    
                                                     | 
                
                 | 
                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1640
                 | 
                                    
                                                     | 
                
                 | 
                                $this->load_directories_preview,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1641
                 | 
                                    
                                                     | 
                
                 | 
                                $useUserLanguageFilterIfAvailable  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1642
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1643
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1644
                 | 
                                    
                                                     | 
                
                 | 
                            // Display courses.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1645
                 | 
                                    
                                                     | 
                
                 | 
                            $courses = CourseManager::returnCourses(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1646
                 | 
                                    
                                                     | 
                
                 | 
                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1647
                 | 
                                    
                                                     | 
                
                 | 
                                $this->load_directories_preview,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1648
                 | 
                                    
                                                     | 
                
                 | 
                                $useUserLanguageFilterIfAvailable  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1649
                 | 
                                    
                                                     | 
                
                 | 
                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1650
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1651
                 | 
                                    
                                                     | 
                
                 | 
                            // Course option (show student progress)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1652
                 | 
                                    
                                                     | 
                
                 | 
                            // This code will add new variables (Progress, Score, Certificate)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1653
                 | 
                                    
                                                     | 
                
                 | 
                            if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1654
                 | 
                                    
                                                     | 
                
                 | 
                                if (!empty($specialCourses)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1655
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($specialCourses as $key => $specialCourseInfo) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1656
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($studentInfoProgress) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1657
                 | 
                                    
                                                     | 
                
                 | 
                                            $progress = Tracking::get_avg_student_progress(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1658
                 | 
                                    
                                                     | 
                
                 | 
                                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1659
                 | 
                                    
                                                     | 
                
                 | 
                                                $specialCourseInfo['course_code']  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1660
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1661
                 | 
                                    
                                                     | 
                
                 | 
                                            $specialCourses[$key]['student_info']['progress'] = $progress === false ? null : $progress;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1662
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1663
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1664
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($studentInfoScore) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1665
                 | 
                                    
                                                     | 
                
                 | 
                                            $percentage_score = Tracking::get_avg_student_score(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1666
                 | 
                                    
                                                     | 
                
                 | 
                                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1667
                 | 
                                    
                                                     | 
                
                 | 
                                                $specialCourseInfo['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1668
                 | 
                                    
                                                     | 
                
                 | 
                                                []  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1669
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1670
                 | 
                                    
                                                     | 
                
                 | 
                                            $specialCourses[$key]['student_info']['score'] = $percentage_score;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1671
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1672
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1673
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1674
                 | 
                                    
                                                     | 
                
                 | 
                                            $category = Category::load(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1675
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1676
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1677
                 | 
                                    
                                                     | 
                
                 | 
                                                $specialCourseInfo['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1678
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1679
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1680
                 | 
                                    
                                                     | 
                
                 | 
                                                null  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1681
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1682
                 | 
                                    
                                                     | 
                
                 | 
                                            $specialCourses[$key]['student_info']['certificate'] = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1683
                 | 
                                    
                                                     | 
                
                 | 
                                            if (isset($category[0])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1684
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($category[0]->is_certificate_available($user_id)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1685
                 | 
                                    
                                                     | 
                
                 | 
                                                    $specialCourses[$key]['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1686
                 | 
                                    
                                                     | 
                
                 | 
                                                        get_lang('Yes'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1687
                 | 
                                    
                                                     | 
                
                 | 
                                                        'success'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1688
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1689
                 | 
                                    
                                                     | 
                
                 | 
                                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1690
                 | 
                                    
                                                     | 
                
                 | 
                                                    $specialCourses[$key]['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1691
                 | 
                                    
                                                     | 
                
                 | 
                                                        get_lang('No'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1692
                 | 
                                    
                                                     | 
                
                 | 
                                                        'danger'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1693
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1694
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1695
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1696
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1697
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1698
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1699
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1700
                 | 
                                    
                                                     | 
                
                 | 
                                if (isset($courses['in_category'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1701
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($courses['in_category'] as $key1 => $value) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1702
                 | 
                                    
                                                     | 
                
                 | 
                                        if (isset($courses['in_category'][$key1]['courses'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1703
                 | 
                                    
                                                     | 
                
                 | 
                                            foreach ($courses['in_category'][$key1]['courses'] as $key2 => $courseInCatInfo) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1704
                 | 
                                    
                                                     | 
                
                 | 
                                                $courseCode = $courseInCatInfo['course_code'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1705
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($studentInfoProgress) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1706
                 | 
                                    
                                                     | 
                
                 | 
                                                    $progress = Tracking::get_avg_student_progress(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1707
                 | 
                                    
                                                     | 
                
                 | 
                                                        $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1708
                 | 
                                    
                                                     | 
                
                 | 
                                                        $courseCode  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1709
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1710
                 | 
                                    
                                                     | 
                
                 | 
                                                    $courses['in_category'][$key1]['courses'][$key2]['student_info']['progress'] = $progress === false ? null : $progress;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1711
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1712
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1713
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($studentInfoScore) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1714
                 | 
                                    
                                                     | 
                
                 | 
                                                    $percentage_score = Tracking::get_avg_student_score(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1715
                 | 
                                    
                                                     | 
                
                 | 
                                                        $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1716
                 | 
                                    
                                                     | 
                
                 | 
                                                        $courseCode,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1717
                 | 
                                    
                                                     | 
                
                 | 
                                                        []  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1718
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1719
                 | 
                                    
                                                     | 
                
                 | 
                                                    $courses['in_category'][$key1]['courses'][$key2]['student_info']['score'] = $percentage_score;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1720
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1721
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1722
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1723
                 | 
                                    
                                                     | 
                
                 | 
                                                    $category = Category::load(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1724
                 | 
                                    
                                                     | 
                
                 | 
                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1725
                 | 
                                    
                                                     | 
                
                 | 
                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1726
                 | 
                                    
                                                     | 
                
                 | 
                                                        $courseCode,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1727
                 | 
                                    
                                                     | 
                
                 | 
                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1728
                 | 
                                    
                                                     | 
                
                 | 
                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1729
                 | 
                                    
                                                     | 
                
                 | 
                                                        null  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1730
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1731
                 | 
                                    
                                                     | 
                
                 | 
                                                    $courses['in_category'][$key1]['student_info']['certificate'] = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1732
                 | 
                                    
                                                     | 
                
                 | 
                                                    $isCertificateAvailable = $category[0]->is_certificate_available($user_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1733
                 | 
                                    
                                                     | 
                
                 | 
                                                    if (isset($category[0])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1734
                 | 
                                    
                                                     | 
                
                 | 
                                                        if ($isCertificateAvailable) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1735
                 | 
                                    
                                                     | 
                
                 | 
                                                            $courses['in_category'][$key1]['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1736
                 | 
                                    
                                                     | 
                
                 | 
                                                                get_lang('Yes'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1737
                 | 
                                    
                                                     | 
                
                 | 
                                                                'success'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1738
                 | 
                                    
                                                     | 
                
                 | 
                                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1739
                 | 
                                    
                                                     | 
                
                 | 
                                                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1740
                 | 
                                    
                                                     | 
                
                 | 
                                                            $courses['in_category'][$key1]['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1741
                 | 
                                    
                                                     | 
                
                 | 
                                                                get_lang('No'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1742
                 | 
                                    
                                                     | 
                
                 | 
                                                                'danger'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1743
                 | 
                                    
                                                     | 
                
                 | 
                                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1744
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1745
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1746
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1747
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1748
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1749
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1750
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1751
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1752
                 | 
                                    
                                                     | 
                
                 | 
                                if (isset($courses['not_category'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1753
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($courses['not_category'] as $key => $courseNotInCatInfo) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1754
                 | 
                                    
                                                     | 
                
                 | 
                                        $courseCode = $courseNotInCatInfo['course_code'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1755
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($studentInfoProgress) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1756
                 | 
                                    
                                                     | 
                
                 | 
                                            $progress = Tracking::get_avg_student_progress(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1757
                 | 
                                    
                                                     | 
                
                 | 
                                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1758
                 | 
                                    
                                                     | 
                
                 | 
                                                $courseCode  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1759
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1760
                 | 
                                    
                                                     | 
                
                 | 
                                            $courses['not_category'][$key]['student_info']['progress'] = $progress === false ? null : $progress;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1761
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1762
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1763
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($studentInfoScore) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1764
                 | 
                                    
                                                     | 
                
                 | 
                                            $percentage_score = Tracking::get_avg_student_score(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1765
                 | 
                                    
                                                     | 
                
                 | 
                                                $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1766
                 | 
                                    
                                                     | 
                
                 | 
                                                $courseCode,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1767
                 | 
                                    
                                                     | 
                
                 | 
                                                []  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1768
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1769
                 | 
                                    
                                                     | 
                
                 | 
                                            $courses['not_category'][$key]['student_info']['score'] = $percentage_score;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1770
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1771
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1772
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1773
                 | 
                                    
                                                     | 
                
                 | 
                                            $category = Category::load(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1774
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1775
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1776
                 | 
                                    
                                                     | 
                
                 | 
                                                $courseCode,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1777
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1778
                 | 
                                    
                                                     | 
                
                 | 
                                                null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1779
                 | 
                                    
                                                     | 
                
                 | 
                                                null  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1780
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1781
                 | 
                                    
                                                     | 
                
                 | 
                                            $courses['not_category'][$key]['student_info']['certificate'] = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1782
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1783
                 | 
                                    
                                                     | 
                
                 | 
                                            if (isset($category[0])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1784
                 | 
                                    
                                                     | 
                
                 | 
                                                $certificateAvailable = $category[0]->is_certificate_available($user_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1785
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($certificateAvailable) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1786
                 | 
                                    
                                                     | 
                
                 | 
                                                    $courses['not_category'][$key]['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1787
                 | 
                                    
                                                     | 
                
                 | 
                                                        get_lang('Yes'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1788
                 | 
                                    
                                                     | 
                
                 | 
                                                        'success'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1789
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1790
                 | 
                                    
                                                     | 
                
                 | 
                                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1791
                 | 
                                    
                                                     | 
                
                 | 
                                                    $courses['not_category'][$key]['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1792
                 | 
                                    
                                                     | 
                
                 | 
                                                        get_lang('No'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1793
                 | 
                                    
                                                     | 
                
                 | 
                                                        'danger'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1794
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1795
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1796
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1797
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1798
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1799
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1800
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1801
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1802
                 | 
                                    
                                                     | 
                
                 | 
                            if ($viewGridCourses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1803
                 | 
                                    
                                                     | 
                
                 | 
                                $coursesWithoutCategoryTemplate = '/user_portal/grid_courses_without_category.tpl';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1804
                 | 
                                    
                                                     | 
                
                 | 
                                $coursesWithCategoryTemplate = '/user_portal/grid_courses_with_category.tpl';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1805
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1806
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1807
                 | 
                                    
                                                     | 
                
                 | 
                            if ($specialCourses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1808
                 | 
                                    
                                                     | 
                
                 | 
                                if ($categoryCodeFilter) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1809
                 | 
                                    
                                                     | 
                
                 | 
                                    $specialCourses = self::filterByCategory($specialCourses, $categoryCodeFilter);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1810
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1811
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('courses', $specialCourses); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1812
                 | 
                                    
                                                     | 
                
                 | 
                                $specialCourseList = $this->tpl->fetch($this->tpl->get_template($coursesWithoutCategoryTemplate));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1813
                 | 
                                    
                                                     | 
                
                 | 
                                $courseCompleteList = array_merge($courseCompleteList, $specialCourses);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1814
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1815
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1816
                 | 
                                    
                                                     | 
                
                 | 
                            if ($courses['in_category'] || $courses['not_category']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1817
                 | 
                                    
                                                     | 
                
                 | 
                                foreach ($courses['in_category'] as $courseData) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1818
                 | 
                                    
                                                     | 
                
                 | 
                                    if (!empty($courseData['courses'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1819
                 | 
                                    
                                                     | 
                
                 | 
                                        $coursesInCategoryCount += count($courseData['courses']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1820
                 | 
                                    
                                                     | 
                
                 | 
                                        $courseCompleteList = array_merge($courseCompleteList, $courseData['courses']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1821
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1822
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1823
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1824
                 | 
                                    
                                                     | 
                
                 | 
                                $coursesNotInCategoryCount += count($courses['not_category']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1825
                 | 
                                    
                                                     | 
                
                 | 
                                $courseCompleteList = array_merge($courseCompleteList, $courses['not_category']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1826
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1827
                 | 
                                    
                                                     | 
                
                 | 
                                if ($categoryCodeFilter) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1828
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses['in_category'] = self::filterByCategory(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1829
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses['in_category'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1830
                 | 
                                    
                                                     | 
                
                 | 
                                        $categoryCodeFilter  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1831
                 | 
                                    
                                                     | 
                
                 | 
                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1832
                 | 
                                    
                                                     | 
                
                 | 
                                    $courses['not_category'] = self::filterByCategory(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1833
                 | 
                                    
                                                     | 
                
                 | 
                                        $courses['not_category'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1834
                 | 
                                    
                                                     | 
                
                 | 
                                        $categoryCodeFilter  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1835
                 | 
                                    
                                                     | 
                
                 | 
                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1836
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1837
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1838
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('courses', $courses['not_category']); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1839
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('categories', $courses['in_category']); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1840
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1841
                 | 
                                    
                                                     | 
                
                 | 
                                $listCourse = $this->tpl->fetch($this->tpl->get_template($coursesWithCategoryTemplate));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1842
                 | 
                                    
                                                     | 
                
                 | 
                                $listCourse .= $this->tpl->fetch($this->tpl->get_template($coursesWithoutCategoryTemplate));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1843
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1844
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1845
                 | 
                                    
                                                     | 
                
                 | 
                            $courseCount = count($specialCourses) + $coursesInCategoryCount + $coursesNotInCategoryCount;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1846
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1847
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1848
                 | 
                                    
                                                     | 
                
                 | 
                        $sessions_with_category = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1849
                 | 
                                    
                                                     | 
                
                 | 
                        $sessions_with_no_category = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1850
                 | 
                                    
                                                     | 
                
                 | 
                        $collapsable = api_get_configuration_value('allow_user_session_collapsable'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1851
                 | 
                                    
                                                     | 
                
                 | 
                        $collapsableLink = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1852
                 | 
                                    
                                                     | 
                
                 | 
                        if ($collapsable) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1853
                 | 
                                    
                                                     | 
                
                 | 
                            $collapsableLink = api_get_path(WEB_PATH).'user_portal.php?action=collapse_session';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1854
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1855
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1856
                 | 
                                    
                                                     | 
                
                 | 
                        $extraFieldValue = new ExtraFieldValue('session'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1857
                 | 
                                    
                                                     | 
                
                 | 
                        if ($showSessions) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1858
                 | 
                                    
                                                     | 
                
                 | 
                            $coursesListSessionStyle = api_get_configuration_value('courses_list_session_title_link'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1859
                 | 
                                    
                                                     | 
                
                 | 
                            $coursesListSessionStyle = $coursesListSessionStyle === false ? 1 : $coursesListSessionStyle;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1860
                 | 
                                    
                                                     | 
                
                 | 
                            if (api_is_drh()) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1861
                 | 
                                    
                                                     | 
                
                 | 
                                $coursesListSessionStyle = 1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1862
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1863
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1864
                 | 
                                    
                                                     | 
                
                 | 
                            $portalShowDescription = api_get_setting('show_session_description') === 'true'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1865
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1866
                 | 
                                    
                                                     | 
                
                 | 
                            // Declared listSession variable  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1867
                 | 
                                    
                                                     | 
                
                 | 
                            $listSession = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1868
                 | 
                                    
                                                     | 
                
                 | 
                            // Get timestamp in UTC to compare to DB values (in UTC by convention)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1869
                 | 
                                    
                                                     | 
                
                 | 
                            $session_now = strtotime(api_get_utc_datetime(time()));  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1870
                 | 
                                    
                                                     | 
                
                 | 
                            $allowUnsubscribe = api_get_configuration_value('enable_unsubscribe_button_on_my_course_page'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1871
                 | 
                                    
                                                     | 
                
                 | 
                            if (is_array($session_categories)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1872
                 | 
                                    
                                                     | 
                
                 | 
                                foreach ($session_categories as $session_category) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1873
                 | 
                                    
                                                     | 
                
                 | 
                                    $session_category_id = $session_category['session_category']['id'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1874
                 | 
                                    
                                                     | 
                
                 | 
                                    // Sessions and courses that are not in a session category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1875
                 | 
                                    
                                                     | 
                
                 | 
                                    if (empty($session_category_id) &&  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1876
                 | 
                                    
                                                     | 
                
                 | 
                                        isset($session_category['sessions'])  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1877
                 | 
                                    
                                                     | 
                
                 | 
                                    ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1878
                 | 
                                    
                                                     | 
                
                 | 
                                        // Independent sessions  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1879
                 | 
                                    
                                                     | 
                
                 | 
                                        foreach ($session_category['sessions'] as $session) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1880
                 | 
                                    
                                                     | 
                
                 | 
                                            $session_id = $session['session_id'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1881
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1882
                 | 
                                    
                                                     | 
                
                 | 
                                            // Don't show empty sessions.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1883
                 | 
                                    
                                                     | 
                
                 | 
                                            if (count($session['courses']) < 1) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1884
                 | 
                                    
                                                     | 
                
                 | 
                                                continue;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1885
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1886
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1887
                 | 
                                    
                                                     | 
                
                 | 
                                            // Courses inside the current session.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1888
                 | 
                                    
                                                     | 
                
                 | 
                                            $date_session_start = $session['access_start_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1889
                 | 
                                    
                                                     | 
                
                 | 
                                            $date_session_end = $session['access_end_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1890
                 | 
                                    
                                                     | 
                
                 | 
                                            $coachAccessStartDate = $session['coach_access_start_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1891
                 | 
                                    
                                                     | 
                
                 | 
                                            $coachAccessEndDate = $session['coach_access_end_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1892
                 | 
                                    
                                                     | 
                
                 | 
                                            $count_courses_session = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1893
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1894
                 | 
                                    
                                                     | 
                
                 | 
                                            // Loop course content  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1895
                 | 
                                    
                                                     | 
                
                 | 
                                            $html_courses_session = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1896
                 | 
                                    
                                                     | 
                
                 | 
                                            $atLeastOneCourseIsVisible = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1897
                 | 
                                    
                                                     | 
                
                 | 
                                            $markAsOld = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1898
                 | 
                                    
                                                     | 
                
                 | 
                                            $markAsFuture = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1899
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1900
                 | 
                                    
                                                     | 
                
                 | 
                                            foreach ($session['courses'] as $course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1901
                 | 
                                    
                                                     | 
                
                 | 
                                                $is_coach_course = api_is_coach($session_id, $course['real_id']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1902
                 | 
                                    
                                                     | 
                
                 | 
                                                $allowed_time = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1903
                 | 
                                    
                                                     | 
                
                 | 
                                                $allowedEndTime = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1904
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1905
                 | 
                                    
                                                     | 
                
                 | 
                                                if (!empty($date_session_start)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1906
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($is_coach_course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1907
                 | 
                                    
                                                     | 
                
                 | 
                                                        $allowed_time = api_strtotime($coachAccessStartDate);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1908
                 | 
                                    
                                                     | 
                
                 | 
                                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1909
                 | 
                                    
                                                     | 
                
                 | 
                                                        $allowed_time = api_strtotime($date_session_start);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1910
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1911
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1912
                 | 
                                    
                                                     | 
                
                 | 
                                                    $endSessionToTms = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1913
                 | 
                                    
                                                     | 
                
                 | 
                                                    if (!isset($_GET['history'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1914
                 | 
                                    
                                                     | 
                
                 | 
                                                        if (!empty($date_session_end)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1915
                 | 
                                    
                                                     | 
                
                 | 
                                                            if ($is_coach_course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1916
                 | 
                                    
                                                     | 
                
                 | 
                                                                // if coach end date is empty we use the default end date  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1917
                 | 
                                    
                                                     | 
                
                 | 
                                                                if (empty($coachAccessEndDate)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1918
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $endSessionToTms = api_strtotime($date_session_end);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1919
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if ($session_now > $endSessionToTms) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1920
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $allowedEndTime = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1921
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1922
                 | 
                                    
                                                     | 
                
                 | 
                                                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1923
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $endSessionToTms = api_strtotime($coachAccessEndDate);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1924
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if ($session_now > $endSessionToTms) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1925
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $allowedEndTime = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1926
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1927
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1928
                 | 
                                    
                                                     | 
                
                 | 
                                                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1929
                 | 
                                    
                                                     | 
                
                 | 
                                                                $endSessionToTms = api_strtotime($date_session_end);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1930
                 | 
                                    
                                                     | 
                
                 | 
                                                                if ($session_now > $endSessionToTms) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1931
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $allowedEndTime = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1932
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1933
                 | 
                                    
                                                     | 
                
                 | 
                                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1934
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1935
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1936
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1937
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1938
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($showAllSessions) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1939
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($allowed_time < $session_now && $allowedEndTime === false) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1940
                 | 
                                    
                                                     | 
                
                 | 
                                                        $markAsOld = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1941
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1942
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($allowed_time > $session_now && $endSessionToTms > $session_now) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1943
                 | 
                                    
                                                     | 
                
                 | 
                                                        $markAsFuture = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1944
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1945
                 | 
                                    
                                                     | 
                
                 | 
                                                    $allowedEndTime = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1946
                 | 
                                    
                                                     | 
                
                 | 
                                                    $allowed_time = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1947
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1948
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1949
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($session_now >= $allowed_time && $allowedEndTime) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1950
                 | 
                                    
                                                     | 
                
                 | 
                                                    // Read only and accessible.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1951
                 | 
                                    
                                                     | 
                
                 | 
                                                    $atLeastOneCourseIsVisible = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1952
                 | 
                                    
                                                     | 
                
                 | 
                                                    if (api_get_setting('hide_courses_in_sessions') === 'false') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1953
                 | 
                                    
                                                     | 
                
                 | 
                                                        $courseUserHtml = CourseManager::get_logged_user_course_html(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1954
                 | 
                                    
                                                     | 
                
                 | 
                                                            $course,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1955
                 | 
                                    
                                                     | 
                
                 | 
                                                            $session_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1956
                 | 
                                    
                                                     | 
                
                 | 
                                                            'session_course_item',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1957
                 | 
                                    
                                                     | 
                
                 | 
                                                            true,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1958
                 | 
                                    
                                                     | 
                
                 | 
                                                            $this->load_directories_preview  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1959
                 | 
                                    
                                                     | 
                
                 | 
                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1960
                 | 
                                    
                                                     | 
                
                 | 
                                                        if (isset($courseUserHtml[1])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1961
                 | 
                                    
                                                     | 
                
                 | 
                                                            $course_session = $courseUserHtml[1];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1962
                 | 
                                    
                                                     | 
                
                 | 
                                                            $course_session['skill'] = isset($courseUserHtml['skill']) ? $courseUserHtml['skill'] : '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1963
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1964
                 | 
                                    
                                                     | 
                
                 | 
                                                            // Course option (show student progress)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1965
                 | 
                                    
                                                     | 
                
                 | 
                                                            // This code will add new variables (Progress, Score, Certificate)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1966
                 | 
                                    
                                                     | 
                
                 | 
                                                            if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1967
                 | 
                                    
                                                     | 
                
                 | 
                                                                if ($studentInfoProgress) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1968
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $progress = Tracking::get_avg_student_progress(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1969
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1970
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $course['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1971
                 | 
                                    
                                                     | 
                
                 | 
                                                                        [],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1972
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1973
                 | 
                                    
                                                     | 
                
                 | 
                                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1974
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $course_session['student_info']['progress'] = $progress === false ? null : $progress;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1975
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1976
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1977
                 | 
                                    
                                                     | 
                
                 | 
                                                                if ($studentInfoScore) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1978
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $percentage_score = Tracking::get_avg_student_score(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1979
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1980
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $course['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1981
                 | 
                                    
                                                     | 
                
                 | 
                                                                        [],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1982
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1983
                 | 
                                    
                                                     | 
                
                 | 
                                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1984
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $course_session['student_info']['score'] = $percentage_score;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1985
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1986
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1987
                 | 
                                    
                                                     | 
                
                 | 
                                                                if ($studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1988
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $category = Category::load(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1989
                 | 
                                    
                                                     | 
                
                 | 
                                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1990
                 | 
                                    
                                                     | 
                
                 | 
                                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1991
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $course['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1992
                 | 
                                    
                                                     | 
                
                 | 
                                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1993
                 | 
                                    
                                                     | 
                
                 | 
                                                                        null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1994
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1995
                 | 
                                    
                                                     | 
                
                 | 
                                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1996
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $course_session['student_info']['certificate'] = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1997
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if (isset($category[0])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1998
                 | 
                                    
                                                     | 
                
                 | 
                                                                        if ($category[0]->is_certificate_available($user_id)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    1999
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $course_session['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2000
                 | 
                                    
                                                     | 
                
                 | 
                                                                                get_lang('Yes'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2001
                 | 
                                    
                                                     | 
                
                 | 
                                                                                'success'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2002
                 | 
                                    
                                                     | 
                
                 | 
                                                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2003
                 | 
                                    
                                                     | 
                
                 | 
                                                                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2004
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $course_session['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2005
                 | 
                                    
                                                     | 
                
                 | 
                                                                                get_lang('No'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2006
                 | 
                                    
                                                     | 
                
                 | 
                                                                                'danger'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2007
                 | 
                                    
                                                     | 
                
                 | 
                                                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2008
                 | 
                                    
                                                     | 
                
                 | 
                                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2009
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2010
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2011
                 | 
                                    
                                                     | 
                
                 | 
                                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2012
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2013
                 | 
                                    
                                                     | 
                
                 | 
                                                            $course_session['extrafields'] = CourseManager::getExtraFieldsToBePresented($course['real_id']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2014
                 | 
                                    
                                                     | 
                
                 | 
                                                            if (false === $is_coach_course && $allowUnsubscribe && '1' === $course['unsubscribe']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2015
                 | 
                                    
                                                     | 
                
                 | 
                                                                $course_session['unregister_button'] =  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2016
                 | 
                                    
                                                     | 
                
                 | 
                                                                    CoursesAndSessionsCatalog::return_unregister_button(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2017
                 | 
                                    
                                                     | 
                
                 | 
                                                                        ['code' => $course['course_code']],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2018
                 | 
                                    
                                                     | 
                
                 | 
                                                                        Security::get_existing_token(),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2019
                 | 
                                    
                                                     | 
                
                 | 
                                                                        '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2020
                 | 
                                    
                                                     | 
                
                 | 
                                                                        '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2021
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2022
                 | 
                                    
                                                     | 
                
                 | 
                                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2023
                 | 
                                    
                                                     | 
                
                 | 
                                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2024
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2025
                 | 
                                    
                                                     | 
                
                 | 
                                                            $html_courses_session[] = $course_session;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2026
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2027
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2028
                 | 
                                    
                                                     | 
                
                 | 
                                                    $count_courses_session++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2029
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2030
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2031
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2032
                 | 
                                    
                                                     | 
                
                 | 
                                            // No courses to show.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2033
                 | 
                                    
                                                     | 
                
                 | 
                                            if ($atLeastOneCourseIsVisible === false) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2034
                 | 
                                    
                                                     | 
                
                 | 
                                                if (empty($html_courses_session)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2035
                 | 
                                    
                                                     | 
                
                 | 
                                                    continue;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2036
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2037
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2038
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2039
                 | 
                                    
                                                     | 
                
                 | 
                                            if ($count_courses_session > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2040
                 | 
                                    
                                                     | 
                
                 | 
                                                $params = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2041
                 | 
                                    
                                                     | 
                
                 | 
                                                    'id' => $session_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2042
                 | 
                                    
                                                     | 
                
                 | 
                                                ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2043
                 | 
                                    
                                                     | 
                
                 | 
                                                $session_box = Display::getSessionTitleBox($session_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2044
                 | 
                                    
                                                     | 
                
                 | 
                                                $coachId = $session_box['id_coach'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2045
                 | 
                                    
                                                     | 
                
                 | 
                                                $imageField = $extraFieldValue->get_values_by_handler_and_field_variable(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2046
                 | 
                                    
                                                     | 
                
                 | 
                                                    $session_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2047
                 | 
                                    
                                                     | 
                
                 | 
                                                    'image'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2048
                 | 
                                    
                                                     | 
                
                 | 
                                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2049
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2050
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['category_id'] = $session_box['category_id'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2051
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['title'] = $session_box['title'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2052
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['id_coach'] = $coachId;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2053
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['coach_url'] = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2054
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2055
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($coachId) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2056
                 | 
                                    
                                                     | 
                
                 | 
                                                    $userIdHash = UserManager::generateUserHash($coachId);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2057
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['coach_url'] = api_get_path(WEB_AJAX_PATH).  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2058
                 | 
                                    
                                                     | 
                
                 | 
                                                        'user_manager.ajax.php?a=get_user_popup&hash='.$userIdHash;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2059
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2060
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2061
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2062
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['coach_avatar'] = UserManager::getUserPicture(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2063
                 | 
                                    
                                                     | 
                
                 | 
                                                    $coachId,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2064
                 | 
                                    
                                                     | 
                
                 | 
                                                    USER_IMAGE_SIZE_SMALL  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2065
                 | 
                                    
                                                     | 
                
                 | 
                                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2066
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['date'] = $session_box['dates'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2067
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['image'] = isset($imageField['value']) ? $imageField['value'] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2068
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2069
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['show_actions'] = SessionManager::cantEditSession($session_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2070
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2071
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($collapsable) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2072
                 | 
                                    
                                                     | 
                
                 | 
                                                    $collapsableData = SessionManager::getCollapsableData(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2073
                 | 
                                    
                                                     | 
                
                 | 
                                                        $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2074
                 | 
                                    
                                                     | 
                
                 | 
                                                        $session_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2075
                 | 
                                    
                                                     | 
                
                 | 
                                                        $extraFieldValue,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2076
                 | 
                                    
                                                     | 
                
                 | 
                                                        $collapsableLink  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2077
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2078
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['collapsed'] = $collapsableData['collapsed'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2079
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['collapsable_link'] = $collapsableData['collapsable_link'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2080
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2081
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2082
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['show_description'] = $session_box['show_description'] == 1 && $portalShowDescription;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2083
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['description'] = $session_box['description'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2084
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['visibility'] = $session_box['visibility'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2085
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['show_simple_session_info'] = $showSimpleSessionInfo;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2086
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['course_list_session_style'] = $coursesListSessionStyle;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2087
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['num_users'] = $session_box['num_users'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2088
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['num_courses'] = $session_box['num_courses'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2089
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['course_categories'] = CourseManager::getCourseCategoriesFromCourseList(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2090
                 | 
                                    
                                                     | 
                
                 | 
                                                    $html_courses_session  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2091
                 | 
                                    
                                                     | 
                
                 | 
                                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2092
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['courses'] = $html_courses_session;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2093
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['is_old'] = $markAsOld;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2094
                 | 
                                    
                                                     | 
                
                 | 
                                                $params['is_future'] = $markAsFuture;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2095
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2096
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($showSimpleSessionInfo) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2097
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['subtitle'] = self::getSimpleSessionDetails(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2098
                 | 
                                    
                                                     | 
                
                 | 
                                                        $session_box['coach'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2099
                 | 
                                    
                                                     | 
                
                 | 
                                                        $session_box['dates'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2100
                 | 
                                    
                                                     | 
                
                 | 
                                                        isset($session_box['duration']) ? $session_box['duration'] : null  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2101
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2102
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2103
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2104
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($gameModeIsActive) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2105
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['stars'] = GamificationUtils::getSessionStars(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2106
                 | 
                                    
                                                     | 
                
                 | 
                                                        $params['id'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2107
                 | 
                                    
                                                     | 
                
                 | 
                                                        $this->user_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2108
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2109
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['progress'] = GamificationUtils::getSessionProgress(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2110
                 | 
                                    
                                                     | 
                
                 | 
                                                        $params['id'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2111
                 | 
                                    
                                                     | 
                
                 | 
                                                        $this->user_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2112
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2113
                 | 
                                    
                                                     | 
                
                 | 
                                                    $params['points'] = GamificationUtils::getSessionPoints(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2114
                 | 
                                    
                                                     | 
                
                 | 
                                                        $params['id'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2115
                 | 
                                    
                                                     | 
                
                 | 
                                                        $this->user_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2116
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2117
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2118
                 | 
                                    
                                                     | 
                
                 | 
                                                $listSession[] = $params;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2119
                 | 
                                    
                                                     | 
                
                 | 
                                                $sessionCount++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2120
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2121
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2122
                 | 
                                    
                                                     | 
                
                 | 
                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2123
                 | 
                                    
                                                     | 
                
                 | 
                                        // All sessions included in  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2124
                 | 
                                    
                                                     | 
                
                 | 
                                        $count_courses_session = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2125
                 | 
                                    
                                                     | 
                
                 | 
                                        $html_sessions = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2126
                 | 
                                    
                                                     | 
                
                 | 
                                        if (isset($session_category['sessions'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2127
                 | 
                                    
                                                     | 
                
                 | 
                                            foreach ($session_category['sessions'] as $session) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2128
                 | 
                                    
                                                     | 
                
                 | 
                                                $session_id = $session['session_id'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2129
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2130
                 | 
                                    
                                                     | 
                
                 | 
                                                // Don't show empty sessions.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2131
                 | 
                                    
                                                     | 
                
                 | 
                                                if (count($session['courses']) < 1) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2132
                 | 
                                    
                                                     | 
                
                 | 
                                                    continue;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2133
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2134
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2135
                 | 
                                    
                                                     | 
                
                 | 
                                                $date_session_start = $session['access_start_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2136
                 | 
                                    
                                                     | 
                
                 | 
                                                $date_session_end = $session['access_end_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2137
                 | 
                                    
                                                     | 
                
                 | 
                                                $coachAccessStartDate = $session['coach_access_start_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2138
                 | 
                                    
                                                     | 
                
                 | 
                                                $coachAccessEndDate = $session['coach_access_end_date'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2139
                 | 
                                    
                                                     | 
                
                 | 
                                                $html_courses_session = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2140
                 | 
                                    
                                                     | 
                
                 | 
                                                $count = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2141
                 | 
                                    
                                                     | 
                
                 | 
                                                $markAsOld = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2142
                 | 
                                    
                                                     | 
                
                 | 
                                                $markAsFuture = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2143
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2144
                 | 
                                    
                                                     | 
                
                 | 
                                                foreach ($session['courses'] as $course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2145
                 | 
                                    
                                                     | 
                
                 | 
                                                    $is_coach_course = api_is_coach($session_id, $course['real_id']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2146
                 | 
                                    
                                                     | 
                
                 | 
                                                    $allowed_time = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2147
                 | 
                                    
                                                     | 
                
                 | 
                                                    $allowedEndTime = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2148
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2149
                 | 
                                    
                                                     | 
                
                 | 
                                                    if (!empty($date_session_start)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2150
                 | 
                                    
                                                     | 
                
                 | 
                                                        if ($is_coach_course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2151
                 | 
                                    
                                                     | 
                
                 | 
                                                            $allowed_time = api_strtotime($coachAccessStartDate);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2152
                 | 
                                    
                                                     | 
                
                 | 
                                                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2153
                 | 
                                    
                                                     | 
                
                 | 
                                                            $allowed_time = api_strtotime($date_session_start);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2154
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2155
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2156
                 | 
                                    
                                                     | 
                
                 | 
                                                        if (!isset($_GET['history'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2157
                 | 
                                    
                                                     | 
                
                 | 
                                                            if (!empty($date_session_end)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2158
                 | 
                                    
                                                     | 
                
                 | 
                                                                if ($is_coach_course) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2159
                 | 
                                    
                                                     | 
                
                 | 
                                                                    // if coach end date is empty we use the default end date  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2160
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if (empty($coachAccessEndDate)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2161
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $endSessionToTms = api_strtotime($date_session_end);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2162
                 | 
                                    
                                                     | 
                
                 | 
                                                                        if ($session_now > $endSessionToTms) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2163
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $allowedEndTime = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2164
                 | 
                                    
                                                     | 
                
                 | 
                                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2165
                 | 
                                    
                                                     | 
                
                 | 
                                                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2166
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $endSessionToTms = api_strtotime($coachAccessEndDate);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2167
                 | 
                                    
                                                     | 
                
                 | 
                                                                        if ($session_now > $endSessionToTms) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2168
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $allowedEndTime = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2169
                 | 
                                    
                                                     | 
                
                 | 
                                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2170
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2171
                 | 
                                    
                                                     | 
                
                 | 
                                                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2172
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $endSessionToTms = api_strtotime($date_session_end);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2173
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if ($session_now > $endSessionToTms) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2174
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $allowedEndTime = false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2175
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2176
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2177
                 | 
                                    
                                                     | 
                
                 | 
                                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2178
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2179
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2180
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2181
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($showAllSessions) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2182
                 | 
                                    
                                                     | 
                
                 | 
                                                        if ($allowed_time < $session_now && $allowedEndTime == false) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2183
                 | 
                                    
                                                     | 
                
                 | 
                                                            $markAsOld = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2184
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2185
                 | 
                                    
                                                     | 
                
                 | 
                                                        if ($allowed_time > $session_now && $endSessionToTms > $session_now) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2186
                 | 
                                    
                                                     | 
                
                 | 
                                                            $markAsFuture = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2187
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2188
                 | 
                                    
                                                     | 
                
                 | 
                                                        $allowedEndTime = true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2189
                 | 
                                    
                                                     | 
                
                 | 
                                                        $allowed_time = 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2190
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2191
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2192
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($session_now >= $allowed_time && $allowedEndTime) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2193
                 | 
                                    
                                                     | 
                
                 | 
                                                        if (api_get_setting('hide_courses_in_sessions') === 'false') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2194
                 | 
                                    
                                                     | 
                
                 | 
                                                            $c = CourseManager::get_logged_user_course_html(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2195
                 | 
                                    
                                                     | 
                
                 | 
                                                                $course,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2196
                 | 
                                    
                                                     | 
                
                 | 
                                                                $session_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2197
                 | 
                                    
                                                     | 
                
                 | 
                                                                'session_course_item'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2198
                 | 
                                    
                                                     | 
                
                 | 
                                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2199
                 | 
                                    
                                                     | 
                
                 | 
                                                            if (isset($c[1])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2200
                 | 
                                    
                                                     | 
                
                 | 
                                                                $course_session = $c[1];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2201
                 | 
                                    
                                                     | 
                
                 | 
                                                                $course_session['skill'] = isset($c['skill']) ? $c['skill'] : '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2202
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2203
                 | 
                                    
                                                     | 
                
                 | 
                                                                // Course option (show student progress)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2204
                 | 
                                    
                                                     | 
                
                 | 
                                                                // This code will add new variables (Progress, Score, Certificate)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2205
                 | 
                                    
                                                     | 
                
                 | 
                                                                if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2206
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if ($studentInfoProgress) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2207
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $progress = Tracking::get_avg_student_progress(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2208
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2209
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $course['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2210
                 | 
                                    
                                                     | 
                
                 | 
                                                                            [],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2211
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2212
                 | 
                                    
                                                     | 
                
                 | 
                                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2213
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $course_session['student_info']['progress'] = $progress === false ? null : $progress;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2214
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2215
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2216
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if ($studentInfoScore) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2217
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $percentage_score = Tracking::get_avg_student_score(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2218
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2219
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $course['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2220
                 | 
                                    
                                                     | 
                
                 | 
                                                                            [],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2221
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2222
                 | 
                                    
                                                     | 
                
                 | 
                                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2223
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $course_session['student_info']['score'] = $percentage_score;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2224
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2225
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2226
                 | 
                                    
                                                     | 
                
                 | 
                                                                    if ($studentInfoCertificate) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2227
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $category = Category::load(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2228
                 | 
                                    
                                                     | 
                
                 | 
                                                                            null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2229
                 | 
                                    
                                                     | 
                
                 | 
                                                                            null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2230
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $course['course_code'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2231
                 | 
                                    
                                                     | 
                
                 | 
                                                                            null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2232
                 | 
                                    
                                                     | 
                
                 | 
                                                                            null,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2233
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2234
                 | 
                                    
                                                     | 
                
                 | 
                                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2235
                 | 
                                    
                                                     | 
                
                 | 
                                                                        $course_session['student_info']['certificate'] = null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2236
                 | 
                                    
                                                     | 
                
                 | 
                                                                        if (isset($category[0])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2237
                 | 
                                    
                                                     | 
                
                 | 
                                                                            if ($category[0]->is_certificate_available($user_id)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2238
                 | 
                                    
                                                     | 
                
                 | 
                                                                                $course_session['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2239
                 | 
                                    
                                                     | 
                
                 | 
                                                                                    get_lang('Yes'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2240
                 | 
                                    
                                                     | 
                
                 | 
                                                                                    'success'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2241
                 | 
                                    
                                                     | 
                
                 | 
                                                                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2242
                 | 
                                    
                                                     | 
                
                 | 
                                                                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2243
                 | 
                                    
                                                     | 
                
                 | 
                                                                                $course_session['student_info']['certificate'] = Display::label(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2244
                 | 
                                    
                                                     | 
                
                 | 
                                                                                    get_lang('No'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2245
                 | 
                                    
                                                     | 
                
                 | 
                                                                                    'danger'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2246
                 | 
                                    
                                                     | 
                
                 | 
                                                                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2247
                 | 
                                    
                                                     | 
                
                 | 
                                                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2248
                 | 
                                    
                                                     | 
                
                 | 
                                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2249
                 | 
                                    
                                                     | 
                
                 | 
                                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2250
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2251
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2252
                 | 
                                    
                                                     | 
                
                 | 
                                                                $course_session['extrafields'] = CourseManager::getExtraFieldsToBePresented($course['real_id']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2253
                 | 
                                    
                                                     | 
                
                 | 
                                                                if (false === $is_coach_course && $allowUnsubscribe && '1' === $course['unsubscribe']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2254
                 | 
                                    
                                                     | 
                
                 | 
                                                                    $course_session['unregister_button'] =  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2255
                 | 
                                    
                                                     | 
                
                 | 
                                                                        CoursesAndSessionsCatalog::return_unregister_button(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2256
                 | 
                                    
                                                     | 
                
                 | 
                                                                            ['code' => $course['course_code']],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2257
                 | 
                                    
                                                     | 
                
                 | 
                                                                            Security::get_existing_token(),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2258
                 | 
                                    
                                                     | 
                
                 | 
                                                                            '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2259
                 | 
                                    
                                                     | 
                
                 | 
                                                                            '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2260
                 | 
                                    
                                                     | 
                
                 | 
                                                                            $session_id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2261
                 | 
                                    
                                                     | 
                
                 | 
                                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2262
                 | 
                                    
                                                     | 
                
                 | 
                                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2263
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2264
                 | 
                                    
                                                     | 
                
                 | 
                                                                $html_courses_session[] = $course_session;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2265
                 | 
                                    
                                                     | 
                
                 | 
                                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2266
                 | 
                                    
                                                     | 
                
                 | 
                                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2267
                 | 
                                    
                                                     | 
                
                 | 
                                                        $count_courses_session++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2268
                 | 
                                    
                                                     | 
                
                 | 
                                                        $count++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2269
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2270
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2271
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2272
                 | 
                                    
                                                     | 
                
                 | 
                                                $sessionParams = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2273
                 | 
                                    
                                                     | 
                
                 | 
                                                // Category  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2274
                 | 
                                    
                                                     | 
                
                 | 
                                                if ($count > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2275
                 | 
                                    
                                                     | 
                
                 | 
                                                    $session_box = Display::getSessionTitleBox($session_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2276
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['id'] = $session_id;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2277
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['date'] = $session_box['dates'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2278
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2279
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['course_list_session_style'] = $coursesListSessionStyle;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2280
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['title'] = $session_box['title'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2281
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'].' | ' : '').$session_box['dates'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2282
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['show_actions'] = SessionManager::cantEditSession($session_id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2283
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['courses'] = $html_courses_session;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2284
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['show_simple_session_info'] = $showSimpleSessionInfo;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2285
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2286
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['is_old'] = $markAsOld;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2287
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionParams[0]['is_future'] = $markAsFuture;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2288
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2289
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($collapsable) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2290
                 | 
                                    
                                                     | 
                
                 | 
                                                        $collapsableData = SessionManager::getCollapsableData(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2291
                 | 
                                    
                                                     | 
                
                 | 
                                                            $user_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2292
                 | 
                                    
                                                     | 
                
                 | 
                                                            $session_id,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2293
                 | 
                                    
                                                     | 
                
                 | 
                                                            $extraFieldValue,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2294
                 | 
                                    
                                                     | 
                
                 | 
                                                            $collapsableLink  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2295
                 | 
                                    
                                                     | 
                
                 | 
                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2296
                 | 
                                    
                                                     | 
                
                 | 
                                                        $sessionParams[0]['collapsable_link'] = $collapsableData['collapsable_link'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2297
                 | 
                                    
                                                     | 
                
                 | 
                                                        $sessionParams[0]['collapsed'] = $collapsableData['collapsed'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2298
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2299
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2300
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($showSimpleSessionInfo) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2301
                 | 
                                    
                                                     | 
                
                 | 
                                                        $sessionParams[0]['subtitle'] = self::getSimpleSessionDetails(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2302
                 | 
                                    
                                                     | 
                
                 | 
                                                            $session_box['coach'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2303
                 | 
                                    
                                                     | 
                
                 | 
                                                            $session_box['dates'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2304
                 | 
                                    
                                                     | 
                
                 | 
                                                            isset($session_box['duration']) ? $session_box['duration'] : null  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2305
                 | 
                                    
                                                     | 
                
                 | 
                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2306
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2307
                 | 
                                    
                                                     | 
                
                 | 
                                                    $this->tpl->assign('session', $sessionParams); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2308
                 | 
                                    
                                                     | 
                
                 | 
                                                    $this->tpl->assign('show_tutor', api_get_setting('show_session_coach') === 'true'); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2309
                 | 
                                    
                                                     | 
                
                 | 
                                                    $this->tpl->assign('gamification_mode', $gameModeIsActive); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2310
                 | 
                                    
                                                     | 
                
                 | 
                                                    $this->tpl->assign(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2311
                 | 
                                    
                                                     | 
                
                 | 
                                                        'remove_session_url',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2312
                 | 
                                    
                                                     | 
                
                 | 
                                                        api_get_configuration_value('remove_session_url') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2313
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2314
                 | 
                                    
                                                     | 
                
                 | 
                                                    $this->tpl->assign(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2315
                 | 
                                    
                                                     | 
                
                 | 
                                                        'hide_session_dates_in_user_portal',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2316
                 | 
                                    
                                                     | 
                
                 | 
                                                        api_get_configuration_value('hide_session_dates_in_user_portal') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2317
                 | 
                                    
                                                     | 
                
                 | 
                                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2318
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2319
                 | 
                                    
                                                     | 
                
                 | 
                                                    if ($viewGridCourses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2320
                 | 
                                    
                                                     | 
                
                 | 
                                                        $html_sessions .= $this->tpl->fetch(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2321
                 | 
                                    
                                                     | 
                
                 | 
                                                            $this->tpl->get_template('/user_portal/grid_session.tpl') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2322
                 | 
                                    
                                                     | 
                
                 | 
                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2323
                 | 
                                    
                                                     | 
                
                 | 
                                                    } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2324
                 | 
                                    
                                                     | 
                
                 | 
                                                        $html_sessions .= $this->tpl->fetch(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2325
                 | 
                                    
                                                     | 
                
                 | 
                                                            $this->tpl->get_template('user_portal/classic_session.tpl') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2326
                 | 
                                    
                                                     | 
                
                 | 
                                                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2327
                 | 
                                    
                                                     | 
                
                 | 
                                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2328
                 | 
                                    
                                                     | 
                
                 | 
                                                    $sessionCount++;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2329
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2330
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2331
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2332
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2333
                 | 
                                    
                                                     | 
                
                 | 
                                        if ($count_courses_session > 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2334
                 | 
                                    
                                                     | 
                
                 | 
                                            $categoryParams = [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2335
                 | 
                                    
                                                     | 
                
                 | 
                                                'id' => $session_category['session_category']['id'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2336
                 | 
                                    
                                                     | 
                
                 | 
                                                'title' => $session_category['session_category']['name'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2337
                 | 
                                    
                                                     | 
                
                 | 
                                                'show_actions' => api_is_platform_admin(),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2338
                 | 
                                    
                                                     | 
                
                 | 
                                                'subtitle' => '',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2339
                 | 
                                    
                                                     | 
                
                 | 
                                                'sessions' => $html_sessions,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2340
                 | 
                                    
                                                     | 
                
                 | 
                                            ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2341
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2342
                 | 
                                    
                                                     | 
                
                 | 
                                            $session_category_start_date = $session_category['session_category']['date_start'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2343
                 | 
                                    
                                                     | 
                
                 | 
                                            $session_category_end_date = $session_category['session_category']['date_end'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2344
                 | 
                                    
                                                     | 
                
                 | 
                                            if ($session_category_start_date == '0000-00-00') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2345
                 | 
                                    
                                                     | 
                
                 | 
                                                $session_category_start_date = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2346
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2347
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2348
                 | 
                                    
                                                     | 
                
                 | 
                                            if ($session_category_end_date == '0000-00-00') { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2349
                 | 
                                    
                                                     | 
                
                 | 
                                                $session_category_end_date = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2350
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2351
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2352
                 | 
                                    
                                                     | 
                
                 | 
                                            if (!empty($session_category_start_date) &&  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2353
                 | 
                                    
                                                     | 
                
                 | 
                                                !empty($session_category_end_date)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2354
                 | 
                                    
                                                     | 
                
                 | 
                                            ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2355
                 | 
                                    
                                                     | 
                
                 | 
                                                $categoryParams['subtitle'] = sprintf(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2356
                 | 
                                    
                                                     | 
                
                 | 
                                                    get_lang('FromDateXToDateY'), | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2357
                 | 
                                    
                                                     | 
                
                 | 
                                                    $session_category_start_date,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2358
                 | 
                                    
                                                     | 
                
                 | 
                                                    $session_category_end_date  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2359
                 | 
                                    
                                                     | 
                
                 | 
                                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2360
                 | 
                                    
                                                     | 
                
                 | 
                                            } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2361
                 | 
                                    
                                                     | 
                
                 | 
                                                if (!empty($session_category_start_date)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2362
                 | 
                                    
                                                     | 
                
                 | 
                                                    $categoryParams['subtitle'] = get_lang('From').' '.$session_category_start_date; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2363
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2364
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2365
                 | 
                                    
                                                     | 
                
                 | 
                                                if (!empty($session_category_end_date)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2366
                 | 
                                    
                                                     | 
                
                 | 
                                                    $categoryParams['subtitle'] = get_lang('Until').' '.$session_category_end_date; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2367
                 | 
                                    
                                                     | 
                
                 | 
                                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2368
                 | 
                                    
                                                     | 
                
                 | 
                                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2369
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2370
                 | 
                                    
                                                     | 
                
                 | 
                                            $this->tpl->assign('session_category', $categoryParams); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2371
                 | 
                                    
                                                     | 
                
                 | 
                                            $sessions_with_category .= $this->tpl->fetch(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2372
                 | 
                                    
                                                     | 
                
                 | 
                                                $this->tpl->get_template('user_portal/session_category.tpl') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2373
                 | 
                                    
                                                     | 
                
                 | 
                                            );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2374
                 | 
                                    
                                                     | 
                
                 | 
                                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2375
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2376
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2377
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2378
                 | 
                                    
                                                     | 
                
                 | 
                                $allCoursesInSessions = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2379
                 | 
                                    
                                                     | 
                
                 | 
                                foreach ($listSession as $currentSession) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2380
                 | 
                                    
                                                     | 
                
                 | 
                                    $coursesInSessions = $currentSession['courses'];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2381
                 | 
                                    
                                                     | 
                
                 | 
                                    unset($currentSession['courses']);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2382
                 | 
                                    
                                                     | 
                
                 | 
                                    foreach ($coursesInSessions as $coursesInSession) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2383
                 | 
                                    
                                                     | 
                
                 | 
                                        $coursesInSession['session'] = $currentSession;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2384
                 | 
                                    
                                                     | 
                
                 | 
                                        $allCoursesInSessions[] = $coursesInSession;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2385
                 | 
                                    
                                                     | 
                
                 | 
                                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2386
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2387
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2388
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('all_courses', $allCoursesInSessions); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2389
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('session', $listSession); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2390
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false)); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2391
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('gamification_mode', $gameModeIsActive); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2392
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign('remove_session_url', api_get_configuration_value('remove_session_url')); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2393
                 | 
                                    
                                                     | 
                
                 | 
                                $this->tpl->assign(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2394
                 | 
                                    
                                                     | 
                
                 | 
                                    'hide_session_dates_in_user_portal',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2395
                 | 
                                    
                                                     | 
                
                 | 
                                    api_get_configuration_value('hide_session_dates_in_user_portal') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2396
                 | 
                                    
                                                     | 
                
                 | 
                                );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2397
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2398
                 | 
                                    
                                                     | 
                
                 | 
                                if ($viewGridCourses) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2399
                 | 
                                    
                                                     | 
                
                 | 
                                    $sessions_with_no_category = $this->tpl->fetch(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2400
                 | 
                                    
                                                     | 
                
                 | 
                                        $this->tpl->get_template('/user_portal/grid_session.tpl') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2401
                 | 
                                    
                                                     | 
                
                 | 
                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2402
                 | 
                                    
                                                     | 
                
                 | 
                                } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2403
                 | 
                                    
                                                     | 
                
                 | 
                                    $sessions_with_no_category = $this->tpl->fetch(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2404
                 | 
                                    
                                                     | 
                
                 | 
                                        $this->tpl->get_template('user_portal/classic_session.tpl') | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2405
                 | 
                                    
                                                     | 
                
                 | 
                                    );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2406
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2407
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2408
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2409
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2410
                 | 
                                    
                                                     | 
                
                 | 
                        return [  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2411
                 | 
                                    
                                                     | 
                
                 | 
                            'courses' => $courseCompleteList,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2412
                 | 
                                    
                                                     | 
                
                 | 
                            'sessions' => $session_categories,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2413
                 | 
                                    
                                                     | 
                
                 | 
                            'html' => trim($specialCourseList.$sessions_with_category.$sessions_with_no_category.$listCourse),  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2414
                 | 
                                    
                                                     | 
                
                 | 
                            'session_count' => $sessionCount,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2415
                 | 
                                    
                                                     | 
                
                 | 
                            'course_count' => $courseCount,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2416
                 | 
                                    
                                                     | 
                
                 | 
                        ];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2417
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2418
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2419
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2420
                 | 
                                    
                                                     | 
                
                 | 
                     * Wrapper to CourseManager::returnPopularCoursesHandPicked().  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2421
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2422
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2423
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2424
                 | 
                                    
                                                     | 
                
                 | 
                    public function returnPopularCoursesHandPicked()  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2425
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2426
                 | 
                                    
                                                     | 
                
                 | 
                        return CourseManager::returnPopularCoursesHandPicked();  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2427
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2428
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2429
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2430
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $listA  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2431
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $listB  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2432
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2433
                 | 
                                    
                                                     | 
                
                 | 
                     * @return int  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2434
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2435
                 | 
                                    
                                                     | 
                
                 | 
                    private static function compareByCourse($listA, $listB)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2436
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2437
                 | 
                                    
                                                     | 
                
                 | 
                        if ($listA['userCatTitle'] == $listB['userCatTitle']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2438
                 | 
                                    
                                                     | 
                
                 | 
                            if ($listA['title'] == $listB['title']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2439
                 | 
                                    
                                                     | 
                
                 | 
                                return 0;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2440
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2441
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2442
                 | 
                                    
                                                     | 
                
                 | 
                            if ($listA['title'] > $listB['title']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2443
                 | 
                                    
                                                     | 
                
                 | 
                                return 1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2444
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2445
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2446
                 | 
                                    
                                                     | 
                
                 | 
                            return -1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2447
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2448
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2449
                 | 
                                    
                                                     | 
                
                 | 
                        if ($listA['userCatTitle'] > $listB['userCatTitle']) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2450
                 | 
                                    
                                                     | 
                
                 | 
                            return 1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2451
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2452
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2453
                 | 
                                    
                                                     | 
                
                 | 
                        return -1;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2454
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2455
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2456
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2457
                 | 
                                    
                                                     | 
                
                 | 
                     * Generate the HTML code for items when displaying the right-side blocks.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2458
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2459
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2460
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2461
                 | 
                                    
                                                     | 
                
                 | 
                    private static function returnRightBlockItems(array $items)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2462
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2463
                 | 
                                    
                                                     | 
                
                 | 
                        $my_account_content = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2464
                 | 
                                    
                                                     | 
                
                 | 
                        foreach ($items as $item) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2465
                 | 
                                    
                                                     | 
                
                 | 
                            if (empty($item['link']) && empty($item['title'])) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2466
                 | 
                                    
                                                     | 
                
                 | 
                                continue;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2467
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2468
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2469
                 | 
                                    
                                                     | 
                
                 | 
                            $my_account_content .= '<li class="list-group-item '.(empty($item['class']) ? '' : $item['class']).'">'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2470
                 | 
                                    
                                                     | 
                
                 | 
                                .(empty($item['icon']) ? '' : '<span class="item-icon">'.$item['icon'].'</span>')  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2471
                 | 
                                    
                                                     | 
                
                 | 
                                .'<a href="'.$item['link'].'">'.$item['title'].'</a>'  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2472
                 | 
                                    
                                                     | 
                
                 | 
                                .'</li>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2473
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2474
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2475
                 | 
                                    
                                                     | 
                
                 | 
                        return '<ul class="list-group">'.$my_account_content.'</ul>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2476
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2477
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2478
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2479
                 | 
                                    
                                                     | 
                
                 | 
                     * Return HTML code for personal user course category.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2480
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2481
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2482
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $title  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2483
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2484
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2485
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2486
                 | 
                                    
                                                     | 
                
                 | 
                    private static function getHtmlForUserCategory($id, $title)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2487
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2488
                 | 
                                    
                                                     | 
                
                 | 
                        if ($id == 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2489
                 | 
                                    
                                                     | 
                
                 | 
                            return '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2490
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2491
                 | 
                                    
                                                     | 
                
                 | 
                        $icon = Display::return_icon(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2492
                 | 
                                    
                                                     | 
                
                 | 
                            'folder_yellow.png',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2493
                 | 
                                    
                                                     | 
                
                 | 
                            $title,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2494
                 | 
                                    
                                                     | 
                
                 | 
                            ['class' => 'sessionView'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2495
                 | 
                                    
                                                     | 
                
                 | 
                            ICON_SIZE_LARGE  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2496
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2497
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2498
                 | 
                                    
                                                     | 
                
                 | 
                        return "<div class='session-view-user-category'>$icon<span>$title</span></div>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2499
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2500
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2501
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2502
                 | 
                                    
                                                     | 
                
                 | 
                     * return HTML code for course display in session view.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2503
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2504
                 | 
                                    
                                                     | 
                
                 | 
                     * @param array $courseInfo  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2505
                 | 
                                    
                                                     | 
                
                 | 
                     * @param       $userCategoryId  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2506
                 | 
                                    
                                                     | 
                
                 | 
                     * @param bool  $displayButton  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2507
                 | 
                                    
                                                     | 
                
                 | 
                     * @param       $loadDirs  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2508
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2509
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                                                                
            
                                    
            
            
                | 
                    2510
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2511
                 | 
                                    
                                                     | 
                
                 | 
                    private static function getHtmlForCourse(  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2512
                 | 
                                    
                                                     | 
                
                 | 
                        $courseInfo,  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2513
                 | 
                                    
                                                     | 
                
                 | 
                        $userCategoryId,  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2514
                 | 
                                    
                                                     | 
                
                 | 
                        $displayButton,  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2515
                 | 
                                    
                                                     | 
                
                 | 
                        $loadDirs  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2516
                 | 
                                    
                                                     | 
                
                 | 
                    ) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2517
                 | 
                                    
                                                     | 
                
                 | 
                        if (empty($courseInfo)) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2518
                 | 
                                    
                                                     | 
                
                 | 
                            return '';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2519
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2520
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2521
                 | 
                                    
                                                     | 
                
                 | 
                        $id = $courseInfo['real_id'];  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2522
                 | 
                                    
                                                     | 
                
                 | 
                        $title = $courseInfo['title'];  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2523
                 | 
                                    
                                                     | 
                
                 | 
                        $code = $courseInfo['code'];  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2524
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2525
                 | 
                                    
                                                     | 
                
                 | 
                        $class = 'session-view-lvl-6';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2526
                 | 
                                    
                                                     | 
                
                 | 
                        if ($userCategoryId != 0 && !$displayButton) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2527
                 | 
                                    
                                                     | 
                
                 | 
                            $class = 'session-view-lvl-7';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2528
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2529
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2530
                 | 
                                    
                                                     | 
                
                 | 
                        $class2 = 'session-view-lvl-6';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2531
                 | 
                                    
                                                     | 
                
                 | 
                        if ($displayButton || $userCategoryId != 0) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2532
                 | 
                                    
                                                     | 
                
                 | 
                            $class2 = 'session-view-lvl-7';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2533
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2534
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2535
                 | 
                                    
                                                     | 
                
                 | 
                        $button = '';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2536
                 | 
                                    
                                                     | 
                
                 | 
                        if ($displayButton) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2537
                 | 
                                    
                                                     | 
                
                 | 
                            $button = '<input id="session-view-button-'.intval(  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2538
                 | 
                                    
                                                     | 
                
                 | 
                                    $id  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2539
                 | 
                                    
                                                     | 
                
                 | 
                                ).'" class="btn btn-default btn-sm" type="button" onclick="hideUnhide(\'courseblock-'.intval(  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2540
                 | 
                                    
                                                     | 
                
                 | 
                                    $id  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2541
                 | 
                                    
                                                     | 
                
                 | 
                                ).'\', \'session-view-button-'.intval($id).'\', \'+\', \'-\')" value="+" />';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2542
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2543
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2544
                 | 
                                    
                                                     | 
                
                 | 
                        $icon = Display::return_icon(  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2545
                 | 
                                    
                                                     | 
                
                 | 
                            'blackboard.png',  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2546
                 | 
                                    
                                                     | 
                
                 | 
                            $title,  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2547
                 | 
                                    
                                                     | 
                
                 | 
                            ['class' => 'sessionView'],  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2548
                 | 
                                    
                                                     | 
                
                 | 
                            ICON_SIZE_LARGE  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2549
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2550
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2551
                 | 
                                    
                                                     | 
                
                 | 
                        $courseLink = $courseInfo['course_public_url'].'?id_session=0';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2552
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2553
                 | 
                                    
                                                     | 
                
                 | 
                        // get html course params  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2554
                 | 
                                    
                                                     | 
                
                 | 
                        $courseParams = CourseManager::getCourseParamsForDisplay($id, $loadDirs);  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2555
                 | 
                                    
                                                     | 
                
                 | 
                        $teachers = '';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2556
                 | 
                                    
                                                     | 
                
                 | 
                        $rightActions = '';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2557
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2558
                 | 
                                    
                                                     | 
                
                 | 
                        // teacher list  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2559
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($courseParams['teachers'])) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2560
                 | 
                                    
                                                     | 
                
                 | 
                            $teachers = '<p class="'.$class2.' view-by-session-teachers">'.$courseParams['teachers'].'</p>';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2561
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2562
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2563
                 | 
                                    
                                                     | 
                
                 | 
                        // notification  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2564
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($courseParams['right_actions'])) { | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2565
                 | 
                                    
                                                     | 
                
                 | 
                            $rightActions = '<div class="pull-right">'.$courseParams['right_actions'].'</div>';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2566
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2567
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2568
                 | 
                                    
                                                     | 
                
                 | 
                        $notifications = isset($courseParams['notifications']) ? $courseParams['notifications'] : '';  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2569
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2570
                 | 
                                    
                                                     | 
                
                 | 
                        return "<div>  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2571
                 | 
                                    
                                                     | 
                
                 | 
                                    $button  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2572
                 | 
                                    
                                                     | 
                
                 | 
                                    <span class='$class'>$icon  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2573
                 | 
                                    
                                                     | 
                
                 | 
                                        <a class='sessionView' href='$courseLink'>$title</a>  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2574
                 | 
                                    
                                                     | 
                
                 | 
                                    </span>  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2575
                 | 
                                    
                                                     | 
                
                 | 
                                    $notifications  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2576
                 | 
                                    
                                                     | 
                
                 | 
                                    $rightActions  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2577
                 | 
                                    
                                                     | 
                
                 | 
                                </div>  | 
            
            
                                                                        
                            
            
                                    
            
            
                | 
                    2578
                 | 
                                    
                                                     | 
                
                 | 
                                $teachers";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2579
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2580
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2581
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2582
                 | 
                                    
                                                     | 
                
                 | 
                     * return HTML code for session category.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2583
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2584
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2585
                 | 
                                    
                                                     | 
                
                 | 
                     * @param $title  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2586
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2587
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2588
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2589
                 | 
                                    
                                                     | 
                
                 | 
                    private static function getHtmlSessionCategory($id, $title)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2590
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2591
                 | 
                                    
                                                     | 
                
                 | 
                        if ($id == 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2592
                 | 
                                    
                                                     | 
                
                 | 
                            return '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2593
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2594
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2595
                 | 
                                    
                                                     | 
                
                 | 
                        $icon = Display::return_icon(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2596
                 | 
                                    
                                                     | 
                
                 | 
                            'folder_blue.png',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2597
                 | 
                                    
                                                     | 
                
                 | 
                            $title,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2598
                 | 
                                    
                                                     | 
                
                 | 
                            ['class' => 'sessionView'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2599
                 | 
                                    
                                                     | 
                
                 | 
                            ICON_SIZE_LARGE  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2600
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2601
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2602
                 | 
                                    
                                                     | 
                
                 | 
                        return "<div class='session-view-session-category'>  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2603
                 | 
                                    
                                                     | 
                
                 | 
                                <span class='session-view-lvl-2'>  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2604
                 | 
                                    
                                                     | 
                
                 | 
                                    $icon  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2605
                 | 
                                    
                                                     | 
                
                 | 
                                    <span>$title</span>  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2606
                 | 
                                    
                                                     | 
                
                 | 
                                </span>  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2607
                 | 
                                    
                                                     | 
                
                 | 
                                </div>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2608
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2609
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2610
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2611
                 | 
                                    
                                                     | 
                
                 | 
                     * return HTML code for session.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2612
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2613
                 | 
                                    
                                                     | 
                
                 | 
                     * @param int    $id                session id  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2614
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $title             session title  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2615
                 | 
                                    
                                                     | 
                
                 | 
                     * @param int    $categorySessionId  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2616
                 | 
                                    
                                                     | 
                
                 | 
                     * @param array  $courseInfo  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2617
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2618
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2619
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2620
                 | 
                                    
                                                     | 
                
                 | 
                    private static function getHtmlForSession($id, $title, $categorySessionId, $courseInfo)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2621
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2622
                 | 
                                    
                                                     | 
                
                 | 
                        $html = '';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2623
                 | 
                                    
                                                     | 
                
                 | 
                        if ($categorySessionId == 0) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2624
                 | 
                                    
                                                     | 
                
                 | 
                            $class1 = 'session-view-lvl-2'; // session  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2625
                 | 
                                    
                                                     | 
                
                 | 
                            $class2 = 'session-view-lvl-4'; // got to course in session link  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2626
                 | 
                                    
                                                     | 
                
                 | 
                        } else { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2627
                 | 
                                    
                                                     | 
                
                 | 
                            $class1 = 'session-view-lvl-3'; // session  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2628
                 | 
                                    
                                                     | 
                
                 | 
                            $class2 = 'session-view-lvl-5'; // got to course in session link  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2629
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2630
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2631
                 | 
                                    
                                                     | 
                
                 | 
                        $icon = Display::return_icon(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2632
                 | 
                                    
                                                     | 
                
                 | 
                            'session.png',  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2633
                 | 
                                    
                                                     | 
                
                 | 
                            $title,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2634
                 | 
                                    
                                                     | 
                
                 | 
                            ['class' => 'sessionView'],  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2635
                 | 
                                    
                                                     | 
                
                 | 
                            ICON_SIZE_LARGE  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2636
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2637
                 | 
                                    
                                                     | 
                
                 | 
                        $courseLink = $courseInfo['course_public_url'].'?id_session='.intval($id);  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2638
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2639
                 | 
                                    
                                                     | 
                
                 | 
                        $html .= "<span class='$class1 session-view-session'>$icon$title</span>";  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2640
                 | 
                                    
                                                     | 
                
                 | 
                        $html .= '<div class="'.$class2.' session-view-session-go-to-course-in-session">  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2641
                 | 
                                    
                                                     | 
                
                 | 
                                  <a class="" href="'.$courseLink.'">'.get_lang('GoToCourseInsideSession').'</a></div>'; | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2642
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2643
                 | 
                                    
                                                     | 
                
                 | 
                        return '<div>'.$html.'</div>';  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2644
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2645
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2646
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2647
                 | 
                                    
                                                     | 
                
                 | 
                     * Filter the course list by category code.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2648
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2649
                 | 
                                    
                                                     | 
                
                 | 
                     * @param array  $courseList   course list  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2650
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string $categoryCode  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2651
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2652
                 | 
                                    
                                                     | 
                
                 | 
                     * @return array  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2653
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2654
                 | 
                                    
                                                     | 
                
                 | 
                    private static function filterByCategory($courseList, $categoryCode)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2655
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2656
                 | 
                                    
                                                     | 
                
                 | 
                        return array_filter(  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2657
                 | 
                                    
                                                     | 
                
                 | 
                            $courseList,  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2658
                 | 
                                    
                                                     | 
                
                 | 
                            function ($courseInfo) use ($categoryCode) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2659
                 | 
                                    
                                                     | 
                
                 | 
                                if (isset($courseInfo['category_code']) &&  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2660
                 | 
                                    
                                                     | 
                
                 | 
                                    $courseInfo['category_code'] === $categoryCode  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2661
                 | 
                                    
                                                     | 
                
                 | 
                                ) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2662
                 | 
                                    
                                                     | 
                
                 | 
                                    return true;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2663
                 | 
                                    
                                                     | 
                
                 | 
                                }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2664
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2665
                 | 
                                    
                                                     | 
                
                 | 
                                return false;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2666
                 | 
                                    
                                                     | 
                
                 | 
                            }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2667
                 | 
                                    
                                                     | 
                
                 | 
                        );  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2668
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2669
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2670
                 | 
                                    
                                                     | 
                
                 | 
                    /**  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2671
                 | 
                                    
                                                     | 
                
                 | 
                     * Get the session coach name, duration or dates  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2672
                 | 
                                    
                                                     | 
                
                 | 
                     * when $_configuration['show_simple_session_info'] is enabled.  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2673
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2674
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string      $coachName  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2675
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string      $dates  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2676
                 | 
                                    
                                                     | 
                
                 | 
                     * @param string|null $duration  Optional  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2677
                 | 
                                    
                                                     | 
                
                 | 
                     *  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2678
                 | 
                                    
                                                     | 
                
                 | 
                     * @return string  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2679
                 | 
                                    
                                                     | 
                
                 | 
                     */  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2680
                 | 
                                    
                                                     | 
                
                 | 
                    private static function getSimpleSessionDetails($coachName, $dates, $duration = null)  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2681
                 | 
                                    
                                                     | 
                
                 | 
                    { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2682
                 | 
                                    
                                                     | 
                
                 | 
                        $strDetails = [];  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2683
                 | 
                                    
                                                     | 
                
                 | 
                        if (!empty($coachName)) { | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2684
                 | 
                                    
                                                     | 
                
                 | 
                            $strDetails[] = $coachName;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2685
                 | 
                                    
                                                     | 
                
                 | 
                        }  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2686
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2687
                 | 
                                    
                                                     | 
                
                 | 
                        $strDetails[] = !empty($duration) ? $duration : $dates;  | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2688
                 | 
                                    
                                                     | 
                
                 | 
                 | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2689
                 | 
                                    
                                                     | 
                
                 | 
                        return implode(' | ', $strDetails); | 
            
            
                                                                                                            
                            
            
                                    
            
            
                | 
                    2690
                 | 
                                    
                                                     | 
                
                 | 
                    }  | 
            
            
                                                                                                            
                                                                
            
                                    
            
            
                | 
                    2691
                 | 
                                    
                                                     | 
                
                 | 
                }  | 
            
            
                                                        
            
                                    
            
            
                | 
                    2692
                 | 
                                    
                                                     | 
                
                 | 
                 |