@@ -1170,6 +1170,7 @@ public function returnCoursesAndSessions(
11701170
11711171 $ coursesWithoutCategoryTemplate = '/user_portal/classic_courses_without_category.tpl ' ;
11721172 $ coursesWithCategoryTemplate = '/user_portal/classic_courses_with_category.tpl ' ;
1173+ $ showAllSessions = api_get_configuration_value ('show_all_sessions_on_my_course_page ' ) === true ;
11731174
11741175 if ($ loadHistory ) {
11751176 // Load sessions in category in *history*
@@ -1187,6 +1188,7 @@ public function returnCoursesAndSessions(
11871188 $ studentInfo = api_get_configuration_value ('course_student_info ' );
11881189 $ viewGrid = api_get_configuration_value ('view_grid_courses ' );
11891190
1191+
11901192 $ studentInfoProgress = !empty ($ studentInfo ['progress ' ]) && $ studentInfo ['progress ' ] === true ;
11911193 $ studentInfoScore = !empty ($ studentInfo ['score ' ]) && $ studentInfo ['score ' ] === true ;
11921194 $ studentInfoCertificate = !empty ($ studentInfo ['certificate ' ]) && $ studentInfo ['certificate ' ] === true ;
@@ -1465,6 +1467,8 @@ public function returnCoursesAndSessions(
14651467 // Loop course content
14661468 $ html_courses_session = [];
14671469 $ atLeastOneCourseIsVisible = false ;
1470+ $ markAsOld = false ;
1471+ $ markAsFuture = false ;
14681472
14691473 foreach ($ session ['courses ' ] as $ course ) {
14701474 $ is_coach_course = api_is_coach ($ session_id , $ course ['real_id ' ]);
@@ -1478,6 +1482,7 @@ public function returnCoursesAndSessions(
14781482 $ allowed_time = api_strtotime ($ date_session_start );
14791483 }
14801484
1485+ $ endSessionToTms = null ;
14811486 if (!isset ($ _GET ['history ' ])) {
14821487 if (!empty ($ date_session_end )) {
14831488 if ($ is_coach_course ) {
@@ -1503,6 +1508,17 @@ public function returnCoursesAndSessions(
15031508 }
15041509 }
15051510
1511+ if ($ showAllSessions ) {
1512+ if ($ allowed_time < $ session_now && $ allowedEndTime == false ) {
1513+ $ markAsOld = true ;
1514+ }
1515+ if ($ allowed_time > $ session_now && $ endSessionToTms > $ session_now ) {
1516+ $ markAsFuture = true ;
1517+ }
1518+ $ allowedEndTime = true ;
1519+ $ allowed_time = 0 ;
1520+ }
1521+
15061522 if ($ session_now >= $ allowed_time && $ allowedEndTime ) {
15071523 // Read only and accessible.
15081524 $ atLeastOneCourseIsVisible = true ;
@@ -1612,6 +1628,8 @@ public function returnCoursesAndSessions(
16121628 $ html_courses_session
16131629 );
16141630 $ params ['courses ' ] = $ html_courses_session ;
1631+ $ params ['is_old ' ] = $ markAsOld ;
1632+ $ params ['is_future ' ] = $ markAsFuture ;
16151633
16161634 if ($ showSimpleSessionInfo ) {
16171635 $ params ['subtitle ' ] = self ::getSimpleSessionDetails (
@@ -1728,10 +1746,16 @@ public function returnCoursesAndSessions(
17281746 }
17291747
17301748 $ this ->tpl ->assign ('session ' , $ sessionParams );
1731- $ html_sessions .= $ this ->tpl ->fetch (
1732- $ this ->tpl ->get_template ('user_portal/classic_session.tpl ' )
1733- );
17341749
1750+ if ($ viewGridCourses ) {
1751+ $ html_sessions .= $ this ->tpl ->fetch (
1752+ $ this ->tpl ->get_template ('/user_portal/grid_session.tpl ' )
1753+ );
1754+ } else {
1755+ $ html_sessions .= $ this ->tpl ->fetch (
1756+ $ this ->tpl ->get_template ('user_portal/classic_session.tpl ' )
1757+ );
1758+ }
17351759 $ sessionCount ++;
17361760 }
17371761 }
0 commit comments