Code Duplication    Length = 15-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

@@ 6291-6305 (lines=15) @@
6288
                        $return .= $this->display_item_small_form($row['item_type'], get_lang('EditCurrentChapter') . ' :', $row);
6289
                    }
6290
                    break;
6291
                case TOOL_DOCUMENT :
6292
                    $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6293
                    $sql = "SELECT lp.*, doc.path as dir
6294
                            FROM " . $tbl_lp_item . " as lp
6295
                            LEFT JOIN " . $tbl_doc . " as doc
6296
                            ON doc.id = lp.path
6297
                            WHERE
6298
                                lp.c_id = $course_id AND
6299
                                doc.c_id = $course_id AND
6300
                                lp.id = " . intval($item_id);
6301
                    $res_step = Database::query($sql);
6302
                    $row_step = Database :: fetch_array($res_step, 'ASSOC');
6303
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6304
                    $return .= $this->display_document_form('edit', $item_id, $row_step);
6305
                    break;
6306
                case TOOL_LINK :
6307
                    $link_id = (string) $row['path'];
6308
                    if (ctype_digit($link_id)) {
@@ 6321-6336 (lines=16) @@
6318
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6319
                    $return .= $this->display_link_form('edit', $item_id, $row);
6320
                    break;
6321
                case TOOL_LP_FINAL_ITEM :
6322
                    $_SESSION['finalItem'] = true;
6323
                    $tbl_doc = Database :: get_course_table(TABLE_DOCUMENT);
6324
                    $sql = "SELECT lp.*, doc.path as dir
6325
                            FROM " . $tbl_lp_item . " as lp
6326
                            LEFT JOIN " . $tbl_doc . " as doc
6327
                            ON doc.id = lp.path
6328
                            WHERE
6329
                                lp.c_id = $course_id AND
6330
                                doc.c_id = $course_id AND
6331
                                lp.id = " . intval($item_id);
6332
                    $res_step = Database::query($sql);
6333
                    $row_step = Database :: fetch_array($res_step, 'ASSOC');
6334
                    $return .= $this->display_manipulate($item_id, $row['item_type']);
6335
                    $return .= $this->display_document_form('edit', $item_id, $row_step);
6336
                    break;
6337
                case 'dokeos_module' :
6338
                    if (isset ($_GET['view']) && $_GET['view'] == 'build') {
6339
                        $return .= $this->display_manipulate($item_id, $row['item_type']);