Code Duplication    Length = 4-11 lines in 3 locations

main/gradebook/lib/be/category.class.php 3 locations

@@ 1641-1651 (lines=11) @@
1638
            // Special case: this is the root
1639
            if ($this->id == 0) {
1640
                return Category::get_root_categories_for_student($stud_id, $course_code, $session_id);
1641
            } else {
1642
                return Category::load(
1643
                    null,
1644
                    null,
1645
                    $course_code,
1646
                    $this->id,
1647
                    api_is_allowed_to_edit() ? null : 1,
1648
                    $session_id,
1649
                    $order
1650
                );
1651
            }
1652
        } else {
1653
            // All students
1654
            // Course admin
@@ 1663-1666 (lines=4) @@
1660
                    // inside a course
1661
                } elseif (!empty($this->course_code)) {
1662
                    return Category::load(null, null, $this->course_code, $this->id, null, $session_id, $order);
1663
                } elseif (!empty($course_code)) {
1664
                    return Category::load(null, null, $course_code, $this->id, null, $session_id, $order);
1665
                    // course independent
1666
                } else {
1667
                    return Category::load(null, api_get_user_id(), 0, $this->id, null);
1668
                }
1669
            } elseif (api_is_platform_admin()) {
@@ 1669-1673 (lines=5) @@
1666
                } else {
1667
                    return Category::load(null, api_get_user_id(), 0, $this->id, null);
1668
                }
1669
            } elseif (api_is_platform_admin()) {
1670
                // platform admin
1671
                // we explicitly avoid listing subcats from another session
1672
                return Category::load(null, null, $course_code, $this->id, null, $session_id, $order);
1673
            }
1674
        }
1675
1676
        return array();