|
|
|
@ -326,7 +326,7 @@ if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $ |
|
|
|
|
if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
|
|
|
$oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id()); |
|
|
|
|
if ($oLP !== false) { $lp_found = true; } else { error_log($oLP->error, 0); } |
|
|
|
|
break; |
|
|
|
|
break; |
|
|
|
|
case 2: |
|
|
|
|
if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0); |
|
|
|
|
$oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id()); |
|
|
|
@ -382,6 +382,15 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') { |
|
|
|
|
|
|
|
|
|
$action = (!empty($_REQUEST['action']) ? $_REQUEST['action'] : ''); |
|
|
|
|
|
|
|
|
|
// format title to be displayed correctly if QUIZ |
|
|
|
|
$post_title = ""; |
|
|
|
|
if (isset($_POST['title'])) { |
|
|
|
|
$post_title = $_POST['title']; |
|
|
|
|
if (isset($_POST['type']) && isset($_POST['title']) && $_POST['type'] == TOOL_QUIZ && !empty($_POST['title'])) { |
|
|
|
|
$post_title = Exercise::format_title_variable($_POST['title']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
switch ($action) { |
|
|
|
|
case 'add_item': |
|
|
|
|
if (!$is_allowed_to_edit) { |
|
|
|
@ -396,7 +405,7 @@ switch ($action) { |
|
|
|
|
} else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
|
|
|
|
|
if (isset($_POST['submit_button']) && !empty($_POST['title'])) { |
|
|
|
|
if (isset($_POST['submit_button']) && !empty($post_title)) { |
|
|
|
|
// If a title was sumbitted: |
|
|
|
|
|
|
|
|
|
//Updating the lp.modified_on |
|
|
|
@ -406,6 +415,7 @@ switch ($action) { |
|
|
|
|
// Check post_time to ensure ??? (counter-hacking measure?) |
|
|
|
|
require 'lp_add_item.php'; |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
$_SESSION['post_time'] = $_POST['post_time']; |
|
|
|
|
if ($_POST['type'] == TOOL_DOCUMENT) { |
|
|
|
|
if (isset($_POST['path']) && $_GET['edit'] != 'true') { |
|
|
|
@ -413,10 +423,10 @@ switch ($action) { |
|
|
|
|
} else { |
|
|
|
|
$document_id = $_SESSION['oLP']->create_document($_course); |
|
|
|
|
} |
|
|
|
|
$new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $document_id, $_POST['title'], $_POST['description'], $_POST['prerequisites']); |
|
|
|
|
$new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $document_id, $post_title, $_POST['description'], $_POST['prerequisites']); |
|
|
|
|
} else { |
|
|
|
|
// For all other item types than documents, load the item using the item type and path rather than its ID. |
|
|
|
|
$new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $_POST['path'], $_POST['title'], $_POST['description'], $_POST['prerequisites'], $_POST['maxTimeAllowed']); |
|
|
|
|
$new_item_id = $_SESSION['oLP']->add_item($_POST['parent'], $_POST['previous'], $_POST['type'], $_POST['path'], $post_title, $_POST['description'], $_POST['prerequisites'], $_POST['maxTimeAllowed']); |
|
|
|
|
} |
|
|
|
|
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id); |
|
|
|
|
header('Location: '.$url); |
|
|
|
@ -566,7 +576,7 @@ switch ($action) { |
|
|
|
|
if (!$lp_found) { error_log('New LP - No learnpath given for edit item', 0); require 'lp_list.php'; } |
|
|
|
|
else { |
|
|
|
|
$_SESSION['refresh'] = 1; |
|
|
|
|
if (isset($_POST['submit_button']) && !empty($_POST['title'])) { |
|
|
|
|
if (isset($_POST['submit_button']) && !empty($post_title)) { |
|
|
|
|
|
|
|
|
|
//Updating the lp.modified_on |
|
|
|
|
$_SESSION['oLP']->set_modified_on(); |
|
|
|
@ -576,7 +586,7 @@ switch ($action) { |
|
|
|
|
if (isset($_FILES['mp3'])) { |
|
|
|
|
$audio = $_FILES['mp3']; |
|
|
|
|
} |
|
|
|
|
$_SESSION['oLP']->edit_item($_REQUEST['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites'], $audio, $_POST['maxTimeAllowed']); |
|
|
|
|
$_SESSION['oLP']->edit_item($_REQUEST['id'], $_POST['parent'], $_POST['previous'], $post_title, $_POST['description'], $_POST['prerequisites'], $audio, $_POST['maxTimeAllowed']); |
|
|
|
|
|
|
|
|
|
if (isset($_POST['content_lp'])) { |
|
|
|
|
$_SESSION['oLP']->edit_document($_course); |
|
|
|
@ -631,8 +641,7 @@ switch ($action) { |
|
|
|
|
if (isset($_POST['submit_button'])) { |
|
|
|
|
//Updating the lp.modified_on |
|
|
|
|
$_SESSION['oLP']->set_modified_on(); |
|
|
|
|
|
|
|
|
|
$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description']); |
|
|
|
|
$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $post_title, $_POST['description']); |
|
|
|
|
$is_success = true; |
|
|
|
|
$url = api_get_self().'?action=add_item&type=step&lp_id='.intval($_SESSION['oLP']->lp_id); |
|
|
|
|
header('Location: '.$url); |
|
|
|
|