@@ -948,7 +948,6 @@ function return_courses_and_sessions($user_id)
948948 global $ _configuration ;
949949
950950 $ load_history = (isset ($ _GET ['history ' ]) && intval ($ _GET ['history ' ]) == 1 ) ? true : false ;
951-
952951 if ($ load_history ) {
953952 //Load sessions in category in *history*
954953 $ session_categories = UserManager::get_sessions_by_category ($ user_id , true );
@@ -981,7 +980,6 @@ function return_courses_and_sessions($user_id)
981980
982981 $ sessions_with_category = '' ;
983982 $ sessions_with_no_category = '' ;
984-
985983 if (is_array ($ session_categories )) {
986984 foreach ($ session_categories as $ session_category ) {
987985 $ session_category_id = $ session_category ['session_category ' ]['id ' ];
@@ -1015,25 +1013,25 @@ function return_courses_and_sessions($user_id)
10151013 $ is_coach_course = api_is_coach ($ session_id , $ course ['code ' ]);
10161014 $ allowed_time = 0 ;
10171015 $ dif_time_after = 0 ;
1018-
10191016 if ($ date_session_start != '0000-00-00 ' ) {
1020- if ($ is_coach_course && ! isset ( $ _GET [ ' history ' ]) ) {
1017+ if ($ is_coach_course ) {
10211018 $ allowed_time = api_strtotime ($ date_session_start .' 00:00:00 ' ) - ($ days_access_before_beginning * 86400 );
1019+ } else {
1020+ $ allowed_time = api_strtotime ($ date_session_start .' 00:00:00 ' );
1021+ }
1022+ if (!isset ($ _GET ['history ' ])) {
10221023 if ($ date_session_end != '0000-00-00 ' ) {
10231024 $ endSessionToTms = api_strtotime ($ date_session_end .' 23:59:59 ' );
10241025 if ($ session_now > $ endSessionToTms ) {
10251026 $ dif_time_after = $ session_now - $ endSessionToTms ;
10261027 $ dif_time_after = round ($ dif_time_after /86400 );
10271028 }
10281029 }
1029- } else {
1030- $ allowed_time = api_strtotime ($ date_session_start .' 00:00:00 ' );
10311030 }
1032- }
10331031
1032+ }
10341033 if ($ session_now > $ allowed_time && $ days_access_after_end > $ dif_time_after - 1 ) {
10351034 // Read only and accessible.
1036-
10371035 $ atLeastOneCourseIsVisible = true ;
10381036
10391037 if (api_get_setting ('hide_courses_in_sessions ' ) == 'false ' ) {
0 commit comments