diff --git a/main/admin/user_information.php b/main/admin/user_information.php index 495f9efbc8..0ba941d076 100755 --- a/main/admin/user_information.php +++ b/main/admin/user_information.php @@ -698,11 +698,9 @@ $content = $tpl->fetch($layoutTemplate); echo $content; if (api_get_configuration_value('allow_career_users')) { if (!empty($sessions)) { - foreach ($sessions as $session) { - echo SessionManager::getCareerDiagramPerSession($session['session_id'], $userId); - } + $sessions = array_column($sessions, 'session_id'); + echo SessionManager::getCareerDiagramPerSessionList($sessions, $userId); } - echo Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']); echo MyStudents::userCareersTable($userId); } diff --git a/main/auth/my_progress.php b/main/auth/my_progress.php index 0fad3fe3be..68551944fe 100755 --- a/main/auth/my_progress.php +++ b/main/auth/my_progress.php @@ -41,6 +41,8 @@ $sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : 0; $courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : null; $allowCareerUser = api_get_configuration_value('allow_career_users'); +$showGraph = false === api_get_configuration_value('hide_session_graph_in_my_progress'); + if (!empty($courseUserList)) { $items = MySpace::get_connections_from_course_list( $user_id, @@ -81,12 +83,19 @@ if (!empty($courseUserList)) { } } -$content = Tracking::showUserProgress($user_id, $sessionId); +$content = Tracking::showUserProgress( + $user_id, + $sessionId, + '', + true, + true, + false, + $showGraph +); $showAllSessionCourses = api_get_configuration_value('my_progress_session_show_all_courses'); if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) { $userSessionCourses = UserManager::get_courses_list_by_session($user_id, $sessionId); - foreach ($userSessionCourses as $userSessionCourse) { $content .= Tracking::show_course_detail( $user_id, @@ -102,19 +111,19 @@ if ($showAllSessionCourses && !empty($sessionId) && empty($courseCode)) { if (!empty($dates)) { $content .= Display::page_subheader(get_lang('Timeline')); $content .= ' -
- '; + + '; } if (api_get_configuration_value('private_messages_about_user_visible_to_user') === true) { diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php index 2874ced04c..22f2c7d7b9 100755 --- a/main/forum/viewthread.php +++ b/main/forum/viewthread.php @@ -624,6 +624,7 @@ foreach ($posts as $post) { $post['post_title'] .= Display::tag('div', $titlePost, ['class' => 'post-header']); // the post body + $post['post_text'] = Security::remove_XSS($post['post_text']); $post['post_data'] = Display::tag('div', $post['post_text'], ['class' => 'post-body']); // The check if there is an attachment diff --git a/main/inc/lib/MyStudents.php b/main/inc/lib/MyStudents.php index 06ec5c5be5..6f6b058538 100644 --- a/main/inc/lib/MyStudents.php +++ b/main/inc/lib/MyStudents.php @@ -16,7 +16,9 @@ class MyStudents return ''; } - return self::getCareersTable($careers); + $title = Display::page_subheader(get_lang('Careers'), null, 'h3', ['class' => 'section-title']); + + return $title.self::getCareersTable($careers); } public static function getCareersTable(array $careers): string @@ -52,13 +54,11 @@ class MyStudents return $table->toHtml(); } - public static function getBlockForSkills(int $studentId, int $courseId, int $sessionId): string { $allowAll = api_get_configuration_value('allow_teacher_access_student_skills'); if ($allowAll) { - // Show all skills return Tracking::displayUserSkills($studentId, 0, 0, true); } diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index cf91e07d2c..29b67cad75 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -9660,47 +9660,46 @@ class SessionManager return $careers; } - public static function getCareerDiagramPerSession($sessionId, $userId): string + public static function getCareerDiagramPerSessionList($sessionList, $userId) { - $sessionId = (int) $sessionId; - $userId = (int) $userId; - - $visibility = api_get_session_visibility($sessionId, null, false, $userId); - $content = ''; - if (SESSION_AVAILABLE === $visibility) { - $careerList = self::getCareersFromSession($sessionId); + if (empty($sessionList) || empty($userId)) { + return ''; + } - if (empty($careerList)) { - return ''; + $userId = (int) $userId; + $content = Display::page_subheader(get_lang('OngoingTraining')); + $content .= ' + + '; + $careersAdded = []; + foreach ($sessionList as $sessionId) { + $visibility = api_get_session_visibility($sessionId, null, false, $userId); + if (SESSION_AVAILABLE === $visibility) { + $careerList = self::getCareersFromSession($sessionId); + if (empty($careerList)) { + continue; } - - '; - } - - if (!empty($content)) { - $content = Display::page_subheader(get_lang('OngoingTraining')).$content; + foreach ($careerList as $career) { + $careerId = $career['id']; + if (!in_array($careerId, $careersAdded)) { + $careersAdded[] = $careerId; + $careerUrl = api_get_path(WEB_CODE_PATH).'user/career_diagram.php?iframe=1&career_id='.$career['id'].'&user_id='.$userId; + $content .= ' + '; + } + } + } } return $content; diff --git a/main/inc/lib/tracking.lib.php b/main/inc/lib/tracking.lib.php index 29392964f2..0f35af1894 100755 --- a/main/inc/lib/tracking.lib.php +++ b/main/inc/lib/tracking.lib.php @@ -4703,7 +4703,8 @@ class Tracking $extra_params = '', $show_courses = true, $showAllSessions = true, - $returnArray = false + $returnArray = false, + $showGraph = true ) { $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); @@ -5004,6 +5005,7 @@ class Tracking $allowCareerUser = api_get_configuration_value('allow_career_users'); // Session list. + $visibleSessions = []; if (!empty($course_in_session)) { $main_session_graph = ''; // Load graphics only when calling to an specific session @@ -5011,7 +5013,6 @@ class Tracking $my_results = []; $all_exercise_graph_list = []; $all_exercise_start_time = []; - $allCareers = []; foreach ($course_in_session as $my_session_id => $session_data) { $course_list = $session_data['course_list']; $user_count = count(SessionManager::get_users_by_session($my_session_id)); @@ -5021,10 +5022,7 @@ class Tracking $visibility = api_get_session_visibility($my_session_id, null, false, $user_id); if (SESSION_AVAILABLE === $visibility) { - $careers = SessionManager::getCareersFromSession($my_session_id); - if (!empty($careers)) { - $allCareers = array_merge($allCareers, $careers); - } + $visibleSessions[] = $my_session_id; } foreach ($course_list as $course_data) { @@ -5103,13 +5101,15 @@ class Tracking $my_results_final[] = $my_results[$key]; $final_all_exercise_graph_list[] = $all_exercise_graph_list[$key]; } - $main_session_graph = '