diff --git a/main/newscorm/blank.php b/main/newscorm/blank.php index 9f6e3a4732..0468e53210 100644 --- a/main/newscorm/blank.php +++ b/main/newscorm/blank.php @@ -25,9 +25,11 @@ include_once('../inc/reduced_header.inc.php'); switch($_GET['error']){ case 'document_deleted': + echo '

'; Display::display_error_message(get_lang('DocumentHasBeenDeleted')); break; - case 'prerequisites': + case 'prerequisites': + echo '

'; Display::display_normal_message(get_lang('_prereq_not_complete')); break; default: diff --git a/main/newscorm/lp_content.php b/main/newscorm/lp_content.php index 3f973bb324..75b5ca94ea 100644 --- a/main/newscorm/lp_content.php +++ b/main/newscorm/lp_content.php @@ -47,8 +47,13 @@ if ($dokeos_chapter) { $src = 'blank.php?error=prerequisites'; } break; - case 2: - case 3: + case 2: + $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); + if(!$prereq_check) { + $src = 'blank.php?error=prerequisites'; + } + break; + case 3: //save old if asset $_SESSION['oLP']->stop_previous_item(); //save status manually if asset $prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id); diff --git a/main/newscorm/lp_view.php b/main/newscorm/lp_view.php index 974ffd1fea..4a28854465 100644 --- a/main/newscorm/lp_view.php +++ b/main/newscorm/lp_view.php @@ -97,7 +97,7 @@ unset($_SESSION['questionList']); * Get a link to the corresponding document */ - +global $src; if (!isset($src)) { $src = ''; @@ -123,7 +123,7 @@ if (!isset($src)) $src = $_SESSION['oLP']->get_link('http',$lp_item_id); $_SESSION['oLP']->start_current_item(); //starts time counter manually if asset }else{ - $src = 'blank.php'; + $src = 'blank.php?error=prerequisites'; } break; case 3: @@ -146,8 +146,7 @@ if (!isset($src)) // update status,total_time from lp_item_view table when you finish the exercises in learning path if (!empty($_REQUEST['exeId']) && isset($_GET['lp_id']) && isset($_GET['lp_item_id'])) { - $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db(); - global $src; + $_SESSION['oLP']->items[$_SESSION['oLP']->current]->write_to_db(); $TBL_TRACK_EXERCICES = Database::get_statistic_table(TABLE_STATISTIC_TRACK_E_EXERCICES); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);