Code Duplication    Length = 15-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

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