Code Duplication    Length = 17-18 lines in 8 locations

main/lp/learnpath.class.php 8 locations

@@ 6969-6986 (lines=18) @@
6966
6967
        $result = Database::query($sql);
6968
        $arrLP = array();
6969
        while ($row = Database::fetch_array($result)) {
6970
            $arrLP[] = array(
6971
                'id' => $row['id'],
6972
                'item_type' => $row['item_type'],
6973
                'title' => $row['title'],
6974
                'path' => $row['path'],
6975
                'description' => $row['description'],
6976
                'parent_item_id' => $row['parent_item_id'],
6977
                'previous_item_id' => $row['previous_item_id'],
6978
                'next_item_id' => $row['next_item_id'],
6979
                'display_order' => $row['display_order'],
6980
                'max_score' => $row['max_score'],
6981
                'min_score' => $row['min_score'],
6982
                'mastery_score' => $row['mastery_score'],
6983
                'prerequisite' => $row['prerequisite'],
6984
                'max_time_allowed' => $row['max_time_allowed']
6985
            );
6986
        }
6987
6988
        $this->tree_array($arrLP);
6989
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
@@ 7182-7199 (lines=18) @@
7179
                WHERE c_id = ".$course_id." AND lp_id = ".$this->lp_id;
7180
        $result = Database::query($sql);
7181
        $arrLP = array();
7182
        while ($row = Database::fetch_array($result)) {
7183
            $arrLP[] = array(
7184
                'id' => $row['id'],
7185
                'item_type' => $row['item_type'],
7186
                'title' => $row['title'],
7187
                'path' => $row['path'],
7188
                'description' => $row['description'],
7189
                'parent_item_id' => $row['parent_item_id'],
7190
                'previous_item_id' => $row['previous_item_id'],
7191
                'next_item_id' => $row['next_item_id'],
7192
                'display_order' => $row['display_order'],
7193
                'max_score' => $row['max_score'],
7194
                'min_score' => $row['min_score'],
7195
                'mastery_score' => $row['mastery_score'],
7196
                'prerequisite' => $row['prerequisite'],
7197
                'max_time_allowed' => $row['max_time_allowed']
7198
            );
7199
        }
7200
7201
        $legend = '<legend>';
