diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 815fb2dfa9..833e92ccf2 100644 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -4815,6 +4815,146 @@ class learnpath { } public function return_new_tree($update_audio = 'false') { + + $ajax_url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php'; + echo ' + '; + $is_allowed_to_edit = api_is_allowed_to_edit(null,true); $course_id = api_get_course_int_id(); @@ -4824,7 +4964,7 @@ class learnpath { WHERE c_id = $course_id AND lp_id = ".$this->lp_id; $result = Database::query($sql); - $arrLP = array (); + $arrLP = array(); while ($row = Database :: fetch_array($result)) { $row['title'] = Security :: remove_XSS($row['title']); $row['description'] = Security :: remove_XSS($row['description']); @@ -4925,10 +5065,21 @@ class learnpath { $delete_icon .= ' '; $delete_icon .= Display::return_icon('delete.png', get_lang('_delete_learnpath_module'), array(), ICON_SIZE_TINY); - $delete_icon .= ''; + $delete_icon .= ''; + + $url = api_get_self() . '?cidReq='.Security::remove_XSS($_GET['cidReq']).'&view=build&id='.$arrLP[$i]['id'] .'&lp_id='.$this->lp_id; + + if ($arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] != 'chapter') { + $prerequisities_icon = Display::url(Display::return_icon('accept.png', get_lang('Prerequisites'), array(), ICON_SIZE_TINY), $url.'&action=edit_item_prereq'); + } + + //if ($arrLP[$i]['item_type'] != 'dokeos_chapter' && $arrLP[$i]['item_type'] != 'chapter') { + $moves_icon = Display::url(Display::return_icon('move.png', get_lang('Move'), array(), ICON_SIZE_TINY), $url.'&action=move_item'); + //} + } if ($update_audio != 'true') { - $row = $move_icon.' '.$icon.Display::span($title_cut).Display::span($audio.$edit_icon.$delete_icon, array('class'=>'button_actions')); + $row = $move_icon.' '.$icon.Display::span($title_cut).Display::span($audio.$edit_icon.$prerequisities_icon.$moves_icon.$delete_icon, array('class'=>'button_actions')); } else { $row = Display::span($title.$icon).Display::span($audio, array('class'=>'button_actions')); } @@ -4984,9 +5135,11 @@ class learnpath { } } } + if ($update_audio == 'false') { + $return = '
'; + } - $return = '
'; + } return $return; } diff --git a/main/newscorm/lp_add_item.php b/main/newscorm/lp_add_item.php index 004ac6763d..3d7c3a845c 100644 --- a/main/newscorm/lp_add_item.php +++ b/main/newscorm/lp_add_item.php @@ -24,147 +24,8 @@ include 'resourcelinker.inc.php'; $language_file = 'learnpath'; -$ajax_url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php'; $htmlHeadXtra[] = ' '; $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']; @@ -98,13 +96,13 @@ if (!empty($gradebook) && $gradebook == 'view') { } $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths')); $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}")); -$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit')); +$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep')); // Theme calls. $show_learn_path = true; $lp_theme_css = $_SESSION['oLP']->get_theme(); -Display::display_header(null,'Path'); +Display::display_header(get_lang('Edit'),'Path'); $suredel = trim(get_lang('AreYouSureToDelete')); ?> @@ -146,21 +144,14 @@ $path_file = Database::result($res_doc, 0, 0); $path_parts = pathinfo($path_file); if (Database::num_rows($res_doc) > 0 && $path_parts['extension'] == 'html') { - $count_items = count($_SESSION['oLP']->ordered_items); - $style = ($count_items > 12) ? ' style="height:250px;width:230px;overflow-x : auto; overflow : scroll;" ' : ' class="lp_tree" '; - echo '
'; - // Build the tree with the menu items in it. - echo $_SESSION['oLP']->build_tree(); - echo '
'; + echo $_SESSION['oLP']->return_new_tree(); + // Show the template list echo '

'; echo '
'; echo '
'; } else { - echo '
'; - // Build the tree with the menu items in it. - echo $_SESSION['oLP']->build_tree(); - echo '
'; + echo $_SESSION['oLP']->return_new_tree(); } echo ''; diff --git a/main/newscorm/lp_edit_item_prereq.php b/main/newscorm/lp_edit_item_prereq.php index 4ee1a8e2e8..0046b8631f 100644 --- a/main/newscorm/lp_edit_item_prereq.php +++ b/main/newscorm/lp_edit_item_prereq.php @@ -67,16 +67,15 @@ if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths')); $interbreadcrumb[] = array('url' => api_get_self()."?action=build&lp_id=$learnpath_id", 'name' => stripslashes("{$therow['name']}")); +$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id", 'name' => get_lang('NewStep')); // Theme calls. $show_learn_path = true; $lp_theme_css = $_SESSION['oLP']->get_theme(); -Display::display_header(null,'Path'); -//api_display_tool_title($therow['name']); +Display::display_header(get_lang('Prerequisites'),'Path'); $suredel = trim(get_lang('AreYouSureToDelete')); -//$suredelstep = trim(get_lang('AreYouSureToDeleteSteps')); ?>