Code Duplication    Length = 15-16 lines in 2 locations

main/lp/learnpath.class.php 2 locations

@@ 6760-6774 (lines=15) @@
6757
                        );
6758
                    }
6759
                    break;
6760
                case TOOL_DOCUMENT:
6761
                    $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
6762
                    $sql = "SELECT lp.*, doc.path as dir
6763
                            FROM $tbl_lp_item as lp
6764
                            LEFT JOIN $tbl_doc as doc
6765
                            ON (doc.id = lp.path AND lp.c_id = doc.c_id)
6766
                            WHERE
6767
                                lp.c_id = $course_id AND
6768
                                doc.c_id = $course_id AND
6769
                                lp.id = ".intval($item_id);
6770
                    $res_step = Database::query($sql);
6771
                    $row_step = Database::fetch_array($res_step, 'ASSOC');
6772
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6773
                    $return .= $this->display_document_form('edit', $item_id, $row_step);
6774
                    break;
6775
                case TOOL_LINK:
6776
                    $link_id = (string) $row['path'];
6777
                    if (ctype_digit($link_id)) {
@@ 6790-6805 (lines=16) @@
6787
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6788
                    $return .= $this->display_link_form('edit', $item_id, $row);
6789
                    break;
6790
                case TOOL_LP_FINAL_ITEM:
6791
                    Session::write('finalItem', true);
6792
                    $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
6793
                    $sql = "SELECT lp.*, doc.path as dir
6794
                            FROM $tbl_lp_item as lp
6795
                            LEFT JOIN $tbl_doc as doc
6796
                            ON (doc.id = lp.path AND lp.c_id = doc.c_id)
6797
                            WHERE
6798
                                lp.c_id = $course_id AND
6799
                                doc.c_id = $course_id AND
6800
                                lp.id = ".intval($item_id);
6801
                    $res_step = Database::query($sql);
6802
                    $row_step = Database::fetch_array($res_step, 'ASSOC');
6803
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6804
                    $return .= $this->display_document_form('edit', $item_id, $row_step);
6805
                    break;
6806
                case TOOL_QUIZ:
6807
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6808
                    $return .= $this->display_quiz_form('edit', $item_id, $row);