7202
        if ($action == 'add') {
@@ 7359-7375 (lines=17) @@
7356
                    lp_id = " . $this->lp_id;
7357
        $result = Database::query($sql);
7358
        $arrLP = array();
7359
        while ($row = Database::fetch_array($result)) {
7360
            $arrLP[] = array(
7361
                'id' => $row['id'],
7362
                'item_type' => $row['item_type'],
7363
                'title' => $row['title'],
7364
                'path' => $row['path'],
7365
                'description' => $row['description'],
7366
                'parent_item_id' => $row['parent_item_id'],
7367
                'previous_item_id' => $row['previous_item_id'],
7368
                'next_item_id' => $row['next_item_id'],
7369
                'display_order' => $row['display_order'],
7370
                'max_score' => $row['max_score'],
7371
                'min_score' => $row['min_score'],
7372
                'mastery_score' => $row['mastery_score'],
7373
                'prerequisite' => $row['prerequisite']
7374
            );
7375
        }
7376
7377
        $this->tree_array($arrLP);
7378
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
@@ 7566-7582 (lines=17) @@
7563
        $result = Database::query($sql);
7564
7565
        $arrLP = array();
7566
        while ($row = Database::fetch_array($result)) {
7567
            $arrLP[] = array(
7568
                'id' => $row['id'],
7569
                'item_type' => $row['item_type'],
7570
                'title' => $row['title'],
7571
                'path' => $row['path'],
7572
                'description' => $row['description'],
7573
                'parent_item_id' => $row['parent_item_id'],
7574
                'previous_item_id' => $row['previous_item_id'],
7575
                'next_item_id' => $row['next_item_id'],
7576
                'display_order' => $row['display_order'],
7577
                'max_score' => $row['max_score'],
7578
                'min_score' => $row['min_score'],
7579
                'mastery_score' => $row['mastery_score'],
7580
                'prerequisite' => $row['prerequisite']
7581
            );
7582
        }
7583
7584
        $this->tree_array($arrLP);
7585
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
@@ 7788-7804 (lines=17) @@
7785
        $result = Database::query($sql);
7786
        $arrLP = [];
7787
7788
        while ($row = Database::fetch_array($result)) {
7789
            $arrLP[] = array(
7790
                'id' => $row['id'],
7791
                'item_type' => $row['item_type'],
7792
                'title' => $row['title'],
7793
                'path' => $row['path'],
7794
                'description' => $row['description'],
7795
                'parent_item_id' => $row['parent_item_id'],
7796
                'previous_item_id' => $row['previous_item_id'],
7797
                'next_item_id' => $row['next_item_id'],
7798
                'max_score' => $row['max_score'],
7799
                'min_score' => $row['min_score'],
7800
                'mastery_score' => $row['mastery_score'],
7801
                'prerequisite' => $row['prerequisite'],
7802
                'display_order' => $row['display_order']
7803
            );
7804
        }
7805
7806
        $this->tree_array($arrLP);
7807
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
@@ 8052-8068 (lines=17) @@
8049
8050
        $result = Database::query($sql);
8051
        $arrLP = array();
8052
        while ($row = Database::fetch_array($result)) {
8053
            $arrLP[] = array(
8054
                'id' => $row['id'],
8055
                'item_type' => $row['item_type'],
8056
                'title' => $row['title'],
8057
                'path' => $row['path'],
8058
                'description' => $row['description'],
8059
                'parent_item_id' => $row['parent_item_id'],
8060
                'previous_item_id' => $row['previous_item_id'],
8061
                'next_item_id' => $row['next_item_id'],
8062
                'display_order' => $row['display_order'],
8063
                'max_score' => $row['max_score'],
8064
                'min_score' => $row['min_score'],
8065
                'mastery_score' => $row['mastery_score'],
8066
                'prerequisite' => $row['prerequisite']
8067
            );
8068
        }
8069
8070
        $this->tree_array($arrLP);
8071
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
@@ 8419-8435 (lines=17) @@
8416
        $result = Database::query($sql);
8417
        $arrLP = array();
8418
8419
        while ($row = Database::fetch_array($result)) {
8420
            $arrLP[] = array(
8421
                'id' => $row['id'],
8422
                'item_type' => $row['item_type'],
8423
                'title' => $row['title'],
8424
                'path' => $row['path'],
8425
                'description' => $row['description'],
8426
                'parent_item_id' => $row['parent_item_id'],
8427
                'previous_item_id' => $row['previous_item_id'],
8428
                'next_item_id' => $row['next_item_id'],
8429
                'display_order' => $row['display_order'],
8430
                'max_score' => $row['max_score'],
8431
                'min_score' => $row['min_score'],
8432
                'mastery_score' => $row['mastery_score'],
8433
                'prerequisite' => $row['prerequisite']
8434
            );
8435
        }
8436
8437
        $this->tree_array($arrLP);
8438
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;
@@ 8624-8640 (lines=17) @@
8621
8622
        $result = Database::query($sql);
8623
        $arrLP = array();
8624
        while ($row = Database::fetch_array($result)) {
8625
            $arrLP[] = array(
8626
                'id' => $row['id'],
8627
                'item_type' => $row['item_type'],
8628
                'title' => $row['title'],
8629
                'path' => $row['path'],
8630
                'description' => $row['description'],
8631
                'parent_item_id' => $row['parent_item_id'],
8632
                'previous_item_id' => $row['previous_item_id'],
8633
                'next_item_id' => $row['next_item_id'],
8634
                'display_order' => $row['display_order'],
8635
                'max_score' => $row['max_score'],
8636
                'min_score' => $row['min_score'],
8637
                'mastery_score' => $row['mastery_score'],
8638
                'prerequisite' => $row['prerequisite']
8639
            );
8640
        }
8641
8642
        $this->tree_array($arrLP);
8643
        $arrLP = isset($this->arrMenu) ? $this->arrMenu : null;