|
|
|
@ -205,8 +205,8 @@ api_protect_course_script(true); |
|
|
|
|
$lpfound = false; |
|
|
|
|
$myrefresh = 0; |
|
|
|
|
$myrefresh_id = 0; |
|
|
|
|
|
|
|
|
|
if (!empty($_SESSION['refresh']) && $_SESSION['refresh'] == 1) { |
|
|
|
|
$refresh = Session::read('refresh'); |
|
|
|
|
if ($refresh == 1) { |
|
|
|
|
// Check if we should do a refresh of the oLP object (for example after editing the LP). |
|
|
|
|
// If refresh is set, we regenerate the oLP object from the database (kind of flush). |
|
|
|
|
Session::erase('refresh'); |
|
|
|
@ -222,10 +222,10 @@ if (!empty($_REQUEST['dialog_box'])) { |
|
|
|
|
|
|
|
|
|
$lp_controller_touched = 1; |
|
|
|
|
$lp_found = false; |
|
|
|
|
|
|
|
|
|
if (isset($_SESSION['lpobject'])) { |
|
|
|
|
$lpObject = Session::read('lpobject'); |
|
|
|
|
if (!empty($lpObject)) { |
|
|
|
|
if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0); |
|
|
|
|
$oLP = unserialize($_SESSION['lpobject']); |
|
|
|
|
$oLP = unserialize($lpObject); |
|
|
|
|
if (isset($oLP) && is_object($oLP)) { |
|
|
|
|
if ($debug > 0) error_log('New LP - oLP is object', 0); |
|
|
|
|
if ($myrefresh == 1 || |
|
|
|
@ -235,12 +235,14 @@ if (isset($_SESSION['lpobject'])) { |
|
|
|
|
$oLP->scorm_debug == '1' |
|
|
|
|
) { |
|
|
|
|
if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0); |
|
|
|
|
if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); } |
|
|
|
|
if ($myrefresh == 1) { |
|
|
|
|
$myrefresh_id = $oLP->get_id(); |
|
|
|
|
} |
|
|
|
|
$oLP = null; |
|
|
|
|
Session::erase('oLP'); |
|
|
|
|
Session::erase('lpobject'); |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['oLP'] = $oLP; |
|
|
|
|
Session::write('oLP', $oLP); |
|
|
|
|
$lp_found = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -320,7 +322,7 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $ |
|
|
|
|
if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0); |
|
|
|
|
} |
|
|
|
|
if ($lp_found) { |
|
|
|
|
$_SESSION['oLP'] = $oLP; |
|
|
|
|
Session::write('oLP', $oLP); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -357,7 +359,11 @@ $action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : ''); |
|
|
|
|
$post_title = ""; |
|
|
|
|
if (isset($_POST['title'])) { |
|
|
|
|
$post_title = Security::remove_XSS($_POST['title']); |
|
|
|
|
if (isset($_POST['type']) && isset($_POST['title']) && $_POST['type'] == TOOL_QUIZ && !empty($_POST['title'])) { |
|
|
|
|
if (isset($_POST['type']) && |
|
|
|
|
isset($_POST['title']) && |
|
|
|
|
$_POST['type'] == TOOL_QUIZ && |
|
|
|
|
!empty($_POST['title']) |
|
|
|
|
) { |
|
|
|
|
$post_title = Exercise::format_title_variable($_POST['title']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -379,7 +385,7 @@ switch ($action) { |
|
|
|
|
} |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
|
|
|
|
|
if (isset($_POST['submit_button']) && !empty($post_title)) { |
|
|
|
|
// If a title was submitted: |
|
|
|
@ -391,7 +397,7 @@ switch ($action) { |
|
|
|
|
// Check post_time to ensure ??? (counter-hacking measure?) |
|
|
|
|
require 'lp_add_item.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['post_time'] = $_POST['post_time']; |
|
|
|
|
Session::write('post_time', $_POST['post_time']); |
|
|
|
|
$directoryParentId = isset($_POST['directory_parent_id']) ? $_POST['directory_parent_id'] : 0; |
|
|
|
|
$courseInfo = api_get_course_info(); |
|
|
|
|
if (empty($directoryParentId)) { |
|
|
|
@ -469,7 +475,7 @@ switch ($action) { |
|
|
|
|
} |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['id'])) { |
|
|
|
|
$lp_item_obj = new learnpathItem($_REQUEST['id']); |
|
|
|
@ -542,12 +548,12 @@ switch ($action) { |
|
|
|
|
} |
|
|
|
|
if (isset($_REQUEST['lp_name']) && !empty($_REQUEST['lp_name'])) { |
|
|
|
|
$_REQUEST['lp_name'] = trim($_REQUEST['lp_name']); |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
|
|
|
|
|
if (isset($_SESSION['post_time']) && $_SESSION['post_time'] == $_REQUEST['post_time']) { |
|
|
|
|
require 'lp_add.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['post_time'] = $_REQUEST['post_time']; |
|
|
|
|
Session::write('post_time', $_POST['post_time']); |
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['activate_start_date_check']) && |
|
|
|
|
$_REQUEST['activate_start_date_check'] == 1 |
|
|
|
@ -605,7 +611,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for admin_view', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
require 'lp_admin_view.php'; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -633,7 +639,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for build', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
//require 'lp_build.php'; |
|
|
|
|
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id).'&'.api_get_cidreq(); |
|
|
|
|
header('Location: '.$url); |
|
|
|
@ -648,7 +654,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for edit item', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
if (isset($_POST['submit_button']) && !empty($post_title)) { |
|
|
|
|
//Updating the lp.modified_on |
|
|
|
|
$_SESSION['oLP']->set_modified_on(); |
|
|
|
@ -703,9 +709,9 @@ switch ($action) { |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
if (isset($_POST['submit_button'])) { |
|
|
|
|
//Updating the lp.modified_on |
|
|
|
|
// Updating the lp.modified_on |
|
|
|
|
$_SESSION['oLP']->set_modified_on(); |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$editPrerequisite = $_SESSION['oLP']->edit_item_prereq( |
|
|
|
|
$_GET['id'], |
|
|
|
|
$_POST['prerequisites'], |
|
|
|
@ -734,7 +740,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for move item', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
if (isset($_POST['submit_button'])) { |
|
|
|
|
//Updating the lp.modified_on |
|
|
|
|
$_SESSION['oLP']->set_modified_on(); |
|
|
|
@ -769,7 +775,7 @@ switch ($action) { |
|
|
|
|
if (!$lp_found) { |
|
|
|
|
error_log('New LP - No learnpath given for view item', 0); require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
require 'lp_view_item.php'; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -845,7 +851,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for delete', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->delete(null, $_GET['lp_id'], 'remove'); |
|
|
|
|
Display::addFlash(Display::return_message(get_lang('Deleted'))); |
|
|
|
|
Session::erase('oLP'); |
|
|
|
@ -933,7 +939,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for edit', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
require 'lp_edit.php'; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
@ -945,7 +951,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for edit', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$lp_name = Security::remove_XSS($_REQUEST['lp_name']); |
|
|
|
|
$_SESSION['oLP']->set_name($lp_name); |
|
|
|
|
$author = $_REQUEST['lp_author']; |
|
|
|
@ -1062,7 +1068,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for add sub item', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
if (!empty($_REQUEST['parent_item_id'])) { |
|
|
|
|
$_SESSION['from_learnpath'] = 'yes'; |
|
|
|
|
$_SESSION['origintoolurl'] = 'lp_controller.php?action=admin_view&lp_id='.intval($_REQUEST['lp_id']); |
|
|
|
@ -1182,7 +1188,7 @@ switch ($action) { |
|
|
|
|
break; |
|
|
|
|
case 'list': |
|
|
|
|
if ($lp_found) { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->save_last(); |
|
|
|
|
} |
|
|
|
|
require 'lp_list.php'; |
|
|
|
@ -1207,7 +1213,7 @@ switch ($action) { |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} |
|
|
|
|
if (Security::check_token('get')) { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->update_default_view_mode(); |
|
|
|
|
} |
|
|
|
|
require 'lp_list.php'; |
|
|
|
@ -1217,7 +1223,7 @@ switch ($action) { |
|
|
|
|
error_log('New LP - No learnpath given for switch', 0); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->update_default_scorm_commit(); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
break; |
|
|
|
@ -1237,13 +1243,13 @@ switch ($action) { |
|
|
|
|
*/ |
|
|
|
|
case 'switch_attempt_mode': |
|
|
|
|
if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; } |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->switch_attempt_mode(); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
break; |
|
|
|
|
case 'switch_scorm_debug': |
|
|
|
|
if (!$lp_found) { error_log('New LP - No learnpath given for switch', 0); require 'lp_list.php'; } |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->update_scorm_debug(); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
break; |
|
|
|
@ -1311,7 +1317,7 @@ switch ($action) { |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
$_SESSION['oLP']->set_seriousgame_mode(); |
|
|
|
|
require 'lp_list.php'; |
|
|
|
|
break; |
|
|
|
@ -1428,7 +1434,7 @@ switch ($action) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
Session::write('refresh', 1); |
|
|
|
|
if (!isset($_POST['submit']) || empty($post_title)) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|