Sort group list Moodle
March 26, 2008 – 12:08For client, who uses branches around the world as groups, we made a custom login procedure which allow the user to select his branch from a drop down list. In the code, this branch is also the enrolment key to force seperate groups so the user will end up in the correct group. First the dropdown list was populated based on the groupids. But if you then add groups, the newest groups will be at the bottom of the list. It is easier for users to have the branch list sorted alphabetically.
$course_groups = groups_get_groups($course->id);
// order course groups alphabetically
$course_groups_name = array();
foreach ($course_groups as $group){
array_push($course_groups_name,groups_get_group_name($group));
}
asort($course_groups_name);




















Sorry, comments for this entry are closed at this time.