From bab923f006cf9e898405acd771074dfec74f6ccb Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 22 Dec 2010 18:01:20 +0100 Subject: [PATCH] Adding session support still experimental see r 55bd636425 --- main/course_home/course_home.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/main/course_home/course_home.php b/main/course_home/course_home.php index 3a4772f0c5..965e2ace28 100755 --- a/main/course_home/course_home.php +++ b/main/course_home/course_home.php @@ -186,7 +186,22 @@ if (!isset($coursesAlreadyVisited[$_cid])) { $show_autolunch_lp_warning = false; if (api_get_course_setting('enable_lp_auto_launch') && api_get_session_id()==0 ) { $lp_table = Database::get_course_table(TABLE_LP_MAIN); - $sql = "SELECT id FROM $lp_table WHERE autolunch = 1 LIMIT 1"; + $session_id = api_get_session_id(); + $condition = ''; + + if (!empty($session_id)) { + $condition = api_get_session_condition($session_id); + $sql = "SELECT id FROM $lp_table WHERE autolunch = 1 $condition LIMIT 1"; + $result = Database::query($sql); + //If we found nothing in the session we just called the session_id = 0 autolunch + if (Database::num_rows($result) == 0) { + $condition = ''; + } else { + //great, there is an specific auto lunch for this session we leave the $condition + } + } + + $sql = "SELECT id FROM $lp_table WHERE autolunch = 1 $condition LIMIT 1"; $result = Database::query($sql); if (Database::num_rows($result) > 0) { $lp_data = Database::fetch_array($result,'ASSOC'); @@ -204,7 +219,7 @@ if (api_get_course_setting('enable_lp_auto_launch') && api_get_session_id()==0 ) } //Display::display_header($course_title, 'Home'); -Display::display_header('', 'Home'); +Display::display_header('', get_lang('Home'));