From d144f4e06d6ae29a3422c2617a24a78a30f0583e Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Thu, 13 Apr 2017 14:07:02 +0200 Subject: [PATCH] Remove custom code, use object instead. --- main/lp/lp_edit_item_prereq.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/main/lp/lp_edit_item_prereq.php b/main/lp/lp_edit_item_prereq.php index 6c7bd58d75..b2829f332d 100755 --- a/main/lp/lp_edit_item_prereq.php +++ b/main/lp/lp_edit_item_prereq.php @@ -30,11 +30,12 @@ if ((!$is_allowed_to_edit) || ($isStudentView)) { header('location:lp_controller.php?action=view&lp_id=' . $learnpath_id); exit; } -$course_id = api_get_course_int_id(); -$sql = "SELECT * FROM $tbl_lp WHERE c_id = $course_id AND id = $learnpath_id"; -$result = Database::query($sql); -$therow = Database::fetch_array($result); +// Theme calls. +$show_learn_path = true; +/** @var learnpath $lp */ +$lp = $_SESSION['oLP']; +$lp_theme_css = $lp->get_theme(); /* SHOWING THE ADMIN TOOLS */ @@ -52,18 +53,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']}"), + 'name' => stripslashes($lp->get_name()), ); $interbreadcrumb[] = array( 'url' => api_get_self()."?action=add_item&type=step&lp_id=$learnpath_id&".api_get_cidreq(), 'name' => get_lang('NewStep'), ); -// Theme calls. -$show_learn_path = true; -/** @var learnpath $lp */ -$lp = $_SESSION['oLP']; -$lp_theme_css = $lp->get_theme(); Display::display_header(get_lang('LearnpathPrerequisites'), 'Path'); @@ -89,19 +85,18 @@ $suredel = trim(get_lang('AreYouSureToDeleteJS')); build_action_menu(); - echo '
'; echo '
'; echo $lp->return_new_tree(); echo '
'; echo '
'; +$lpItem = new learnpathItem($_GET['id']); if (isset($is_success) && $is_success == true) { - echo $lp->display_manipulate($_GET['id'], null); + echo $lp->display_manipulate($_GET['id'], $lpItem->get_type()); echo Display::return_message(get_lang("PrerequisitesAdded")); } else { - echo $lp->display_manipulate($_GET['id'], null); + echo $lp->display_manipulate($_GET['id'], $lpItem->get_type()); echo $lp->display_item_prerequisites_form($_GET['id']); } echo '
';