mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
Follow-up fix for Bug MDL-8617 "Implement groupings & course modules..." internal (sam's patch, thank you!)
This commit is contained in:
parent
504af96b2e
commit
20ed8a7215
1 changed files with 15 additions and 1 deletions
|
@ -188,8 +188,13 @@ function groups_groupids_to_groups($groupids, $courseid=false, $alldata=false) {
|
|||
|
||||
/**
|
||||
* Get a sorted array of group-id/display-name objects.
|
||||
* @param array $groupids Array of group IDs
|
||||
* @param bool $justnames Return names only as values, not objects. Needed
|
||||
* for print_group_menu in weblib
|
||||
* @return array If $justnames is set, returns an array of id=>name. Otherwise
|
||||
* returns an array without specific keys of objects containing id, name
|
||||
*/
|
||||
function groups_groupids_to_group_names($groupids) {
|
||||
function groups_groupids_to_group_names($groupids, $justnames=false) {
|
||||
if (! $groupids) {
|
||||
return array();
|
||||
}
|
||||
|
@ -216,6 +221,15 @@ function groups_groupids_to_group_names($groupids) {
|
|||
$gname->name = $name;
|
||||
$group_names[] = $gname;
|
||||
}*/
|
||||
|
||||
if ($justnames) {
|
||||
$namesonly = array();
|
||||
foreach ($group_names as $id => $object) {
|
||||
$namesonly[$object->id] = $object->name;
|
||||
}
|
||||
return $namesonly;
|
||||
}
|
||||
|
||||
return $group_names;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue