public function get_group_list() {

        // No groups for system.
        if (empty($this->course)) {
            return array();
        }

        $context = context_course::instance($this->course->id);
        $groups = array();
        $groupmode = groups_get_course_groupmode($this->course);
        if (($groupmode == VISIBLEGROUPS) ||
                ($groupmode == SEPARATEGROUPS and has_capability('moodle/site:accessallgroups', $context))) {
            // Get all groups.
            if ($cgroups = groups_get_all_groups($this->course->id)) {
                foreach ($cgroups as $cgroup) {
                    $groups[$cgroup->id] = $cgroup->name;
                }
            }
        }
        return $groups;
    }
public function get_group_list() {

        // No groups for system.
        if (empty($this->course)) {
            return array();
        }

        $context = context_course::instance($this->course->id);
        $groups = array();
        $groupmode = groups_get_course_groupmode($this->course);
        if (($groupmode == VISIBLEGROUPS) ||
                ($groupmode == SEPARATEGROUPS and has_capability('moodle/site:accessallgroups', $context))) {
            // Get all groups.
            if ($cgroups = groups_get_all_groups($this->course->id)) {
                foreach ($cgroups as $cgroup) {
                    $groups[$cgroup->id] = $cgroup->name;
                }
            }
        }
        return $groups;
    }
public function get_group_list ( ) { // No groups for system. if ( empty ( $ this -> course ) ) { return array ( ) ; } $ context = context_course :: instance ( $ this -> course -> id ) ; $ groups = array ( ) ; $ groupmode = groups_get_course_groupmode ( $ this -> course ) ; if ( ( $ groupmode == VISIBLEGROUPS ) || ( $ groupmode == SEPARATEGROUPS and has_capability ( 'moodle/site:accessallgroups' , $ context ) ) ) { // Get all groups. if ( $ cgroups = groups_get_all_groups ( $ this -> course -> id ) ) { foreach ( $ cgroups as $ cgroup ) { $ groups [ $ cgroup -> id ] = $ cgroup -> name ; } } } return $ groups ; }
Return list of groups.

@return array list of groups.
Return list of groups .