diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index f05639784a..c043129132 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -5615,7 +5615,7 @@ class learnpath { public function display_edit_item($item_id) { global $_course; // It will disappear. $course_id = api_get_course_int_id(); - $return = ''; + $return = ''; if (is_numeric($item_id)) { $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); $sql = "SELECT * FROM $tbl_lp_item WHERE c_id = ".$course_id." AND id = " . Database::escape_string($item_id); @@ -7700,11 +7700,13 @@ class learnpath { * @param array $data * @return string */ - public function display_item_small_form($item_type, $title = '', $data) { - $form = new FormValidator('small_form'); + public function display_item_small_form($item_type, $title = '', $data = array()) { + $url = api_get_self() . '?' .api_get_cidreq().'&action=edit_item&lp_id='.$this->lp_id; + $form = new FormValidator('small_form', 'post', $url); $form->addElement('header', $title); $form->addElement('text', 'title', get_lang('Title')); $form->addElement('button', 'submit_button', get_lang('Save')); + $form->addElement('hidden', 'id', $data['id']); $form->addElement('hidden', 'parent', $data['parent_item_id']); $form->addElement('hidden', 'previous', $data['previous_item_id']); $form->setDefaults(array('title' => $data['title'])); diff --git a/main/newscorm/lp_admin_view.php b/main/newscorm/lp_admin_view.php index d230ee4c86..927b3bd04a 100644 --- a/main/newscorm/lp_admin_view.php +++ b/main/newscorm/lp_admin_view.php @@ -21,9 +21,6 @@ api_protect_course_script(); /* Libraries */ -// The main_api.lib.php, database.lib.php and display.lib.php -// libraries are included by default. - include 'learnpath_functions.inc.php'; //include '../resourcelinker/resourcelinker.inc.php'; include 'resourcelinker.inc.php'; @@ -36,7 +33,6 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true); $tbl_lp = Database::get_course_table(TABLE_LP_MAIN); $tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM); -$tbl_lp_view = Database::get_course_table(TABLE_LP_VIEW); $isStudentView = (int) $_REQUEST['isStudentView']; $learnpath_id = (int) $_REQUEST['lp_id']; @@ -46,7 +42,7 @@ $submit = $_POST['submit_button']; // Using the resource linker as a tool for adding resources to the learning path. if ($action == 'add' and $type == 'learnpathitem') { - $htmlHeadXtra[] = ""; + $htmlHeadXtra[] = ""; } if ((!$is_allowed_to_edit) || ($isStudentView)) { error_log('New LP - User not authorized in lp_admin_view.php'); @@ -87,24 +83,8 @@ if (isset($_REQUEST['updateaudio'])) { $show_learn_path = true; $lp_theme_css = $_SESSION['oLP']->get_theme(); - - /* DISPLAY SECTION */ -switch ($_GET['action']) { - case 'edit_item': - if (isset($is_success) && $is_success === true) { - Display::display_confirmation_message(get_lang('LearnpathItemEdited')); - } else { - echo $_SESSION['oLP']->display_edit_item($_GET['id']); - } - break; - case 'delete_item': - if (isset($is_success) && $is_success === true) { - Display::display_confirmation_message(get_lang('LearnpathItemDeleted')); - } - break; -} // POST action handling (uploading mp3, deleting mp3) if (isset($_POST['save_audio'])) { @@ -187,8 +167,8 @@ if (isset($_POST['save_audio'])) { exit; } - Display::display_header(null, 'Path'); + $suredel = trim(get_lang('AreYouSureToDelete')); ?> @@ -303,7 +283,29 @@ function confirmation(name) { echo $_SESSION['oLP']->build_action_menu(); -echo $_SESSION['oLP']->overview(); +echo '