Code Duplication    Length = 9-11 lines in 2 locations

main/inc/lib/groupmanager.lib.php 2 locations

@@ 64-72 (lines=9) @@
61
    /**
62
     * @return array
63
     */
64
    public static function get_groups()
65
    {
66
        $table_group = Database :: get_course_table(TABLE_GROUP);
67
        $course_id = api_get_course_int_id();
68
69
        $sql = "SELECT * FROM $table_group WHERE c_id = $course_id ";
70
        $result = Database::query($sql);
71
        return Database::store_result($result, 'ASSOC');
72
    }
73
74
    /**
75
     * Get list of groups for current course.
@@ 635-645 (lines=11) @@
632
     * Get the total number of groups for the current course.
633
     * @return int The number of groups for the current course.
634
     */
635
    public static function get_number_of_groups()
636
    {
637
        $course_id = api_get_course_int_id();
638
        $table_group = Database :: get_course_table(TABLE_GROUP);
639
        $sql = "SELECT COUNT(id) AS number_of_groups
640
                FROM $table_group
641
                WHERE c_id = $course_id ";
642
        $res = Database::query($sql);
643
        $obj = Database::fetch_object($res);
644
        return $obj->number_of_groups;
645
    }
646
647
    /**
648
     * Get all categories