Code Duplication    Length = 10-11 lines in 2 locations

main/work/work.lib.php 2 locations

@@ 1311-1320 (lines=10) @@
1308
        $extra_conditions = " (work.post_group_id = '0' or work.post_group_id IS NULL) ";
1309
    }
1310
1311
    if ($is_allowed_to_edit) {
1312
        $extra_conditions .= ' AND work.active IN (0, 1) ';
1313
    } else {
1314
        $extra_conditions .= ' AND work.active IN (0, 1) AND accepted = 1';
1315
        if (isset($course_info['show_score']) && $course_info['show_score'] == 1) {
1316
            $extra_conditions .= " AND work.user_id = ".api_get_user_id()." ";
1317
        } else {
1318
            $extra_conditions .= '';
1319
        }
1320
    }
1321
1322
    $extra_conditions .= " AND parent_id  = ".$work_id."  ";
1323
@@ 1973-1983 (lines=11) @@
1970
            $extra_conditions = " (work.post_group_id = '0' OR work.post_group_id is NULL) ";
1971
        }
1972
1973
        if ($is_allowed_to_edit || $isDrhOfCourse) {
1974
            $extra_conditions .= ' AND work.active IN (0, 1) ';
1975
        } else {
1976
            if (isset($course_info['show_score']) &&
1977
                $course_info['show_score'] == 1
1978
            ) {
1979
                $extra_conditions .= " AND (u.user_id = ".api_get_user_id()." AND work.active IN (0, 1)) ";
1980
            } else {
1981
                $extra_conditions .= ' AND work.active IN (0, 1) ';
1982
            }
1983
        }
1984
1985
        $extra_conditions .= " AND parent_id  = ".$work_id." ";
1986