diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index db632f32ec..a85da7161b 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -1058,7 +1058,7 @@ class learnpath { if (empty ($id) || ($id != strval(intval($id))) || empty ($title)) { return false; } - + $tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM); $sql_select = "SELECT * FROM " . $tbl_lp_item . " WHERE c_id = ".$course_id." AND id = " . $id; $res_select = Database::query($sql_select); @@ -5034,14 +5034,17 @@ class learnpath { $move_icon .= ''; } - if ($arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] != 'dokeos_module') { - $edit_icon .= ''; - $edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY); - $edit_icon .= ''; - } else { - $edit_icon .= ''; - $edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY); - $edit_icon .= ''; + // No edit for this item types + if (!in_array($arrLP[$i]['item_type'], array('sco', 'asset'))) { + if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module'))) { + $edit_icon .= ''; + $edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY); + $edit_icon .= ''; + } else { + $edit_icon .= ''; + $edit_icon .= Display::return_icon('edit.png', get_lang('_edit_learnpath_module'), array(), ICON_SIZE_TINY); + $edit_icon .= ''; + } } $delete_icon .= ' '; @@ -5053,7 +5056,7 @@ class learnpath { if (!in_array($arrLP[$i]['item_type'], array('dokeos_chapter', 'dokeos_module', 'dir'))) { $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('Prerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq'); $move_item_icon = Display::url(Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_TINY), $url.'&action=move_item'); - $audio_icon = Display::url(Display::return_icon('audio.png', get_lang('Upload'), array(), ICON_SIZE_TINY), $url.'&action=add_audio'); + $audio_icon = Display::url(Display::return_icon('audio.png', get_lang('UplUpload'), array(), ICON_SIZE_TINY), $url.'&action=add_audio'); } } if ($update_audio != 'true') { @@ -5549,7 +5552,7 @@ class learnpath { case 'asset' : case 'sco' : if (isset ($_GET['view']) && $_GET['view'] == 'build') { - $return .= $this->display_manipulate($item_id, $row['item_type']); + $return .= $this->display_manipulate($item_id, $row['item_type']); $return .= $this->display_item_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', 'edit', $item_id, $row); } else { $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row); @@ -6521,7 +6524,7 @@ class learnpath { if ($id != 0 && is_array($extra_info)) { $item_title = $extra_info['title']; - $item_description = $extra_info['description']; + $item_description = $extra_info['description']; $item_path = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); $item_path_fck = '/scorm/' . $this->path . '/' . stripslashes($extra_info['path']); } else { @@ -6574,6 +6577,7 @@ class learnpath { $legend .= ''; $gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null; + $url = api_get_self() . '?' .api_get_cidreq().'&gradeboook='.$gradebook.'&action='.$action.'&type='.$item_type.'&lp_id='.$this->lp_id; $form = new FormValidator('form', 'POST', $url); @@ -6675,7 +6679,7 @@ class learnpath { $extension = null; if (!empty($item_path)) { $extension = pathinfo($item_path, PATHINFO_EXTENSION); - } + } //assets can't be modified @@ -6698,7 +6702,9 @@ class learnpath { 'BaseHref' => api_get_path(WEB_COURSE_PATH) . api_get_course_path().$item_path_fck ); $form->addElement('html_editor', 'content_lp', '', null, $editor_config); - $defaults['content_lp'] = file_get_contents($item_path); + $content_path = (api_get_path(SYS_COURSE_PATH).api_get_course_path().$item_path_fck); + //$defaults['content_lp'] = file_get_contents($item_path); + $defaults['content_lp'] = file_get_contents($content_path); } $form->addElement('hidden', 'type', 'dokeos_' . $item_type); diff --git a/main/newscorm/lp_controller.php b/main/newscorm/lp_controller.php index 92b7f8265d..1d309e2b22 100644 --- a/main/newscorm/lp_controller.php +++ b/main/newscorm/lp_controller.php @@ -407,7 +407,9 @@ switch ($action) { //$_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites']); // TODO: mp3 edit $audio = array(); + if (isset($_FILES['mp3'])) $audio = $_FILES['mp3']; + $_SESSION['oLP']->edit_item($_GET['id'], $_POST['parent'], $_POST['previous'], $_POST['title'], $_POST['description'], $_POST['prerequisites'], $audio, $_POST['maxTimeAllowed']); if (isset($_POST['content_lp'])) { diff --git a/main/newscorm/lp_edit.php b/main/newscorm/lp_edit.php index ea9a191331..21be771f74 100644 --- a/main/newscorm/lp_edit.php +++ b/main/newscorm/lp_edit.php @@ -218,7 +218,6 @@ if (api_is_platform_admin()) { $defaults['use_max_score'] = $_SESSION['oLP']->use_max_score; } - //Submit button $form->addElement('style_submit_button', 'Submit',get_lang('SaveLPSettings'),'class="save"'); diff --git a/main/newscorm/lp_edit_item.php b/main/newscorm/lp_edit_item.php index 5e1bf09d83..074d5f27fc 100644 --- a/main/newscorm/lp_edit_item.php +++ b/main/newscorm/lp_edit_item.php @@ -139,6 +139,7 @@ $path_item = isset($_GET['path_item']) ? $_GET['path_item'] : 0; $path_item = Database::escape_string($path_item); $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT); $sql_doc = "SELECT path FROM " . $tbl_doc . " WHERE c_id = $course_id AND id = '". $path_item."' "; + $res_doc = Database::query($sql_doc); $path_file = Database::result($res_doc, 0, 0); $path_parts = pathinfo($path_file); @@ -170,5 +171,4 @@ echo ''; echo ''; /* FOOTER */ - -Display::display_footer(); +Display::display_footer(); \ No newline at end of file