Code Duplication    Length = 11-11 lines in 2 locations

main/lp/learnpathItem.class.php 1 location

@@ 517-527 (lines=11) @@
514
            switch ($type) {
515
                case 'dir':
516
                    return '';
517
                case TOOL_DOCUMENT:
518
                    $table_doc = Database::get_course_table(TABLE_DOCUMENT);
519
                    $sql = 'SELECT path
520
                            FROM ' . $table_doc.'
521
                            WHERE
522
                                c_id = ' . $course_id.' AND
523
                                id = ' . $path;
524
                    $res = Database::query($sql);
525
                    $row = Database::fetch_array($res);
526
                    $real_path = 'document'.$row['path'];
527
                    return $real_path;
528
                case TOOL_STUDENTPUBLICATION:
529
                case TOOL_QUIZ:
530
                case TOOL_FORUM:

main/lp/learnpath.class.php 1 location

@@ 11874-11884 (lines=11) @@
11871
                    .'&lp_view_id='.$lpViewId.'&'.$extraParams;
11872
            case TOOL_FORUM:
11873
                return $main_dir_path.'forum/viewforum.php?forum='.$id.'&lp=true&'.$extraParams;
11874
            case TOOL_THREAD:  //forum post
11875
                $tbl_topics = Database::get_course_table(TABLE_FORUM_THREAD);
11876
                if (empty($id)) {
11877
                    return '';
11878
                }
11879
                $sql = "SELECT * FROM $tbl_topics WHERE c_id = $course_id AND thread_id=$id";
11880
                $result = Database::query($sql);
11881
                $myrow = Database::fetch_array($result);
11882
11883
                return $main_dir_path.'forum/viewthread.php?thread='.$id.'&forum='.$myrow['forum_id'].'&lp=true&'
11884
                    .$extraParams;
11885
            case TOOL_POST:
11886
                $tbl_post = Database::get_course_table(TABLE_FORUM_POST);
11887
                $result = Database::query("SELECT * FROM $tbl_post WHERE c_id = $course_id AND post_id=$id");