If autolunch setting is on then we will redirect the student to an specific LP id see BT#1909

skala
Julio Montoya 15 years ago
parent fcad278414
commit 42288aabfc
  1. 43
      main/course_home/course_home.php
  2. 20
      main/newscorm/lp_controller.php

@ -175,17 +175,38 @@ if (!$is_allowed_in_course) {
/* Header */
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$_cid])) {
event_access_course();
$coursesAlreadyVisited[$_cid] = 1;
api_session_register('coursesAlreadyVisited');
}
$show_autolunch_lp_warning = false;
if (api_get_course_setting('enable_lp_auto_launch')) {
$lp_table = Database::get_course_table(TABLE_LP_MAIN);
$sql = "SELECT id FROM $lp_table WHERE autolunch = 1 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;
} else {
//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'];
header("Location: $url");
exit;
}
}
}
}
//Display::display_header($course_title, 'Home');
Display::display_header('', 'Home');
/* STATISTICS */
if (!isset($coursesAlreadyVisited[$_cid])) {
event_access_course();
$coursesAlreadyVisited[$_cid] = 1;
api_session_register('coursesAlreadyVisited');
}
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
@ -202,15 +223,19 @@ $reqdate = "&reqdate=$temps";
Display::display_introduction_section(TOOL_COURSE_HOMEPAGE, array(
'CreateDocumentWebDir' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/document/',
'CreateDocumentDir' => 'document/',
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
'CreateDocumentDir' => 'document/',
'BaseHref' => api_get_path(WEB_COURSE_PATH).api_get_course_path().'/'
)
);
/* SWITCH TO A DIFFERENT HOMEPAGE VIEW
the setting homepage_view is adjustable through
the platform administration section */
if ($show_autolunch_lp_warning) {
Display::display_warning_message(get_lang('TheLPAutoLunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'));
}
if (api_get_setting('homepage_view') == 'activity') {
require 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {

@ -465,15 +465,17 @@ switch ($action) {
break;
case 'auto_launch':
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
if ($debug > 0) error_log('New LP - export action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for set_autolunch', 0); require 'lp_list.php'; }
else {
$_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
require 'lp_list.php';
exit;
if (api_get_course_setting('enable_lp_auto_launch')) {
if (!$is_allowed_to_edit) {
api_not_allowed(true);
}
if ($debug > 0) error_log('New LP - export action triggered', 0);
if (!$lp_found) { error_log('New LP - No learnpath given for set_autolunch', 0); require 'lp_list.php'; }
else {
$_SESSION['oLP']->set_autolunch($_GET['lp_id'], $_GET['status']);
require 'lp_list.php';
exit;
}
}
break;

Loading…
Cancel
Save