|
|
|
|
@ -189,15 +189,15 @@ if (!isset($coursesAlreadyVisited[$course_code])) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*Auto launch code */ |
|
|
|
|
$show_autolunch_lp_warning = false; |
|
|
|
|
$show_autolaunch_lp_warning = false; |
|
|
|
|
$auto_launch = api_get_course_setting('enable_lp_auto_launch'); |
|
|
|
|
if (!empty($auto_launch)) { |
|
|
|
|
$session_id = api_get_session_id(); |
|
|
|
|
if ($auto_launch == 2) { //LP list |
|
|
|
|
if (api_is_platform_admin() || api_is_allowed_to_edit()) { |
|
|
|
|
$show_autolunch_lp_warning = true; |
|
|
|
|
$show_autolaunch_lp_warning = true; |
|
|
|
|
} else { |
|
|
|
|
$session_key = 'lp_autolunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
|
|
|
|
$session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
|
|
|
|
if (!isset($_SESSION[$session_key])) { |
|
|
|
|
//redirecting to the LP |
|
|
|
|
$url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&id_session='.$session_id; |
|
|
|
|
@ -213,28 +213,28 @@ if (!empty($auto_launch)) { |
|
|
|
|
if (!empty($session_id)) { |
|
|
|
|
$condition = api_get_session_condition($session_id); |
|
|
|
|
$sql = "SELECT id FROM $lp_table |
|
|
|
|
WHERE c_id = $course_id AND autolunch = 1 $condition |
|
|
|
|
WHERE c_id = $course_id AND autolaunch = 1 $condition |
|
|
|
|
LIMIT 1"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
//If we found nothing in the session we just called the session_id = 0 autolunch |
|
|
|
|
//If we found nothing in the session we just called the session_id = 0 autolaunch |
|
|
|
|
if (Database::num_rows($result) == 0) { |
|
|
|
|
$condition = ''; |
|
|
|
|
} else { |
|
|
|
|
//great, there is an specific auto lunch for this session we leave the $condition |
|
|
|
|
//great, there is an specific auto launch for this session we leave the $condition |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sql = "SELECT id FROM $lp_table |
|
|
|
|
WHERE c_id = $course_id AND autolunch = 1 $condition |
|
|
|
|
WHERE c_id = $course_id AND autolaunch = 1 $condition |
|
|
|
|
LIMIT 1"; |
|
|
|
|
$result = Database::query($sql); |
|
|
|
|
if (Database::num_rows($result) > 0) { |
|
|
|
|
$lp_data = Database::fetch_array($result,'ASSOC'); |
|
|
|
|
if (!empty($lp_data['id'])) { |
|
|
|
|
if (api_is_platform_admin() || api_is_allowed_to_edit()) { |
|
|
|
|
$show_autolunch_lp_warning = true; |
|
|
|
|
$show_autolaunch_lp_warning = true; |
|
|
|
|
} else { |
|
|
|
|
$session_key = 'lp_autolunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
|
|
|
|
$session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id(); |
|
|
|
|
if (!isset($_SESSION[$session_key])) { |
|
|
|
|
//redirecting to the LP |
|
|
|
|
$url = api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id']; |
|
|
|
|
@ -267,7 +267,7 @@ $content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array( |
|
|
|
|
the setting homepage_view is adjustable through |
|
|
|
|
the platform administration section */ |
|
|
|
|
|
|
|
|
|
if ($show_autolunch_lp_warning) { |
|
|
|
|
if ($show_autolaunch_lp_warning) { |
|
|
|
|
$show_message .= Display::return_message( |
|
|
|
|
get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'), |
|
|
|
|
'warning' |
|
|
|
|
|