Code Duplication    Length = 15-16 lines in 2 locations

main/newscorm/learnpath.class.php 2 locations

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