From d3464efa703abb53538e4857cb9554e7e428d9ff Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 5 Jul 2016 19:54:02 -0500 Subject: [PATCH] Fix get_logged_user_course_html --- main/inc/lib/course.lib.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index fcf36a596c..f5e4547d9f 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -4028,7 +4028,7 @@ class CourseManager if (1) { $session = ''; $active = false; - if (!empty($course_info['session_name'])) { + if (!empty($course_info['id_session'])) { // Request for the name of the general coach $sql = 'SELECT lastname, firstname,sc.name @@ -4042,13 +4042,12 @@ class CourseManager $rs = Database::query($sql); $sessioncoach = Database::store_result($rs); - $sessioncoach = $sessioncoach[0]; + $sessioncoach = $sessioncoach ? $sessioncoach[0] : null; - $session = array(); - $session['title'] = $course_info['session_name']; + $session = api_get_session_info($course_info['id_session']); $session_category_id = CourseManager::get_session_category_id_by_session_id($course_info['id_session']); $session['category'] = $sessioncoach['name']; - if ($course_info['access_start_date'] == '0000-00-00') { + if ($session['access_start_date'] == '0000-00-00') { //$session['dates'] = get_lang('WithoutTimeLimits'); $session['dates'] = ''; if (api_get_setting('show_session_coach') === 'true') { @@ -4057,12 +4056,15 @@ class CourseManager } $active = true; } else { - $session ['dates'] = ' - ' . get_lang('From') . ' ' . $course_info['access_start_date'] . ' ' . get_lang('To') . ' ' . $course_info['access_end_date']; + $session ['dates'] = ' - ' . get_lang('From') . ' ' . $session['access_start_date'] . ' ' . get_lang('To') . ' ' . $session['access_end_date']; if (api_get_setting('show_session_coach') === 'true') { $session['coach'] = get_lang('GeneralCoach') . ': ' . api_get_person_name($sessioncoach['firstname'], $sessioncoach['lastname']); } - $active = ($date_start <= $now && $date_end >= $now); + $date_start = $session['access_start_date']; + $date_end = $session['access_end_date']; + + $active = !$date_end ? ($date_start <= $now) : ($date_start <= $now && $date_end >= $now); } } $user_course_category = '';