Code Duplication    Length = 15-16 lines in 2 locations

main/lp/learnpath.class.php 2 locations

@@ 6712-6726 (lines=15) @@
6709
                        );
6710
                    }
6711
                    break;
6712
                case TOOL_DOCUMENT:
6713
                    $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
6714
                    $sql = "SELECT lp.*, doc.path as dir
6715
                            FROM $tbl_lp_item as lp
6716
                            LEFT JOIN $tbl_doc as doc
6717
                            ON (doc.id = lp.path AND lp.c_id = doc.c_id)
6718
                            WHERE
6719
                                lp.c_id = $course_id AND
6720
                                doc.c_id = $course_id AND
6721
                                lp.id = ".intval($item_id);
6722
                    $res_step = Database::query($sql);
6723
                    $row_step = Database::fetch_array($res_step, 'ASSOC');
6724
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6725
                    $return .= $this->display_document_form('edit', $item_id, $row_step);
6726
                    break;
6727
                case TOOL_LINK:
6728
                    $link_id = (string) $row['path'];
6729
                    if (ctype_digit($link_id)) {
@@ 6742-6757 (lines=16) @@
6739
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6740
                    $return .= $this->display_link_form('edit', $item_id, $row);
6741
                    break;
6742
                case TOOL_LP_FINAL_ITEM:
6743
                    Session::write('finalItem', true);
6744
                    $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
6745
                    $sql = "SELECT lp.*, doc.path as dir
6746
                            FROM $tbl_lp_item as lp
6747
                            LEFT JOIN $tbl_doc as doc
6748
                            ON (doc.id = lp.path AND lp.c_id = doc.c_id)
6749
                            WHERE
6750
                                lp.c_id = $course_id AND
6751
                                doc.c_id = $course_id AND
6752
                                lp.id = ".intval($item_id);
6753
                    $res_step = Database::query($sql);
6754
                    $row_step = Database::fetch_array($res_step, 'ASSOC');
6755
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6756
                    $return .= $this->display_document_form('edit', $item_id, $row_step);
6757
                    break;
6758
                case TOOL_QUIZ:
6759
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6760
                    $return .= $this->display_quiz_form('edit', $item_id, $row);