Code Duplication    Length = 4-5 lines in 8 locations

main/newscorm/learnpath.class.php 8 locations

@@ 6494-6497 (lines=4) @@
6491
        $item_title			= Security::remove_XSS($item_title);
6492
        $item_description 	= Security::remove_XSS($item_description);
6493
6494
        if ($id != 0 && is_array($extra_info))
6495
            $parent = $extra_info['parent_item_id'];
6496
        else
6497
            $parent = 0;
6498
6499
        $sql = "SELECT * FROM " . $tbl_lp_item . "
6500
                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ 6740-6744 (lines=5) @@
6737
            $item_description = '';
6738
        }
6739
6740
        if ($id != 0 && is_array($extra_info)) {
6741
            $parent = $extra_info['parent_item_id'];
6742
        } else {
6743
            $parent = 0;
6744
        }
6745
6746
        $sql = "SELECT * FROM $tbl_lp_item
6747
                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ 6913-6917 (lines=5) @@
6910
            $item_description = '';
6911
        }
6912
6913
        if ($id != 0 && is_array($extra_info)) {
6914
            $parent = $extra_info['parent_item_id'];
6915
        } else {
6916
            $parent = 0;
6917
        }
6918
6919
        $sql = "SELECT * FROM " . $tbl_lp_item . "
6920
                WHERE
@@ 7113-7117 (lines=5) @@
7110
            $item_description = '';
7111
        }
7112
7113
        if ($id != 0 && is_array($extra_info)) {
7114
            $parent = $extra_info['parent_item_id'];
7115
        } else {
7116
            $parent = 0;
7117
        }
7118
7119
        $sql = "SELECT * FROM " . $tbl_lp_item . "
7120
                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ 7332-7336 (lines=5) @@
7329
            $item_path_fck = '';
7330
        }
7331
7332
        if ($id != 0 && is_array($extra_info)) {
7333
            $parent = $extra_info['parent_item_id'];
7334
        } else {
7335
            $parent = 0;
7336
        }
7337
7338
        $id  = intval($id);
7339
        $sql = "SELECT * FROM " . $tbl_lp_item . "
@@ 7584-7588 (lines=5) @@
7581
        }
7582
        $return = '<legend>';
7583
7584
        if ($id != 0 && is_array($extra_info)) {
7585
            $parent = $extra_info['parent_item_id'];
7586
        } else {
7587
            $parent = 0;
7588
        }
7589
7590
        $sql = "SELECT * FROM " . $tbl_lp_item . "
7591
                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ 7877-7881 (lines=5) @@
7874
        $form = new FormValidator('edit_link', 'POST', api_get_self() . '?' .$_SERVER['QUERY_STRING']);
7875
        $defaults = [];
7876
7877
        if ($id != 0 && is_array($extra_info)) {
7878
            $parent = $extra_info['parent_item_id'];
7879
        } else {
7880
            $parent = 0;
7881
        }
7882
7883
        $sql = "SELECT * FROM " . $tbl_lp_item . "
7884
                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;
@@ 8086-8090 (lines=5) @@
8083
            $item_title = get_lang('Student_publication');
8084
        }
8085
8086
        if ($id != 0 && is_array($extra_info)) {
8087
            $parent = $extra_info['parent_item_id'];
8088
        } else {
8089
            $parent = 0;
8090
        }
8091
8092
        $sql = "SELECT * FROM " . $tbl_lp_item . "
8093
                WHERE c_id = ".$course_id." AND lp_id = " . $this->lp_id;